/**
 * UX/UI Design — Page Produit Les Rituels de Léa
 * Cartes horizontales, stepper, reassurance, badges
 * v3.0.0
 */

/* ========================================
   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 (22px desktop / 20px mobile)
 * - .woocommerce-product-details__short-description (60px)
 * - .custom-card - carte de quantité horizontale
 * - .bq-variations select / .bq-variation-select (50px) - chaque select
 * - .single_add_to_cart_button (58px desktop / 56px mobile)
 * - .price-placeholder (60px × 20px)
 *
 * ❌ 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;
}

.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;
}

.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É — HORIZONTALES
   ======================================== */

/* Force overflow visible pour les badges */
.woocommerce div.product div.summary {
    overflow: visible !important;
}

.custom-section {
    margin: 24px 0;
    overflow: visible;
}

/* 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(139, 94, 60, 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é - HORIZONTAL */
.custom-card-group {
    display: flex !important;
    gap: 8px !important;
    overflow: visible !important;
}

.custom-card {
    flex: 1;
    position: relative;
    padding: 16px 10px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    overflow: visible;
}

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

.custom-card.active {
    border-color: var(--nf-primary);
    background: var(--rl-bg-warm, #f6efe8);
}

/* Badge au-dessus de la carte */
.custom-badge {
    position: absolute;
    top: -7px;
    left: 50%;
    transform: translateX(-50%);
    background: #C4724F;
    color: #fff;
    font-size: 8px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    z-index: 2;
    line-height: 1;
    /* Un ancien style inline (ruban) impose width: 15.4% et right: 0 : le texte débordait du badge */
    width: auto;
    right: auto;
}

/* Dernier badge en couleur primaire */
.custom-card:last-child .custom-badge {
    background: var(--rl-brown, #8B5E3C);
}

/* Contenu empilé verticalement */
.custom-title-line {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin: 0;
}

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

.custom-title-line p {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
    line-height: 1.2;
}

.custom-price {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    line-height: 1;
}

.price-reference {
    font-size: 12px;
    color: #bbb;
    text-decoration: line-through;
    order: 1;
}

.price-amount {
    font-size: 18px;
    font-weight: 700;
    color: var(--rl-brown, #8B5E3C);
}

.price-unit {
    display: none;
}

/* Prix par pot : sans l'unité, « Cure 4 mois 30,99 € » se lisait comme un total */
.price-amount-wrap {
    display: inline-flex;
    align-items: baseline;
    gap: 3px;
    white-space: nowrap;
    line-height: 1;
}

.price-unit-suffix {
    font-size: 12px;
    font-weight: 600;
    color: #7a6a5e;
    line-height: 1;
    white-space: nowrap;
}

/* Placeholder pour les prix en chargement */
.price-placeholder {
    display: inline-block;
    width: 60px;
    height: 20px;
    color: var(--rl-brown, #8B5E3C);
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    line-height: 20px;
}

/* Stepper +/- dans la carte */
.custom-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 4px;
}

.custom-stepper-btn {
    width: 26px;
    height: 26px;
    border: 1px solid #ccc;
    border-radius: 50%;
    background: #fff;
    font-size: 16px;
    font-weight: 700;
    color: #555;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1 !important;
    transition: all 0.15s;
    font-family: system-ui, sans-serif;
    box-sizing: border-box;
}

.custom-stepper-btn:hover,
.custom-stepper-btn:active {
    background: var(--rl-brown, #8B5E3C);
    border-color: var(--rl-brown, #8B5E3C);
    color: #fff;
}

.custom-stepper-value {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a1a;
    min-width: 20px;
    text-align: center;
}

/* Reassurance icons sous le bouton */
.nf-reassurance {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 8px 0;
    margin: 0 0 8px;
    max-width: 600px;
    width: 100%;
    flex-basis: 100%;
}

.nf-reassurance-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: #1a1a1a;
    font-weight: 500;
}

.nf-reassurance-icon {
    line-height: 0;
    flex-shrink: 0;
}

.nf-reassurance-icon svg {
    width: 16px;
    height: 16px;
    display: block;
}

/* Lien analyse labo */
.nf-lab-link {
    text-align: center;
    margin: 4px 0 8px;
    max-width: 600px;
    width: 100%;
    flex-basis: 100%;
}

.nf-lab-link-trigger {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #666;
    text-decoration: underline;
    cursor: pointer;
    font-weight: 500;
}

.nf-lab-link-trigger svg {
    flex-shrink: 0;
}

.nf-lab-link-trigger:hover {
    color: #1a1a1a;
}

/* Popup analyse labo fullscreen */
.nf-lab-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    background: #fff;
    flex-direction: column;
}

.nf-lab-popup.open {
    display: flex;
}

.nf-lab-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.nf-lab-popup-title {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
}

.nf-lab-popup-close {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    color: #666;
    padding: 8px 14px;
}

.nf-lab-popup-close:hover {
    color: #1a1a1a;
    border-color: #999;
}

.nf-lab-popup-body {
    flex: 1;
    overflow: hidden;
}

.nf-lab-popup-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

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

@media (max-width: 768px) {
    .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;
    }

    .custom-card {
        padding: 12px 6px;
    }

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

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

    .nf-reassurance {
        gap: 10px;
    }

    .nf-reassurance-item {
        font-size: 10px;
    }
}

/* ========================================
   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: var(--rl-brown, #8B5E3C);
    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(139, 94, 60, 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: var(--rl-brown, #8B5E3C);
    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 Typebot quand le sticky CTA est visible */
.hide-typebot-bubble typebot-bubble::part(button) {
    display: none !important;
}
