/**
 * UX/UI Design Cohérent - Page Produit Nutriforce
 * Inspiré de Huel - Design moderne, épuré et professionnel
 */

/* ========================================
   VARIABLES LOCALES (utilisent design-tokens.css)
   ======================================== */

:root {
    --nf-radius: 8px;
    --nf-transition: all 0.2s ease;
}

/* ========================================
   CLS - RÉSERVATION D'ESPACE PAR ÉLÉMENT (Adaptatif)
   ======================================== */

/*
 * Approche granulaire : chaque élément ATOMIQUE réserve son espace uniquement s'il existe dans le DOM
 * Les min-height sont sur les éléments individuels, PAS sur les conteneurs
 *
 * ✅ Éléments atomiques protégés :
 * - .product_title (38px desktop / 35px mobile)
 * - .woocommerce-product-rating (60px desktop / 59px mobile)
 * - .nf-highlights (25px desktop / 24px mobile) - optionnel
 * - .woocommerce-product-details__short-description (102px desktop / 128px mobile)
 * - .custom-card (53px desktop / 47px mobile) - élément individuel
 * - .bq-variations select / .bq-variation-select (50px) - chaque select
 * - .nf-subscribe-benefits (177px) - bloc avantages abonnement
 * - .single_add_to_cart_button (58px desktop / 56px mobile)
 * - .price-placeholder (70px × 20px desktop / 65px × 20px mobile)
 *
 * ❌ Pas de min-height sur les conteneurs (.custom-section, .custom-card-group)
 * → S'adaptent automatiquement au nombre d'éléments enfants
 */

/* ========================================
   TITRE PRODUIT & PRIX
   ======================================== */

.woocommerce div.product .product_title {
    min-height: 38px !important; /* CLS - atomique */
    font-size: 32px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--nf-text-dark);
    margin-bottom: 12px;
}

.woocommerce div.product p.price {
    font-size: 28px;
    font-weight: 700;
    color: var(--nf-text-dark);
    margin-bottom: 16px;
}

.woocommerce div.product .woocommerce-product-rating {
    min-height: 22px !important; /* CLS - atomique */
    margin-bottom: 20px;
}

/* Description courte */
.woocommerce div.product .woocommerce-product-details__short-description {
    min-height: 60px !important; /* CLS - atomique */
    font-size: 16px;
    line-height: 1.6;
    color: var(--nf-text-medium);
    margin-bottom: 24px;
}

/* ========================================
   SÉLECTEUR DE VARIATIONS
   ======================================== */

.bq-variations {
    margin-bottom: 24px;
    min-height: unset !important; /* Force la suppression de tout min-height - adaptatif aux selects */
}

.bq-variations label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--nf-text-dark);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bq-variations select,
.bq-variation-select {
    width: 100%;
    padding: 14px 40px 14px 16px !important;
    font-size: 15px;
    color: var(--nf-text-dark);
    background-color: #fff;
    border: 2px solid #ccc !important;
    border-radius: 16px !important;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    min-height: 50px !important; /* CLS - atomique, chaque select */
}

.bq-variations select:hover {
    border-color: var(--nf-primary) !important;
}

.bq-variations select:focus {
    outline: none !important;
    border-color: var(--nf-primary) !important;
}

/* ========================================
   CARTES DE QUANTITÉ (CURE)
   ======================================== */

.custom-section {
    margin: 24px 0;
    /* Pas de min-height - les custom-card enfants (53px chacune) suffisent, adaptatif au nombre de cartes */
}

/* Bandeau promo redesigné */
.bq-promo-banner {
    background: linear-gradient(135deg, var(--nf-primary) 0%, var(--nf-primary-hover) 100%) !important;
    color: white !important;
    text-align: center !important;
    padding: 16px 24px !important;
    border-radius: var(--nf-radius) !important;
    margin-bottom: 20px !important;
    box-shadow: 0 4px 12px rgba(0, 182, 122, 0.2) !important;
}

.bq-promo-banner-title {
    font-size: 20px !important;
    font-weight: 700 !important;
    margin-bottom: 4px !important;
}

.bq-promo-banner-subtitle {
    font-size: 13px !important;
    opacity: 0.9 !important;
}

/* Cartes de quantité - 1 colonne */
.custom-card-group {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    /* Pas de min-height - s'adapte au nombre de cartes (2, 4 ou 5) */
}

.custom-card {
    position: relative;
    padding: 18px 20px;
    background: #fff;
    border: 2px solid #ccc;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 53px !important; /* CLS - atomique, chaque carte */
}

@media (max-width: 768px) {
    .custom-card {
        min-height: 47px !important; /* CLS - atomique mobile */
    }
}

.custom-card:hover {
    border-color: var(--nf-primary);
}

.custom-card.active {
    border-color: var(--nf-primary);
    background-color: #e0fae1;
}

.custom-card.active::before {
    content: '';
    position: absolute;
    top: 17px;
    left: 16px;
    width: 20px;
    height: 20px;
    background: var(--nf-primary);
    border-radius: 50%;
    background-image: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 8L6 11L13 4' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}

/* Badge de réduction */
.custom-badge {
    position: absolute;
    top: -4px;
    right: -7px;
    width: 11%;
    background: var(--nf-primary);
    color: #fff;
    text-align: center;
    font-size: 12px;
    padding: 4px 0;
    transform: rotate(12deg) translate(20%, -25%);
    transform-origin: top right;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 10;
    border-radius: 8px;
}

/* Titre et prix dans la carte - tout sur une ligne */
.custom-title-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin: 0;
}

.custom-card.active .custom-title-line {
    padding-left: 26px;
}

.custom-title-line p {
    font-size: 16px;
    font-weight: 700;
    color: var(--nf-text-dark);
    margin: 0;
    line-height: 1;
    flex: 1;
}

.custom-price {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    line-height: 1;
    min-height: 20px !important; /* CLS - atomique, évite shift des prix */
}

.price-reference {
    font-size: 13px;
    color: var(--nf-error);
    text-decoration: line-through;
    order: -1;
}

.price-amount {
    font-size: 18px;
    font-weight: 700;
    color: var(--nf-primary);
}

.price-unit {
    font-size: 13px;
    font-weight: 400;
    color: var(--nf-primary);
}

/* Placeholder pour les prix en chargement - évite CLS */
.price-placeholder {
    display: inline-block;
    width: 70px; /* Largeur approximative du prix final pour réserver l'espace */
    height: 20px; /* Hauteur du texte */
    color: var(--nf-primary); /* Couleur verte Nutriforce */
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    line-height: 20px;
    vertical-align: middle;
    /* Contenu "-" affiché via le HTML, pas de background */
}

@media (max-width: 768px) {
    .price-placeholder {
        width: 65px; /* Légèrement plus petit sur mobile */
    }
}

/* ========================================
   RESPONSIVE
   ======================================== */

/* Responsive */
@media (max-width: 1024px) {
    .custom-card {
        padding: 16px 18px;
    }
}

@media (max-width: 768px) {
    /* CLS - Ajustements min-height mobile */
    .woocommerce div.product .product_title {
        font-size: 26px;
        min-height: 35px !important;
    }

    .woocommerce div.product p.price {
        font-size: 24px;
    }

    .woocommerce div.product .woocommerce-product-rating {
        min-height: 20px !important;
    }

    .woocommerce div.product .woocommerce-product-details__short-description {
        min-height: 60px !important; /* Plus haute sur mobile à cause du wrap */
    }

    .custom-card {
        padding: 16px;
    }

    .custom-card.active::before {
        top: 17px;
        left: 16px;
    }

    .custom-card.active .custom-title-line {
        padding-left: 26px;
    }

    .custom-title-line p {
        font-size: 16px;
    }

    .price-amount {
        font-size: 18px;
    }

    .price-reference,
    .price-unit {
        font-size: 13px;
    }
}

/* ========================================
   CATÉGORIES SEO (bas de page)
   ======================================== */

.product-categories-seo {
    display: block;
    text-align: center;
    margin-top: 2rem;
}

/* ========================================
   STICKY ADD TO CART CTA
   ======================================== */

.nf-sticky-cta {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 9999;
    transform: translateY(120%);
    transition: transform 0.3s ease-in-out;
}

.nf-sticky-cta.visible {
    transform: translateY(0);
}

.nf-sticky-cta-inner {
    background: #1a472a;
    color: #fff;
    border-radius: 14px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    box-shadow: 0 10px 26px rgba(26,71,42,0.28);
}

.nf-sticky-cta-title {
    font-weight: 800;
    font-size: 15px;
}

.nf-sticky-cta-tagline {
    font-size: 12px;
    opacity: 0.9;
    line-height: 1.1;
}

.nf-sticky-cta-tagline .desktop {
    display: none;
}

@media (min-width: 769px) {
    .nf-sticky-cta-tagline .mobile {
        display: none;
    }
    .nf-sticky-cta-tagline .desktop {
        display: inline;
    }
}

.nf-sticky-cta-btn {
    flex-shrink: 0;
    color: #1a472a;
    background: #fff;
    font-weight: 800;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.nf-shimmer {
    position: absolute;
    top: 0;
    left: -30%;
    width: 30%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(180,180,180,0.2), rgba(210,210,210,0.35), rgba(180,180,180,0.2), transparent);
    transform: skewX(-20deg);
    animation: nf-shimmer 3.5s infinite;
}

@keyframes nf-shimmer {
    0% { left: -30%; opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { left: 100%; opacity: 0; }
}

/* Masquer le chatbot quand le sticky CTA est visible */
.hide-nf-chat #nf-chat-bubble {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transform: scale(0.8) !important;
}
