/* ==========================================================================
   CHARTE GRAPHIQUE - CALCULATEURS PRATIQUES 2026 (CORRIGÉE & COMPACTE)
   ========================================================================== */

/* IMPORT DES POLICES */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,600;0,700;1,600&display=swap');

:root {
    /* Couleurs Principales */
    --royal-blue: #010255;
    --royal-hover: #0A0C6B;
    
    /* Couleur d'Accentuation */
    --orange-dark: #C25934;
    --orange-hover: #A84928;
    --orange-glow: rgba(194, 89, 52, 0.15);
    
    /* Fonds de page */
    --bg-page: #F3F5F7; 
    --bg-paper: #FFFFFF; 
    
    /* Textes et Bordures */
    --text-dark: #1E293B; 
    --text-reading: #475569;
    --border-soft: #E2E8F0;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-page);
    color: var(--text-dark);
    line-height: 1.6; /* Réduit légèrement pour compacter */
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .pull-quote { font-family: 'Playfair Display', serif; }

/* ==========================================================================
   1. HEADER & HERO BANNER
   ========================================================================== */
.hero-banner {
    background-color: var(--royal-blue);
    background-image: radial-gradient(rgba(255,255,255,0.04) 1px, transparent 1px);
    background-size: 24px 24px;
    padding: 0 0 2rem 0; 
}

.top-nav-bar {
    max-width: 1250px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.top-nav-bar .logo { color: white; font-weight: 700; font-size: 1.1rem; text-decoration: none; font-family: 'Inter', sans-serif; }
.nav-links { display: flex; gap: 1.5rem; list-style: none; }
.nav-links a { color: #CBD5E1; text-decoration: none; font-size: 0.9rem; font-weight: 500; transition: color 0.2s; }
.nav-links a:hover { color: white; }

.hero-content {
    text-align: center;
    padding: 1.5rem 2rem 0.5rem 2rem;
}

.breadcrumb { font-size: 0.85rem; color: #94A3B8; margin-bottom: 1rem; text-transform: uppercase; letter-spacing: 1px; }
.breadcrumb a { color: var(--orange-dark); text-decoration: none; }

.hero-content h1 {
    color: #FFFFFF;
    font-size: 2.5rem; /* Légèrement réduit pour éviter l'encombrement */
    max-width: 900px;
    margin: 0 auto;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.hero-content p {
    color: #E2E8F0;
    font-size: 1.05rem;
    max-width: 1000px;
    margin: 0.75rem auto 0;
    font-weight: 300;
}

/* ==========================================================================
   2. MISE EN PAGE PRINCIPALE (GRID)
   ========================================================================== */
.main-layout {
    max-width: 1300px; 
    margin: -1.5rem auto 4rem auto; 
    padding: 0 2rem;
    display: grid;
    grid-template-columns: 400px minmax(0, 1fr); /* minmax(0, 1fr) est CRUCIAL pour empêcher le débordement des graphiques */
    gap: 3rem;
    align-items: start; 
}

/* ==========================================================================
   3. COLONNE GAUCHE (CALCULATEUR STICKY)
   ========================================================================== */
.sticky-sidebar {
    position: sticky;
    top: 1rem; 
    z-index: 10;
    display: block; 
    max-height: calc(100vh - 2rem); 
    overflow-y: auto; 
    padding-right: 0.25rem; 
    padding-bottom: 1rem;
    overscroll-behavior: contain; 
}

.sticky-sidebar::-webkit-scrollbar { width: 6px; }
.sticky-sidebar::-webkit-scrollbar-track { background: transparent; }
.sticky-sidebar::-webkit-scrollbar-thumb { background: var(--border-soft); border-radius: 10px; }
.sticky-sidebar::-webkit-scrollbar-thumb:hover { background: #CBD5E1; }

.calculator-widget {
    background: var(--bg-paper);
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(1, 2, 85, 0.08);
    border: 1px solid var(--border-soft);
    overflow: hidden;
    margin-bottom: 1.5rem; 
}

.widget-header { 
    background: var(--bg-paper); 
    padding: 1.25rem 2rem; 
    border-bottom: 1px solid var(--border-soft);
    text-align: center;
}

.widget-header h3 { 
    font-family: 'Inter', sans-serif; 
    font-size: 1.1rem; 
    font-weight: 700; 
    color: var(--royal-blue); 
    letter-spacing: 1px; 
    text-transform: uppercase;
    margin: 0;
}

.widget-body { padding: 1.5rem; }

.input-group { margin-bottom: 1.25rem; }
.input-group label { 
    display: block; 
    font-size: 0.8rem; 
    font-weight: 700; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    color: var(--text-reading); 
    margin-bottom: 0.4rem; 
}

.input-group input, .input-group select {
    width: 100%; 
    padding: 0.85rem; 
    background: var(--bg-page); 
    border: 2px solid transparent; 
    border-radius: 8px;
    font-size: 1.05rem; 
    font-family: 'Inter', sans-serif; 
    color: var(--royal-blue); 
    font-weight: 600;
    transition: all 0.3s;
}

.input-group input:focus, .input-group select:focus { 
    outline: none; 
    background: var(--bg-paper);
    border-color: var(--orange-dark); 
    box-shadow: 0 0 0 4px var(--orange-glow); 
}

.input-hint { font-size: 0.75rem; color: #94A3B8; margin-top: 0.3rem; display: block; }

.checkbox-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-top: 1rem; }
.check-item { display: flex; align-items: center; padding: 0.75rem; background: var(--bg-page); border: 1px solid var(--border-soft); border-radius: 8px; cursor: pointer; font-size: 0.85rem; font-weight: 500; transition: all 0.2s; }
.check-item:hover { border-color: var(--orange-dark); }
.check-item input { margin-right: 0.5rem; width: 16px; height: 16px; accent-color: var(--orange-dark); }

.btn-calc {
    width: 100%; padding: 1rem; background: var(--orange-dark); color: white;
    border: none; border-radius: 8px; font-size: 1rem; font-weight: 700; 
    text-transform: uppercase; letter-spacing: 1.5px; cursor: pointer; 
    transition: all 0.3s; margin-top: 1rem; box-shadow: 0 8px 20px var(--orange-glow);
}
.btn-calc:hover { background: var(--orange-hover); transform: translateY(-2px); box-shadow: 0 12px 25px rgba(194, 89, 52, 0.25); }

/* Espace Pub Sticky */
.ad-space-premium {
    background: var(--bg-paper); padding: 1rem; border: 1px solid var(--border-soft);
    border-radius: 12px; text-align: center;
}
.ad-label { display: block; font-size: 0.7rem; color: #94A3B8; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 0.5rem; }
.ad-placeholder { background: var(--bg-page); border: 1px dashed #CBD5E1; height: 250px; display: flex; align-items: center; justify-content: center; color: #94A3B8; font-size: 0.9rem; border-radius: 8px;}

/* ==========================================================================
   4. COLONNE DROITE (ARTICLE & RÉSULTATS)
   ========================================================================== */
.reading-area-wrapper {
    min-width: 0; /* INDISPENSABLE pour Flexbox et Chart.js */
    width: 100%;
}

.reading-area {
    background: var(--bg-paper); border-radius: 16px; 
    box-shadow: 0 10px 30px rgba(1, 2, 85, 0.04);
    border: 1px solid var(--border-soft); 
    overflow: hidden; /* Cache le débordement horizontal */
}

/* Onglets Corrigés : Flex-Wrap pour éviter l'ascenseur horizontal */
.article-tabs {
    display: flex; 
    flex-wrap: wrap; /* Permet le passage à la ligne */
    justify-content: center; /* Centre les boutons */
    background: var(--bg-page); 
    padding: 0.5rem 0.5rem 0 0.5rem; 
    border-bottom: 1px solid var(--border-soft);
    gap: 0.5rem;
}

.tab-btn {
    flex: 1 1 auto; /* Prend la place dispo mais peut rétrécir */
    min-width: 120px; /* Largeur mini pour rester beau */
    padding: 1rem; 
    background: transparent; border: none;
    font-family: 'Inter', sans-serif; font-weight: 600; font-size: 0.85rem;
    color: #64748B; text-transform: uppercase; letter-spacing: 0.5px;
    cursor: pointer; position: relative; transition: all 0.3s; 
    white-space: normal; /* Autorise le texte sur 2 lignes */
    text-align: center;
}
.tab-btn:hover { color: var(--royal-blue); }
.tab-btn.active { color: var(--orange-dark); background: var(--bg-paper); border-radius: 12px 12px 0 0; }
.tab-btn.active::after { content: ''; position: absolute; bottom: -1px; left: 0; width: 100%; height: 3px; background: var(--orange-dark); }

.tab-btn-result { color: var(--royal-blue); display: none; width: 100%; font-weight: 700;} 
.tab-btn-result.show { display: block; animation: fadeIn 0.5s; background: #e0e7ff; border-radius: 8px 8px 0 0; }

/* Contenu Compacté (Réduction du vide) */
.article-content { padding: 2rem; } /* Réduit de 3.5rem à 2rem */

.content-pane { display: none; animation: fadeIn 0.3s ease; }
.content-pane.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.content-pane h2 { font-size: 1.8rem; margin-bottom: 1rem; color: var(--royal-blue); line-height: 1.3;}
.content-pane h3 { font-size: 1.3rem; margin-top: 1.5rem; margin-bottom: 0.8rem; color: var(--text-dark); font-family: 'Inter', sans-serif; font-weight: 600;}
.content-pane p { font-size: 1rem; margin-bottom: 1.2rem; color: var(--text-reading); font-weight: 400; text-align: justify;}
.content-pane ul { margin-left: 1.5rem; margin-bottom: 1.5rem; color: var(--text-reading); font-size: 1rem; }
.content-pane li { margin-bottom: 0.4rem; }

/* Styles spécifiques Résultats (Gros chiffres sécurisés) */
.big-number, #is-total, #resultat-principal, #net-percu {
    font-family: 'Playfair Display', serif;
    /* Clamp : Taille mini 2.2rem, idéale 5vw, max 4rem -> S'adapte partout */
    font-size: clamp(2.2rem, 5vw, 4rem); 
    color: var(--royal-blue);
    line-height: 1.1;
    font-weight: 700;
    margin: 0.5rem 0;
    word-break: break-word; /* Coupe si ça dépasse vraiment */
}

/* Tableaux Premium Compacts */
.lux-table-wrapper { overflow-x: auto; margin: 1.5rem 0; border: 1px solid var(--border-soft); border-radius: 12px; }
.lux-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.9rem; }
.lux-table th { background: var(--bg-page); padding: 0.8rem 1rem; color: var(--royal-blue); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid var(--border-soft); }
.lux-table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border-soft); color: var(--text-reading); }
.lux-table tr:last-child td { border-bottom: none; }

/* Éléments de Guide */
.pull-quote {
    font-family: 'Playfair Display', serif; font-size: 1.2rem; color: var(--royal-blue);
    font-style: italic; border-left: 4px solid var(--orange-dark); padding: 1.2rem 1.5rem;
    margin: 2rem 0; line-height: 1.5; background: #F8EFEA; border-radius: 0 8px 8px 0;
}

.def-card { border-left: 3px solid var(--orange-dark); padding: 1.2rem 1.5rem; background: #F8EFEA; margin-bottom: 1.5rem; border-radius: 0 8px 8px 0; }
.def-card h3 { font-size: 1rem; color: var(--royal-blue); margin-bottom: 0.4rem; text-transform: uppercase; letter-spacing: 1px; }
.def-card p { margin-bottom: 0; font-size: 0.95rem; }

.example-box { border: 1px solid var(--border-soft); padding: 2rem; margin-bottom: 2rem; border-radius: 12px; position: relative; }
.example-box::before { content: 'CAS PRATIQUE'; position: absolute; top: -10px; left: 1.5rem; background: var(--bg-paper); padding: 0 10px; color: var(--orange-dark); font-size: 0.75rem; font-weight: 700; letter-spacing: 2px; }

/* Maillage interne */
.internal-links {
    padding: 1.5rem 2rem; background: var(--bg-paper); border-top: 1px dashed var(--border-soft);
}
.internal-links h3 { font-size: 1.1rem; margin-bottom: 1rem; font-family: 'Inter', sans-serif; text-transform: uppercase; color: var(--royal-blue); letter-spacing: 1px;}
.links-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.link-card {
    display: block; padding: 1.25rem; border: 1px solid var(--border-soft); border-left: 4px solid var(--royal-blue);
    border-radius: 8px; text-decoration: none; transition: all 0.2s;
}
.link-card:hover { border-color: var(--royal-blue); background: var(--bg-page); transform: translateY(-2px); }
.link-card strong { color: var(--royal-blue); font-size: 1rem; display: block; margin-bottom: 0.4rem; }
.link-card p { color: var(--text-reading); font-size: 0.85rem; margin: 0; }

/* ==========================================================================
   5. FOOTER
   ========================================================================== */
.site-footer {
    background-color: var(--royal-blue); color: #E2E8F0;
    padding: 2rem 2rem 1rem 2rem; margin-top: 2rem; border-top: 4px solid var(--orange-dark);
}
.footer-container {
    max-width: 1250px; margin: 0 auto; display: grid; grid-template-columns: 2fr 1fr;
    gap: 2rem; margin-bottom: 1rem; 
}
.footer-brand h4 { color: #FFFFFF; font-family: 'Inter', sans-serif; font-size: 1.1rem; margin-bottom: 0.5rem; }
.footer-brand p { color: #94A3B8; font-size: 0.9rem; max-width: 400px; margin: 0; }
.footer-links h4 { color: #FFFFFF; font-family: 'Inter', sans-serif; font-size: 0.95rem; margin-bottom: 0.8rem; text-transform: uppercase; letter-spacing: 1px; }
.footer-links ul { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: 0.4rem; }
.footer-links a { color: #CBD5E1; text-decoration: none; font-size: 0.85rem; transition: color 0.2s; }
.footer-links a:hover { color: var(--orange-dark); }
.footer-bottom {
    max-width: 1250px; margin: 0 auto; padding-top: 1rem; 
    border-top: 1px solid rgba(255,255,255,0.1); text-align: center; font-size: 0.8rem; color: #64748B;
}

/* ==========================================================================
   6. RESPONSIVE DESIGN (MOBILE & TABLETTE)
   ========================================================================== */
@media (max-width: 1100px) {
    .main-layout { grid-template-columns: 1fr; margin-top: -1rem; gap: 2rem; }
    .hero-banner { padding: 0 0 1.5rem 0; }
    .hero-content h1 { font-size: 2rem; }
    .article-content { padding: 1.5rem; } /* Encore plus compact sur mobile */
    .internal-links { padding: 1.5rem; }
    
    .sticky-sidebar { position: static; max-height: none; overflow-y: visible; } 
    
    /* On garde le flex-wrap sur mobile aussi pour éviter l'ascenseur */
    .article-tabs { justify-content: space-between; } 
    .tab-btn { flex: 1 1 45%; padding: 0.8rem; font-size: 0.8rem; }
    
    .footer-container { grid-template-columns: 1fr; text-align: center; gap: 1.5rem; }
    .footer-brand p { margin: 0 auto; }
}

@media (max-width: 480px) {
    .main-layout { padding: 0 1rem; }
    .widget-header, .widget-body { padding: 1.25rem; }
    .reading-area { border-radius: 12px; }
    .big-number { font-size: 2.5rem; } /* Force la taille safe sur très petit écran */
}

/* === Sources accordion (compact, non-intrusive) === */
.sources-accordion { margin-top: 1rem; }
.sources-accordion > summary {
  cursor: pointer; list-style: none; font-weight: 700; color: var(--text-dark);
  display: flex; align-items: center; gap: .6rem; font-size: 0.9rem;
}
.sources-accordion > summary::-webkit-details-marker { display: none; }
.sources-accordion > summary::before {
  content: "+"; width: 1.2rem; height: 1.2rem; display: inline-flex;
  align-items: center; justify-content: center; border: 1px solid rgba(0,0,0,0.2);
  border-radius: 4px; color: inherit; font-weight: 400;
}
.sources-accordion[open] > summary::before { content: "–"; }
.sources-accordion ul { margin-top: .5rem; padding-left: 1.8rem; color: var(--text-reading); font-size: 0.85rem;}
.sources-accordion li { margin: .2rem 0; }

/* --- CORRECTION HEADER MOBILE --- */
@media (max-width: 768px) {
    .top-nav-bar {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 1rem 0.5rem;
        gap: 1rem;
    }
    
    .top-nav-bar .logo {
        font-size: 1.5rem;
        white-space: nowrap;
        text-align: center;
    }
    
    .top-nav-bar .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.8rem 1rem;
        padding: 0;
    }
    
    .top-nav-bar .nav-links li a {
        font-size: 0.95rem;
    }
}


