/* css/upsell-popup.css */
#upsell-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

#upsell-popup-container {
    background-color: #fff;
    border-radius: 8px;
    padding: 30px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    /* Ajout d'un display flex pour mobile */
    display: flex;
    flex-direction: column;
}

#upsell-popup-close {
    position: absolute;
    right: 15px;
    top: 10px;
    font-size: 28px;
    cursor: pointer;
    color: #333;
    transition: color 0.2s ease;
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    z-index: 10;
}

#upsell-popup-close:hover {
    color: #000;
}

#upsell-popup-content {
    margin-bottom: 30px;
    /* Pour mobile, permettre au contenu de scroller si nécessaire */
    overflow-y: auto;
    flex: 1;
}

#upsell-popup-content h2 {
    margin-top: 0;
    margin-bottom: 20px;
    text-align: center;
    color: #333;
    font-size: 24px;
}

#upsell-popup-content p {
    text-align: center;
    color: #555;
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 30px;
}

/* Grille pour les catégories */
.upsell-categories-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .upsell-categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    #upsell-popup-container {
        padding: 20px 15px;
        width: 95%;
        max-height: 85vh;
        /* Structure pour mobile */
        display: flex;
        flex-direction: column;
    }
    
    #upsell-popup-content {
        flex: 1;
        overflow-y: auto;
        padding-bottom: 10px;
    }
    
    #upsell-popup-content h2 {
        font-size: 20px;
        margin-bottom: 15px;
        padding-right: 30px; /* Espace pour le bouton fermer */
    }
    
    #upsell-popup-content p {
        font-size: 14px;
        margin-bottom: 20px;
    }
}

@media (max-width: 480px) {
    .upsell-categories-grid {
        grid-template-columns: 1fr;
    }
    
    #upsell-popup-container {
        padding: 15px 10px 10px 10px;
        width: 95%;
        /* Structure fixe pour mobile */
        height: 80vh;
        display: flex;
        flex-direction: column;
    }
    
    #upsell-popup-close {
        right: 10px;
        top: 5px;
    }
    
    #upsell-popup-content {
        flex: 1;
        overflow-y: auto;
        /* Ajouter un padding inférieur pour éviter que le contenu ne soit caché par les boutons */
        padding-bottom: 10px;
        margin-bottom: 10px;
    }
    
    #upsell-popup-content h2 {
        font-size: 18px;
        margin-bottom: 10px;
        padding-right: 30px;
    }
    
    #upsell-popup-content p {
        font-size: 13px;
        margin-bottom: 15px;
    }
    
    .upsell-category-block {
        margin-bottom: 15px !important;
    }
}

/* Règles pour les cards avec texte sur image */
.upsell-category-block {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    height: 250px; /* Hauteur modifiée à 250px comme demandé */
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #eee;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.upsell-category-block:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.upsell-category-link {
    text-decoration: none;
    color: inherit;
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
}

.upsell-category-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.upsell-category-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upsell-category-text {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 15px 10px;
    background: rgba(0, 0, 0, 0.7);
    background: linear-gradient(360deg,rgba(51, 49, 49, 0.45) 0%, rgba(51, 49, 49, 0.20) 80%);
    color: #fff; /* Texte blanc comme demandé */
    z-index: 2;
    text-align: center;
}

.upsell-category-block h3 {
    margin: 0 0 5px 0;
    font-size: 18px;
    color: white;
    line-height: 18px;
}

/* Retirer la marge sur le paragraphe dans .upsell-category-text comme demandé */
.upsell-category-text p {
    margin: 0 !important;
    color: #fff !important; /* Texte blanc comme demandé */
    font-size: 14px;
}

#upsell-popup-actions {
    text-align: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: center;
    /* Assurons-nous que cette partie reste fixe en bas */
    flex-shrink: 0;
}

@media (max-width: 480px) {
    #upsell-popup-actions {
        flex-direction: row; /* Maintenir en ligne sur mobile */
        gap: 10px;
        padding-top: 10px;
        margin-top: 10px;
        /* Fixer au bas de la popup */
        position: sticky;
        bottom: 0;
        background-color: white;
        padding-bottom: 5px;
        z-index: 5;
    }
    
    #upsell-popup-actions a {
        flex: 1; /* Les boutons prennent une largeur égale */
        padding: 10px 5px !important;
        font-size: 14px !important;
        margin: 0 5px !important;
        white-space: nowrap;
    }
    
    .upsell-category-block {
        height: 200px !important; /* Hauteur ajustée pour mobile */
    }
}

#upsell-popup-actions a {
    padding: 12px 20px;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

#upsell-continue-shopping {
    background-color: #f8f9fa;
    color: #333;
}

#upsell-continue-checkout {
    background-color: rgba(130,196,0,1);
    color: white;
}

/* Animation pour l'ouverture de la popup */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

#upsell-popup-overlay {
    animation: fadeIn 0.3s;
}

/* Ajustements tactiles pour les appareils mobiles */
@media (max-width: 768px) {
    #upsell-popup-close, 
    #upsell-continue-shopping, 
    #upsell-continue-checkout,
    .upsell-category-link {
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(0,0,0,0);
        tap-highlight-color: rgba(0,0,0,0);
    }
    
    #upsell-popup-close {
        font-size: 32px; /* Plus grand pour être plus facile à toucher */
    }
    
    /* Augmenter la taille des zones tactiles */
    #upsell-popup-actions a {
        padding: 14px 20px;
        min-height: 44px; /* Taille minimale recommandée pour les zones tactiles */
    }
}