/* ==========================================================================
   Minimum Quantity Per Product - Frontend Styles
   ========================================================================== */

/* Messages d'information */
.mqpp-message {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    margin: 0 0 20px 0;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.4;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    animation: mqppSlideIn 0.3s ease-out;
}

@keyframes mqppSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Types de messages */
.mqpp-message--info {
    background-color: #e3f2fd;
    border-left: 4px solid #2196f3;
    color: #1565c0;
}

.mqpp-message--notice {
    background-color: #fff3e0;
    border-left: 4px solid #ff9800;
    color: #ef6c00;
}

.mqpp-message--warning {
    background-color: #fff8e1;
    border-left: 4px solid #ffc107;
    color: #f57c00;
}

.mqpp-message--error {
    background-color: #ffebee;
    border-left: 4px solid #f44336;
    color: #c62828;
}

.mqpp-message__text {
    flex: 1;
    margin-right: 10px;
}

.mqpp-message__close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.mqpp-message__close:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

/* Informations de quantité minimum */
.mqpp-minimum-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin: 10px 0;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    font-size: 13px;
    color: #495057;
}

.mqpp-icon {
    font-style: normal;
    font-weight: bold;
    color: #6c757d;
}

/* Indicateur de quantité sur le champ input */
.mqpp-quantity-indicator {
    display: inline-block;
    font-size: 11px;
    padding: 2px 6px;
    margin-left: 8px;
    border-radius: 3px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #6c757d;
    transition: all 0.2s ease;
}

.mqpp-quantity-indicator--warning {
    background-color: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

/* Styles pour le bouton de panier en cours de traitement */
.single_add_to_cart_button.loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.single_add_to_cart_button.loading:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: mqppSpin 1s linear infinite;
}

@keyframes mqppSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive design */
@media (max-width: 768px) {
    .mqpp-message {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .mqpp-minimum-info {
        font-size: 12px;
        padding: 6px 10px;
    }
    
    .mqpp-quantity-indicator {
        font-size: 10px;
        padding: 1px 4px;
    }
}

/* Styles pour l'intégration avec différents thèmes */

/* Storefront theme compatibility */
.storefront .mqpp-message {
    margin-bottom: 1.618em;
}

/* Astra theme compatibility */
.astra-shop-thumbnail-wrap .mqpp-message {
    margin: 0 0 15px 0;
}

/* OceanWP theme compatibility */
.oceanwp-single-product .mqpp-message {
    margin-bottom: 20px;
}

/* Flatsome theme compatibility */
.product-main .mqpp-message {
    margin-bottom: 1em;
}

/* Styles pour les boutons de quantité personnalisés */
.quantity .plus,
.quantity .minus {
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.quantity .plus:hover,
.quantity .minus:hover {
    opacity: 0.8;
}

/* Amélioration de l'accessibilité */
.mqpp-message {
    outline: none;
}

.mqpp-message:focus-within {
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.3);
}

.mqpp-message__close:focus {
    outline: 2px solid #2196f3;
    outline-offset: 2px;
}

/* Animation pour les changements de quantité */
.quantity input[name="quantity"] {
    transition: border-color 0.2s ease;
}

.quantity input[name="quantity"]:focus {
    border-color: #2196f3 !important;
}

/* Style pour les produits avec quantité minimum dans les listes */
.products .product .mqpp-minimum-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: #2196f3;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    z-index: 10;
}

/* ==========================================================================
   Messages simples de quantité minimum
   ========================================================================== */

/* Message d'avertissement */
.mqpp-warning {
     position: absolute;
    top: -50px;
    width: 300px;
    left: 40px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 20px;
    margin: 0 0 20px 0;
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-left: 4px solid #f39c12;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.4;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    animation: mqppSlideDown 0.3s ease-out;
}

@keyframes mqppSlideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
        max-height: 0;
    }
    to {
        opacity: 1;
        transform: translateY(0);
        max-height: 100px;
    }
}

.mqpp-warning-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.mqpp-warning-text {
    flex: 1;
    color: #856404;
    font-weight: 500;
}

.mqpp-adjust-btn {
    background-color: #f39c12;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.mqpp-adjust-btn:hover {
    background-color: #e67e22;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Message de succès */
.mqpp-success {
     position: absolute;
    top: -50px;
    width: 300px;
    left: 40px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    margin: 0 0 20px 0;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    border-left: 4px solid #28a745;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.4;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    animation: mqppSlideDown 0.3s ease-out;
}

.mqpp-success-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.mqpp-success-text {
    flex: 1;
    color: #155724;
    font-weight: 500;
}

/* Animation du champ quantité quand il est mis à jour */
.quantity input[name="quantity"].mqpp-updated {
    animation: mqppHighlight 1s ease;
    border-color: #28a745 !important;
}

@keyframes mqppHighlight {
    0% { 
        background-color: #d4edda;
        transform: scale(1);
    }
    50% { 
        background-color: #c3e6cb;
        transform: scale(1.02);
    }
    100% { 
        background-color: transparent;
        transform: scale(1);
    }
}

/* Responsive pour les messages */
@media (max-width: 768px) {
    .mqpp-warning,
    .mqpp-success {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    
    .mqpp-adjust-btn {
        width: 100%;
        padding: 10px 15px;
    }
    
    .mqpp-warning-text,
    .mqpp-success-text {
        font-size: 13px;
    }
}

/* ==========================================================================
   Modal d'avertissement quantité minimum
   ========================================================================== */

.mqpp-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mqpp-modal--show {
    opacity: 1;
    visibility: visible;
}

.mqpp-modal__backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    cursor: pointer;
}

.mqpp-modal__content {
    position: relative;
    max-width: 500px;
    margin: 5% auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.mqpp-modal--show .mqpp-modal__content {
    transform: translateY(0);
}

.mqpp-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e9ecef;
    background-color: #f8f9fa;
}

.mqpp-modal__title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mqpp-modal__close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
    color: #6c757d;
}

.mqpp-modal__close:hover {
    background-color: #e9ecef;
    color: #495057;
}

.mqpp-modal__body {
    padding: 24px;
}

.mqpp-modal__message {
    font-size: 16px;
    line-height: 1.5;
    color: #495057;
    margin: 0 0 16px 0;
}

.mqpp-modal__current {
    background-color: #f8f9fa;
    padding: 16px;
    border-radius: 6px;
    margin: 16px 0;
    font-size: 14px;
    line-height: 1.6;
    border-left: 4px solid #ffc107;
}

.mqpp-modal__current p {
    margin: 0 0 8px 0;
}

.mqpp-modal__current p:last-child {
    margin-bottom: 0;
}

.mqpp-modal__action {
    font-size: 15px;
    color: #495057;
    margin: 16px 0 0 0;
    font-weight: 500;
}

.mqpp-highlight {
    color: #2196f3;
    font-weight: 600;
}

.mqpp-highlight--error {
    color: #f44336;
}

.mqpp-highlight--success {
    color: #4caf50;
}

.mqpp-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid #e9ecef;
    background-color: #f8f9fa;
}

.mqpp-modal__btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
}

.mqpp-modal__btn--primary {
    background-color: #2196f3;
    color: white;
}

.mqpp-modal__btn--primary:hover {
    background-color: #1976d2;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.mqpp-modal__btn--secondary {
    background-color: #6c757d;
    color: white;
}

.mqpp-modal__btn--secondary:hover {
    background-color: #5a6268;
    transform: translateY(-1px);
}

/* Animation de mise à jour du champ quantité */
.mqpp-quantity-updated {
    animation: mqppPulse 1s ease;
    border-color: #2196f3 !important;
}

@keyframes mqppPulse {
    0% { 
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(33, 150, 243, 0.7);
    }
    70% { 
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(33, 150, 243, 0);
    }
    100% { 
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(33, 150, 243, 0);
    }
}

/* Responsive pour la modal */
@media (max-width: 768px) {
    .mqpp-modal__content {
        margin: 10% 20px;
        max-width: none;
    }
    
    .mqpp-modal__header,
    .mqpp-modal__body,
    .mqpp-modal__footer {
        padding: 16px 20px;
    }
    
    .mqpp-modal__title {
        font-size: 16px;
    }
    
    .mqpp-modal__message {
        font-size: 15px;
    }
    
    .mqpp-modal__footer {
        flex-direction: column;
    }
    
    .mqpp-modal__btn {
        width: 100%;
        margin: 0;
    }
}

@media (max-width: 480px) {
    .mqpp-modal__content {
        margin: 5% 10px;
    }
}

/* ==========================================================================
   Boutons "Check the product" dans les pages de listing
   ========================================================================== */

/* Styles pour les boutons "Voir le produit" sur les pages shop/archive */
.mqpp-check-product {
    align-items: center;
    border-style: none;
    display: inline-flex;
    justify-content: center;
    line-height: inherit;
    overflow: hidden;
    white-space: normal;
    word-break: normal;
    border-radius: 6px;
    position: relative;
    color: var(--white) !important;
    transition: all .3s ;
    width: auto;
    text-align: center;
    text-decoration: none !important;
    z-index: 2;
    border: none !important;
    background-color: var(--wp--preset--color--contrast) !important;
    font-size: var(--wp--preset--font-size--small) !important;
    padding-top: var(--wp--preset--spacing--20);
    padding-right: var(--wp--preset--spacing--30);
    padding-bottom: var(--wp--preset--spacing--20);
    padding-left: var(--wp--preset--spacing--30);
    font-family: var(--wp--preset--font-family--univers) !important;
    margin-bottom: 16px;
}


  .mqpp-check-product::after {
    content: "";
    background-color: white !important;
    transition: all .6s ease-out !important;
    width: 0px;
    height: 100%;
    display: block;
    position: absolute;
    left: 0;
    top: 0;
    z-index: -1;
}

 .mqpp-check-product:hover{
   
    transition: all .4s ease-in-out;
    color:#a6192e!important;
 }
 .mqpp-check-product:hover::after{
    width: 110%;
    z-index: -1;
    transition: all .3s ease-in-out;
    color:#a6192e!important;
 }


.mqpp-check-button-wrapper {
    width: 100%;
    display: grid;
    align-items: center;
    justify-content: center;
}



/* Adaptation pour différents thèmes WooCommerce */

/* Style par défaut WooCommerce */
.woocommerce ul.products li.product .mqpp-check-product,
.woocommerce-page ul.products li.product .mqpp-check-product {
    width: 100%;
    text-align: center;
    padding: 8px 12px;
    margin-top: 10px;
}

/* Compatibilité avec Storefront */
.storefront .woocommerce ul.products li.product .mqpp-check-product {
    font-size: 0.875em;
    padding: 0.875em 1.41575em;
}

/* Compatibilité avec Astra */
.astra-theme .woocommerce ul.products li.product .mqpp-check-product {
    border-radius: 3px;
    font-size: 14px;
    padding: 10px 15px;
}

/* Compatibilité avec OceanWP */
.oceanwp-theme .woocommerce ul.products li.product .mqpp-check-product {
    border-radius: 3px;
    font-size: 13px;
    padding: 12px 20px;
}

/* Styles responsive */
@media (max-width: 768px) {
    .mqpp-check-product {
        font-size: 13px !important;
        padding: 8px 10px !important;
    }
    
    .mqpp-check-product:after {
        font-size: 11px;
        padding: 4px 8px;
    }
}

@media (max-width: 480px) {
    .mqpp-check-product {
        font-size: 12px !important;
        padding: 6px 8px !important;
    }
    
    /* Masquer le tooltip sur mobile pour éviter les problèmes */
    .mqpp-check-product:after,
    .mqpp-check-product:before {
        display: none;
    }
}

/* Animation d'entrée pour les boutons */
@keyframes mqppFadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mqpp-check-product {
    animation: mqppFadeInUp 0.3s ease-out;
}

/* ==========================================================================
   Support pour les blocs WooCommerce (Gutenberg)
   ========================================================================== */

/* Styles pour les boutons dans les blocs WooCommerce */
.wp-block-woocommerce-product-collection .mqpp-check-product-block,
.wp-block-woocommerce-handpicked-products .mqpp-check-product-block,
.wp-block-woocommerce-product-category .mqpp-check-product-block,
.wp-block-woocommerce-products-by-attribute .mqpp-check-product-block {
    background-color: #2196f3 !important;
    color: white !important;
    border-color: #1976d2 !important;
    transition: all 0.3s ease !important;
    text-decoration: none !important;
    position: relative !important;
}

.wp-block-woocommerce-product-collection .mqpp-check-product-block:hover,
.wp-block-woocommerce-handpicked-products .mqpp-check-product-block:hover,
.wp-block-woocommerce-product-category .mqpp-check-product-block:hover,
.wp-block-woocommerce-products-by-attribute .mqpp-check-product-block:hover {
    background-color: #1976d2 !important;
    color: white !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4) !important;
    text-decoration: none !important;
}

/* Override des styles par défaut des blocs */
.wc-block-components-product-button__button.mqpp-check-product-block {
    background: #2196f3 !important;
    color: white !important;
    border: 1px solid #1976d2 !important;
}

.wc-block-components-product-button__button.mqpp-check-product-block:hover {
    background: #1976d2 !important;
    color: white !important;
}

/* Badge spécifique pour les blocs */
.mqpp-check-product-block::before {
    content: '';
    position: absolute;
    top: -3px;
    right: -3px;
    width: 10px;
    height: 10px;
    background-color: #ff9800;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

/* Tooltip pour les blocs */
.mqpp-check-product-block::after {
    content: "Min: " attr(data-mqpp-min-qty);
    position: absolute;
    bottom: 115%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    pointer-events: none;
}

.mqpp-check-product-block:hover::after {
    opacity: 1;
    visibility: visible;
    bottom: 110%;
}

/* Compatibilité avec les différents thèmes pour les blocs */
.theme-storefront .mqpp-check-product-block,
.theme-astra .mqpp-check-product-block,
.theme-oceanwp .mqpp-check-product-block,
.theme-generatepress .mqpp-check-product-block {
    font-size: inherit !important;
    padding: inherit !important;
    border-radius: inherit !important;
}

/* Responsive pour les blocs */
@media (max-width: 768px) {
    .mqpp-check-product-block::after {
        display: none; /* Masquer tooltip sur mobile */
    }
    
    .mqpp-check-product-block::before {
        width: 8px;
        height: 8px;
        top: -2px;
        right: -2px;
    }
}

@media (max-width: 480px) {
    .mqpp-check-product-block {
        font-size: 12px !important;
    }
}