/* ==========================================================================
   SYNEXTA PRODUCT DISPLAY - STORY LAYOUT STYLE
   Version: 3.9.0 (Fix Table Width 100%)
   ========================================================================== */

/* =========================================
   1. VARIABLES & RESET
   ========================================= */
:root {
    /* Espacements Structurels */
    --s-gap: 80px;            /* Espace entre sidebar et contenu */
    --s-card-pad: 25px;       /* Padding interne des cartes */
    
    /* Couleurs (Fallbacks si non définis par le thème) */
    --c-bg-card: #f9f9f9;     
    --c-border-light: #e5e5e5;
    
    /* Typographie */
    --f-stack: inherit;       /* Hérite de la fonte du thème */
}

/* Container Principal */
.syn-story-wrapper {
    max-width: 100%;
    margin: 60px 0;
    padding: 0;
    display: grid;
    /* Grid asymétrique : Sidebar Fixe (240px) | Contenu Fluide */
    grid-template-columns: 240px 1fr; 
    gap: var(--s-gap);
    position: relative;
    font-family: var(--f-stack);
    color: var(--syn-textcolor, #1d1d1f);
    line-height: 1.6;
}

.syn-story-wrapper * { 
    box-sizing: border-box; 
}


/* =========================================
   2. SIDEBAR NAVIGATION (Desktop > 981px)
   ========================================= */
.syn-story-nav {
    position: sticky;
    top: 140px; /* S'adapte sous la plupart des headers sticky */
    height: fit-content;
    display: block;
    align-self: start;
    z-index: 10;
}

.syn-nav-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--syn-secondarycolor, #86868b);
    margin-bottom: 1.5rem;
    font-weight: 700;
    opacity: 0.9;
}

.syn-nav-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border-left: 1px solid var(--c-border-light);
    position: relative;
}

/* Indicateur Animé (Barre latérale) */
.syn-nav-indicator {
    position: absolute;
    left: -1px; /* Chevauche la bordure grise */
    top: 0;
    width: 2px;
    height: 0;
    background-color: var(--syn-maincolor, #000);
    transition: top 0.3s cubic-bezier(0.25, 1, 0.5, 1), height 0.3s ease;
}

.syn-nav-link {
    display: block;
    padding: 10px 0 10px 24px;
    font-size: 0.95rem;
    color: #333;
    letter-spacing: -0.4px;
    transition: color 0.2s ease, font-weight 0.2s ease;
    cursor: pointer;
    line-height: 1.4;
    text-decoration: none !important;
    border: none !important;
    outline: none !important;
}

.syn-nav-link:hover { 
    color: var(--syn-maincolor, #000); 
}

.syn-nav-link.active { 
    color: var(--syn-maincolor, #000); 
}


/* =========================================
   3. CONTENU PRINCIPAL & SECTIONS
   ========================================= */
.syn-story-content {
    min-width: 0; /* Empêche le grid blowout sur petits écrans */
}

.syn-story-section {
    margin-bottom: 100px;
    scroll-margin-top: 160px; /* Espace pour l'ancre lors du scroll */
    position: relative;
}

/* --- STYLE TITRES "HACHURÉS" (HATCHED) --- */
.syn-section-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;       /* Espace entre les traits et le texte */
    border-bottom: none !important; 
    padding-bottom: 0 !important;
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
}

.syn-section-title {
    /* Flexbox settings pour Ellipsis */
    flex: 0 1 auto; /* Peut rétrécir si besoin */
    max-width: 100%;
    
    font-size: 1.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--syn-textcolor, #333);
    margin: 0;
    line-height: 1.2;
    
    /* Ellipsis Logic (...) */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* On masque l'index numérique */
.syn-section-index { display: none; }

/* Création des traits (Hachures) Gauche et Droite */
.syn-section-header::before,
.syn-section-header::after {
    content: "";
    flex: 1;        /* Prend tout l'espace disponible */
    min-width: 20px; /* Garde toujours un petit trait visible */
    height: 12px;   /* Hauteur de la bande */
    background-image: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 4px,      
        var(--syn-maincolor, #000) 4px,  
        var(--syn-maincolor, #000) 5px   
    );
    opacity: 0.8; 
}


/* --- CORPS DE TEXTE --- */
.syn-section-body {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--syn-textcolor, #444);
}

/* Suppression du doublon de titre natif Woo Reviews */
.syn-reviews-content .woocommerce-Reviews-title {
    display: none !important;
}

/* Typographie Interne */
.syn-section-body p { margin-bottom: 1.5em; }
.syn-section-body ul { margin-bottom: 1.5em; padding-left: 20px; }
.syn-section-body h2, .syn-section-body h3 {
    margin-top: 2.5em; 
    margin-bottom: 1em; 
    font-weight: 700;
    color: var(--syn-maincolor, #000);
    line-height: 1.3;
}
.syn-section-body h2 { font-size: 1.5rem; }
.syn-section-body h3 { font-size: 1.3rem; }


/* =========================================
   4. MODULE : GRID CARDS (Infos Complémentaires)
   ========================================= */
.syn-specs-grid {
    display: grid;
    /* Système à 4 colonnes de base */
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.syn-spec-card {
    background-color: var(--c-bg-card);
    border: 1px solid transparent;
    padding: var(--s-card-pad);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.3s ease;
    height: 100%; /* Uniformise la hauteur */
}

/* Logique de largeur (Géré par PHP) */
.syn-card-std { grid-column: span 1; }  /* 25% */
.syn-card-wide { grid-column: span 2; } /* 50% */

/*.syn-spec-card:hover {
    background-color: #fff;
    border-color: var(--syn-secondarycolor, #ccc);
    box-shadow: 0 6px 15px rgba(0,0,0,0.06);
    transform: translateY(-3px);
}*/

.syn-spec-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--syn-secondarycolor, #86868b);
    margin-bottom: 12px;
    font-weight: 700;
}

.syn-spec-value {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--syn-maincolor, #1d1d1f);
    word-break: break-word;
    line-height: 1.4;
}


/* =========================================
   5. MODULE : TAGS (Cartouches Arrondies)
   ========================================= */
.syn-tags-container {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid var(--c-border-light);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.syn-tag-pill {
    display: inline-flex;
    align-items: center;
    padding: 8px 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--syn-secondarycolor, #666);
    background-color: #fff;
    border: 1px solid var(--c-border-light);
    border-radius: 50px; /* Pill Shape */
    text-decoration: none !important;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.syn-tag-pill:hover {
    background-color: var(--syn-maincolor, #000);
    color: #fff !important;
    border-color: var(--syn-maincolor, #000);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}


/* =========================================
   6. MODULE : MARQUE (Brand)
   ========================================= */
.syn-brand-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    background: var(--c-bg-card);
    padding: 40px;
    border-radius: 8px;
    align-items: center;
    text-align: center;
    border: 1px solid transparent;
    transition: border-color 0.3s;
}

.syn-brand-container:hover {
    border-color: var(--c-border-light);
}

@media (min-width: 769px) {
    .syn-brand-container {
        flex-direction: row;
        align-items: flex-start;
        text-align: left;
    }
}

.syn-brand-logo {
    flex: 0 0 120px;
    display: flex; 
    justify-content: center;
    align-items: center;
}

.syn-brand-logo img { 
    max-width: 100%; 
    height: auto; 
}

.syn-brand-content { flex: 1; }

.syn-brand-name { 
    margin-top: 0; 
    font-size: 1.4rem; 
    margin-bottom: 15px; 
    color: var(--syn-maincolor, #000); 
    font-weight: 700;
}

.syn-brand-desc { 
    font-size: 0.95rem; 
    opacity: 0.9; 
    color: var(--syn-textcolor);
}
.syn-brand-desc p:last-child { margin-bottom: 0; }


/* =========================================
   7. RESPONSIVE DESIGN
   ========================================= */

/* Tablette & Petit Desktop (< 981px) */
@media (max-width: 981px) {
    .syn-story-wrapper {
        grid-template-columns: 1fr; /* Passage en 1 seule colonne */
        gap: 50px;
        margin-top: 30px;
    }

    /* Sidebar masquée sur mobile/tablette */
    .syn-story-nav { display: none; }

    .syn-section-title { font-size: 1.5rem; }

    /* Grille passe à 2 colonnes */
    .syn-specs-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Les cartes larges prennent 100% de la largeur dispo */
    .syn-card-wide {
        grid-column: span 2;
    }
}

/* Mobile (< 500px) - FIX ALIGNEMENT TITRES & ELLIPSIS */
@media (max-width: 500px) {
    /* Gestion des titres hachurés sur mobile */
    .syn-section-header { 
        justify-content: flex-start; /* Aligne le tout à gauche */
        gap: 12px; 
    }
    
    .syn-section-header::before {
        display: none; /* Supprime le trait de gauche */
    }

    .syn-section-title { 
        text-align: left;
        font-size: 1.3rem; 
        letter-spacing: 0; 
        max-width: 85%; /* Laisse de la place pour le trait de droite */
    }
    
    /* Grilles et Cartes */
    .syn-specs-grid {
        grid-template-columns: 1fr; /* 1 colonne partout */
        gap: 15px;
    }
    
    .syn-card-std, .syn-card-wide {
        grid-column: span 1;
    }

    /* Marque */
    .syn-brand-container { padding: 25px; }
    .syn-brand-logo { flex: 0 0 80px; }
}

/* =========================================
   8. MODULE : TABLEAUX & CONTENUS META
   ========================================= */
.syn-meta-content-wrapper {
    width: 100%;
    overflow-x: auto; /* Scroll horizontal si tableau trop large */
    background: #fff;
    border-radius: 8px;
    margin-bottom: 20px;
    display: block; /* S'assure qu'il prend toute la largeur dispo */
}

/* Style Tableau Moderne (Clean Style) */
/* CIBLAGE : On vise spécifiquement les tables DANS le contenu "Story" pour éviter les conflits */
.syn-story-content .syn-meta-content-wrapper table,
.syn-nutrition-tab table {
    width: 100% !important; /* FORCE LA LARGEUR À 100% */
    min-width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    margin-bottom: 1em;
    font-size: 0.95rem;
    border: 1px solid #eee;
    
    /* GESTION DES COLONNES */
    table-layout: auto; /* Laisse le navigateur gérer la largeur des colonnes selon le contenu */
    height: auto;
}

.syn-nutrition-tab th,
.syn-nutrition-tab td,
.syn-story-content .syn-meta-content-wrapper th,
.syn-story-content .syn-meta-content-wrapper td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    text-align: left;
    vertical-align: middle;
    width: auto; /* Reset d'éventuels width inline sur les cellules */
}

/* Entêtes */
.syn-nutrition-tab th,
.syn-story-content .syn-meta-content-wrapper th {
    background-color: #f8f9fa;
    font-weight: 700;
    color: var(--syn-maincolor, #000);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

/* Zebra Striping */
.syn-nutrition-tab tr:nth-child(even),
.syn-story-content .syn-meta-content-wrapper tr:nth-child(even) {
    background-color: #fcfcfc;
}

/* Hover Effect */
.syn-nutrition-tab tr:hover td,
.syn-story-content .syn-meta-content-wrapper tr:hover td {
    background-color: #f1f1f1;
}

/* Suppression des bordures sur la dernière ligne */
.syn-nutrition-tab tr:last-child td,
.syn-story-content .syn-meta-content-wrapper tr:last-child td {
    border-bottom: none;
}


/* =========================================
   9. BOUTON CTA "ACHETER" (Sidebar)
   ========================================= */

/* Alignement et espacement de l'entrée */
.syn-nav-link.buy-cta {
    display: flex;
    align-items: center;
    gap: 12px; /* Espace entre l'icône et le texte */
    margin-top: 15px; /* Petit espacement pour le détacher du bloc précédent */
    font-weight: 700; /* Mise en valeur légère */
}

/* Création de l'icône Panier via pseudo-élément */
.syn-nav-link.buy-cta::before {
    content: "";
    display: block;
    width: 18px;
    height: 18px;
    background-color: currentColor; /* L'icône prend la couleur du texte (gris ou noir au hover) */
    
    /* Définition du masque SVG (Panier) */
    -webkit-mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='21' r='1'/%3E%3Ccircle cx='20' cy='21' r='1'/%3E%3Cpath d='M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='21' r='1'/%3E%3Ccircle cx='20' cy='21' r='1'/%3E%3Cpath d='M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6'/%3E%3C/svg%3E");
    
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}