/**
 * Styles pour le module Echantillons
 * Intégré avec la charte graphique du site
 */

/* ========================================
   CONTENEUR PRINCIPAL
   ======================================== */
.echantillons-container {
    margin: 0 auto;
    padding: 0;
    font-family: 'Open Sans', sans-serif;
}

/* ========================================
   LAYOUT 2 COLONNES (inspiré cushioncalculator)
   Image à gauche, formulaire à droite
   ======================================== */
.echantillons-layout {
    display: flex;
    flex-direction: row-reverse; /* formulaire à droite, image à gauche */
    min-height: 600px;
    align-items: stretch;
}

/* --- Colonne image (gauche) --- */
.echantillons-image-section {
    flex: 1;
    width: 50%;
    overflow: hidden;
    position: relative;
    background: #f4f0eb;
}

.echantillons-main-image {
    width: 100%;
    height: 100%;
    min-height: 600px;
}

.echantillons-main-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Placeholder quand pas d'image */
.echantillons-image-section:not(:has(.echantillons-main-image img)) {
    background: linear-gradient(135deg, #f4f0eb 0%, #e8e0d5 100%);
}

/* --- Colonne formulaire (droite) --- */
.echantillons-form-section {
    flex: none;
    width: 55%;
    min-width: 500px;
    background: #fff;
    overflow-y: auto;
}

.echantillons-form-panel {
    padding: 0px 40px;
}

/* --- Titre principal --- */
.echantillons-title {
    font-family: 'Playfair Display', serif;
    font-size: 2.7em;
    color: var(--couleur-text-primary, #3e3e3e);
    margin: 0 0 25px 0;
    line-height: 1.2;
    justify-self: center;
    text-transform: uppercase;
}

/* ========================================
   INTRODUCTION
   ======================================== */
.echantillons-intro {
    border-radius: 8px;
    text-align: center;
}

.echantillons-intro p {
    margin: 0 0 8px 0;
    font-size: 0.95em;
    color: var(--couleur-text-primary, #3e3e3e);
    line-height: 1.25em;
}

.echantillons-quantity-info {
    font-size: 0.95em;
    color: #666;
}

.echantillons-quantity-info strong {
    color: var(--couleur-bouton, #9cbf9b);
}

/* ========================================
   CARTE PRODUIT
   ======================================== */
.echantillons-product {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease;
    background: #fff;
}

.card-header {
    padding: 0;
    border: 0px;
    display: none;
}

.echantillons-product-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.echantillons-product-name {
    margin: 0 0 5px 0;
    font-size: 1.4em;
    font-weight: 600;
    color: var(--couleur-text-primary, #3e3e3e);
    font-family: 'Playfair Display', serif;
}

.echantillons-product-description {
    font-size: 0.9em;
    color: #666;
    line-height: 1.5;
}

/* ========================================
   GRILLE 2 COLONNES
   ======================================== */
.echantillons-combinations {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    padding: 20px;
}

/* ========================================
   DÉCLINAISON (COMBINAISON)
   ======================================== */
.echantillons-combination {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s ease;
    overflow: hidden;
    background: #fff;
}

.echantillons-combination:hover:not(.out-of-stock):not(.max-reached):not(.in-cart) {
    border-color: var(--couleur-bouton, #9cbf9b);
    box-shadow: 0 4px 12px rgba(156, 191, 155, 0.25);
}

.echantillons-combination.out-of-stock {
    opacity: 0.5;
    background-color: #f9f9f9;
}

/* Déclinaison déjà dans le panier */
.echantillons-combination.in-cart {
    opacity: 0.7;
    background-color: rgba(156, 191, 155, 0.15);
    border-color: var(--couleur-bouton, #9cbf9b);
}

.echantillons-combination.in-cart .echantillons-combination-label {
    cursor: not-allowed;
}

.combination-in-cart {
    font-size: 0.75em;
    color: #4a6d49;
    background: rgba(156, 191, 155, 0.3);
    padding: 4px 10px;
    border-radius: 4px;
    margin-left: auto;
    font-weight: 600;
    max-width: 80%;
}

/* Label cliquable */
.echantillons-combination-label {
    display: flex;
    align-items: center;
    padding: 12px;
    cursor: pointer;
    margin: 0;
    min-height: 80px;
}

.echantillons-combination.out-of-stock .echantillons-combination-label {
    cursor: not-allowed;
}

/* Checkbox */
.echantillons-combination-label input[type="checkbox"] {
    margin-right: 12px;
    transform: scale(1.3);
    flex-shrink: 0;
    accent-color: var(--couleur-bouton, #9cbf9b);
}

.echantillons-combination-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

/* Image de la déclinaison */
.combination-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    flex-shrink: 0;
}

/* Placeholder gris pour images manquantes */
.combination-image-placeholder {
    display: block;
    width: 60px;
    height: 60px;
    background-color: #e8e8e8;
    border-radius: 6px;
    border: 1px dashed #ccc;
    flex-shrink: 0;
}

.combination-name {
    font-weight: 500;
    color: var(--couleur-text-primary, #3e3e3e);
    font-size: 0.95em;
}

.combination-stock {
    font-size: 0.8em;
    color: #dc3545;
    background: #fff3f3;
    padding: 3px 10px;
    border-radius: 4px;
    margin-left: auto;
}

/* Checkbox coché */
.echantillons-combination:has(input:checked) {
    border-color: var(--couleur-bouton, #9cbf9b);
    background-color: rgba(156, 191, 155, 0.1);
}

.echantillons-combination:has(input:checked) .combination-name {
    color: var(--couleur-onglet-produit, #6b716a);
    font-weight: 600;
}

.col-auto {
    text-align: center;
}

form#echantillons-form {
    padding-top: 30px;
}

/* ========================================
   ANIMATIONS
   ======================================== */
.echantillons-combination.removing {
    animation: slideOutFade 0.4s ease forwards;
}

@keyframes slideOutFade {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.8);
    }
}

.echantillons-combination.added-to-cart {
    animation: addedPulse 0.5s ease;
}

@keyframes addedPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); background-color: rgba(156, 191, 155, 0.3); }
    100% { transform: scale(1); }
}

/* ========================================
   BARRE D'ACTIONS (STICKY)
   ======================================== */
.echantillons-actions {
    position: sticky;
    bottom: 0;
    background: white;
    padding: 20px 25px;
    border-top: 2px solid var(--couleur-bouton, #9cbf9b);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.08);
    border-radius: 8px 8px 0 0;
    gap: 20px;
    transition: opacity 0.3s ease;
}

.echantillons-summary {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Info panier existant */
.cart-info {
    font-size: 0.9em;
    color: #4a6d49;
    background: rgba(156, 191, 155, 0.2);
    padding: 6px 12px;
    border-radius: 5px;
    display: inline-block;
}

.cart-info .cart-count {
    font-weight: 700;
    font-size: 1.1em;
    color: var(--couleur-onglet-produit, #6b716a);
}

/* Info sélection */
.selected-info {
    font-size: 1.15em;
    color: var(--couleur-text-primary, #3e3e3e);
}

.selected-info .selected-count {
    font-weight: 700;
    color: var(--couleur-bouton, #9cbf9b);
    font-size: 1.3em;
}

.total-info {
    font-size: 0.85em;
    color: #888;
}

.total-info .total-count {
    font-weight: 600;
    color: var(--couleur-text-primary, #3e3e3e);
}

/* Prix */
.price-info {
    font-size: 1.15em;
    margin-top: 3px;
}

.price-info .current-price {
    font-weight: 700;
    color: var(--couleur-prix, #666666);
    font-size: 1.3em;
}

/* Avertissement quantité */
.quantity-warning {
    color: #c0392b;
    font-size: 0.9em;
    font-weight: 500;
    padding: 5px 0;
}

/* ========================================
   BOUTON AJOUTER AU PANIER
   ======================================== */
#echantillons-submit {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 35px;
    font-size: 1.1em;
    white-space: nowrap;
    background-color: var(--couleur-bouton, #9cbf9b);
    border: none;
    border-radius: 5px;
    color: #fff;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(156, 191, 155, 0.3);
}

#echantillons-submit:hover:not(:disabled) {
    background-color: var(--couleur-bouton-hover, #c0d4bf);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(156, 191, 155, 0.4);
}

#echantillons-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#echantillons-submit .material-icons {
    font-size: 1.3em;
}

/* ========================================
   MESSAGES D'ALERTE
   ======================================== */
#echantillons-message {
    margin-top: 20px;
    padding: 15px 20px;
    border-radius: 5px;
    font-size: 0.95em;
}

#echantillons-message.alert-success {
    background-color: var(--couleur-alert-background, #d9e6d8);
    border: 1px solid var(--couleur-alert-border, #9cbf9b);
    color: var(--couleur-alert-text, #444444);
}

#echantillons-message.alert-danger {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* ========================================
   BOUTONS TOUT SÉLECTIONNER
   ======================================== */
.select-all-btn,
.deselect-all-btn {
    font-size: 0.85em;
    padding: 6px 12px;
    border-radius: 5px;
    transition: all 0.2s ease;
}

.select-all-btn {
    background-color: transparent;
    border: 1px solid var(--couleur-bouton, #9cbf9b);
    color: var(--couleur-onglet-produit, #6b716a);
}

.select-all-btn:hover {
    background-color: var(--couleur-bouton, #9cbf9b);
    color: #fff;
}

.deselect-all-btn {
    background-color: transparent;
    border: 1px solid #ccc;
    color: #666;
}

.deselect-all-btn:hover {
    background-color: #f0f0f0;
    border-color: #999;
}

/* ========================================
   ZONE DE SUCCÈS APRÈS AJOUT AU PANIER
   ======================================== */
.echantillons-success-actions {
    margin-top: 30px;
    padding: 35px;
    background: linear-gradient(135deg, rgba(156, 191, 155, 0.15) 0%, rgba(156, 191, 155, 0.25) 100%);
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(156, 191, 155, 0.3);
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.success-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
}

.success-message .material-icons {
    font-size: 3em;
    color: var(--couleur-onglet-produit, #6b716a);
}

.success-message .success-text {
    font-size: 1.4em;
    font-weight: 600;
    color: var(--couleur-onglet-produit, #6b716a);
    font-family: 'Playfair Display', serif;
}

.success-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.success-buttons .btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 30px;
    font-size: 1.05em;
    border-radius: 5px;
    transition: all 0.3s ease;
    font-weight: 600;
}

.success-buttons .btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.success-buttons .btn .material-icons {
    font-size: 1.3em;
}

#btn-go-cart {
    background-color: var(--couleur-bouton, #9cbf9b);
    border: none;
    color: white;
}

#btn-go-cart:hover {
    background-color: var(--couleur-bouton-hover, #c0d4bf);
}

#btn-continue-shopping {
    background-color: white;
    border: 2px solid var(--couleur-bouton, #9cbf9b);
    color: var(--couleur-onglet-produit, #6b716a);
}

#btn-continue-shopping:hover {
    background-color: rgba(156, 191, 155, 0.1);
}

/* ========================================
   RESPONSIVE - TABLETTE (breakpoint layout 2 colonnes)
   ======================================== */
@media (max-width: 1024px) {
    .echantillons-layout {
        flex-direction: column;
    }

    .echantillons-image-section {
        width: 100%;
        min-height: 300px;
        max-height: 400px;
    }

    .echantillons-main-image {
        min-height: 300px;
    }

    .echantillons-form-section {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .echantillons-form-panel {
        padding: 30px 20px;
    }
}

/* ========================================
   RESPONSIVE - MOBILE
   ======================================== */
@media (max-width: 768px) {
    .echantillons-image-section {
        min-height: 220px;
        max-height: 280px;
    }

    .echantillons-main-image {
        min-height: 220px;
    }

    .echantillons-form-panel {
        padding: 20px 15px;
    }

    .echantillons-title {
        font-size: 1.6em;
    }

    .echantillons-combinations {
        grid-template-columns: 1fr;
    }

    .echantillons-actions {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 20px 15px;
    }

    .echantillons-summary {
        align-items: center;
    }

    .echantillons-submit-wrapper {
        width: 100%;
        align-items: center;
    }

    .echantillons-login-notice {
        max-width: 100%;
        text-align: center;
        flex-direction: column;
        gap: 8px;
    }

    .echantillons-product .card-header .row {
        flex-direction: column;
        text-align: center;
    }

    .echantillons-product .card-header .col-auto {
        margin-top: 15px;
    }

    .echantillons-product-image {
        margin-bottom: 10px;
    }

    #echantillons-submit {
        width: 100%;
        justify-content: center;
    }

    .success-buttons {
        flex-direction: column;
    }

    .success-buttons .btn {
        width: 100%;
        justify-content: center;
    }

    .echantillons-intro {
        padding: 15px;
    }

    .echantillons-product-name {
        font-size: 1.2em;
    }
}

/* ========================================
   ANIMATION DE CHARGEMENT
   ======================================== */
#echantillons-submit.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

#echantillons-submit.loading::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   INDICATEUR MAX ATTEINT
   ======================================== */
.echantillons-combination.max-reached:not(:has(input:checked)) {
    opacity: 0.4;
    pointer-events: none;
}

/* ========================================
   ZONE BOUTON SUBMIT + MESSAGE CONNEXION
   ======================================== */
.echantillons-submit-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

.echantillons-login-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(156, 191, 155, 0.15);
    border: 1px solid var(--couleur-bouton, #9cbf9b);
    border-radius: 6px;
    padding: 12px 18px;
    font-size: 0.9em;
    color: var(--couleur-text-primary, #3e3e3e);
    /*max-width: 350px;*/
    text-align: left;
}

.echantillons-login-notice .material-icons {
    font-size: 1.8em;
    color: var(--couleur-bouton, #9cbf9b);
    flex-shrink: 0;
}

.echantillons-login-notice a {
    color: var(--couleur-onglet-produit, #6b716a);
    font-weight: 600;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.echantillons-login-notice a:hover {
    color: var(--couleur-bouton, #9cbf9b);
}

/* Bouton grisé quand non connecté */
#echantillons-submit.not-logged {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ========================================
   STYLES SPÉCIFIQUES AUX CHECKBOXES
   ======================================== */
.echantillons-combination-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.echantillons-combination-label input[type="checkbox"]:checked {
    background-color: var(--couleur-bouton, #9cbf9b);
}

/* Personnalisation checkbox pour navigateurs modernes */
@supports (accent-color: auto) {
    .echantillons-combination-label input[type="checkbox"] {
        accent-color: var(--couleur-bouton, #9cbf9b);
    }
}
/*---------PERSO--------*/


@media (min-width: 1200px) {
    .row {
        justify-items: center;
    }
}

.btn-outline-primary:hover,
.btn-outline-primary:active:hover,
.btn-outline-primary:focus, 
.btn-outline-primary:active{
    border-color:#9cbf9b;
    background-color: #c0d4bf;
}

.btn-primary:active, .btn-outline-secondary:active {
    background-color: #c0d4bf;
}

.btn-outline-secondary:hover {
    color: #232323;
}

.btn-outline-secondary:focus, .btn-outline-secondary.focus {
    color: #242424;

}