/* --- VARIABLES THEME APPLE GLASS (JOUR/NUIT) --- */
:root {
  /* DARK MODE */
  --bg-color: #000000;
  --text-main: #ffffff;
  --text-muted: #ebebf5aa;
  --glass-bg: rgba(30, 41, 59, 0.85); /* Opacité ajustée pour moins de transparence */
  --glass-border: rgba(255, 255, 255, 0.15);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --tab-active: #787880; /* Gris Système Universel */
  --good: #30D158;
  --bad: #FF453A;
  --mesh-1: #002395; /* Bleu Drapeau Français */
  --mesh-2: #ED2939; /* Rouge Drapeau Français */
--universal-gap: 10px; /* L'espacement de référence */
}

body.light-mode {
  /* LIGHT MODE */
  --bg-color: #f2f2f7;
  --text-main: #000000;
  --text-muted: #3c3c43cc;
  --glass-bg: rgba(255, 255, 255, 0.85); /* Opacité ajustée pour moins de transparence */
  --glass-border: rgba(0, 0, 0, 0.15);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
  --tab-active: #8e8e93; /* Gris Système Universel (Clair) */
  --good: #34C759;
  --bad: #FF3B30;
  --mesh-1: #002395; /* Bleu Drapeau Français */
  --mesh-2: #ED2939; /* Rouge Drapeau Français */
}

*, *::before, *::after { box-sizing: border-box; }

body { 
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; 
    background-color: var(--bg-color); color: var(--text-main); 
    margin: 0; padding: 15px 20px; 
    -webkit-font-smoothing: antialiased; overflow-x: hidden; 
    transition: background-color 0.4s ease, color 0.4s ease;
}

::selection { background-color: var(--tab-active); color: #fff; }

.container { max-width: 1200px; margin: auto; position: relative; z-index: 10; }

#mesh-background {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 0; pointer-events: none;
    background: radial-gradient(circle at 15% 50%, var(--mesh-1), transparent 40%), radial-gradient(circle at 85% 30%, var(--mesh-2), transparent 40%);
    transition: background 0.5s ease;
}

.glass-panel {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(25px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(25px) saturate(180%) !important;
    border: 1px solid var(--glass-border) !important;
    box-shadow: var(--glass-shadow) !important;
    border-radius: 16px;
    box-sizing: border-box;
}

.glass-input {
    background: transparent; color: var(--text-main); border: 1px solid var(--glass-border);
    padding: 10px 14px; border-radius: 8px; font-family: inherit; outline: none; transition: 0.2s; box-sizing: border-box;
}
.glass-input:focus { border-color: var(--tab-active); background: rgba(150, 150, 150, 0.05); }
.glass-input::placeholder { color: var(--text-muted); }

/* --- EN TÊTE ET BLOC SOLIDAIRE --- */
.header-container {
    position: sticky; top: 10px; z-index: 100; 
    padding: 15px 20px 10px 20px; margin-bottom: 5px;

}





.header-branding-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-bottom: 15px; gap: 15px; }
.header-left { display: flex; justify-content: flex-start; }
.header-center { display: flex; justify-content: center; text-align: center; }
.header-right { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }

.main-title { margin: 0; font-size: 1.4em; font-weight: 800; letter-spacing: -0.02em; text-shadow: 0 2px 15px rgba(0, 0, 0, 0.9);}

/* --- BOUTONS DISCRETS --- */
.btn-theme {
    background: transparent; border: none; font-size: 1.3em; cursor: pointer; transition: 0.3s; display: flex; align-items: center; justify-content: center;
}
.btn-theme:hover { transform: scale(1.1); }

.btn-primary {
    background: transparent; color: var(--text-main); border: 1px solid var(--glass-border); font-weight: 500; font-size: 0.9em; border-radius: 8px; padding: 8px 16px; cursor: pointer; transition: 0.2s;
}
.btn-primary:hover { background: var(--tab-active); border-color: var(--tab-active); color: #fff; }

.btn-logout { 
    background: transparent; border: 1px solid transparent; color: var(--text-muted); padding: 6px 12px; border-radius: 8px; font-weight: 600; cursor: pointer; transition: 0.2s; font-size: 0.85em; display: flex; align-items: center; justify-content: center; gap: 5px;
}
.btn-logout:hover { color: var(--bad); }
.btn-icon { display: none; font-size: 1.2em;}
.btn-icon-only { background: transparent; border: 1px solid var(--glass-border); color: var(--text-main); padding: 6px; border-radius: 8px; cursor: pointer; transition: 0.2s;}
.btn-icon-only:hover { background: var(--tab-active); border-color: var(--tab-active); color: #fff; }

/* --- ONGLETS (Surlignage Gris) --- */
.tabs-container { 
    display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; 
    margin-left: -20px; margin-right: -20px; padding-left: 20px; padding-right: 20px;
    -webkit-overflow-scrolling: touch;
}
.tabs-container::-webkit-scrollbar { display: none; }

.tab-btn { 
    height: 32px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    background: transparent; color: var(--text-muted); border: none;
    padding: 0 12px; cursor: pointer; font-size: 0.95em; font-weight: 600; transition: 0.2s; border-radius: 16px; flex-shrink: 0; 
}
.tab-btn:hover { color: var(--text-main); }
.tab-btn.active { background: var(--tab-active); color: #fff; }

.sub-tabs-wrapper { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; align-items: center; padding-bottom: 10px;}
.sub-tabs-wrapper::-webkit-scrollbar { display: none; }
.spacer-v { width: 1px; height: 16px; background-color: var(--glass-border); margin: 0 4px; flex-shrink: 0; }
.sub-tab-btn {
    background: transparent; border: none; color: var(--text-muted); padding: 4px 12px;
    border-radius: 16px; font-size: 0.8em; font-weight: 600; cursor: pointer; transition: 0.2s; white-space: nowrap; flex-shrink: 0;
}
.sub-tab-btn:hover { color: var(--text-main); }
.sub-tab-btn.active { background: var(--tab-active); color: #fff; }

.filters-group { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; flex-grow: 1; }
.badge-count { font-size: 0.75em; font-weight: 600; color: var(--text-muted); padding: 0 10px; border-left: 2px solid var(--tab-active); }

/* --- CARTES VEILLE --- */
/* --- CARTES VEILLE --- */
.articles-grid { display: flex; flex-direction: column; gap: 10px; max-width: 1000px; margin: 0 auto; }

.card-compact { 
    padding: 20px; display: flex; flex-direction: column; gap: 6px; transition: 0.2s; 
    word-wrap: break-word; overflow-wrap: break-word; border-left: 4px solid transparent !important;
    
    /* 👉 LE VRAI FIX : On interdit le flou sur les tuiles elles-mêmes ! */
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
.card-compact:hover { border-left-color: var(--tab-active) !important; }
.card-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--glass-border); padding-bottom: 8px; margin-bottom: 4px; gap: 10px; }
.card-date { font-size: 0.7em; color: var(--text-muted); font-weight: 500;}
.card-source-link { color: var(--text-main); text-decoration: none; font-weight: 600; padding: 4px 8px; border-radius: 6px; font-size: 0.6em; text-transform: uppercase; border: 1px solid var(--glass-border); transition: 0.2s;}
.card-source-link:hover { background: var(--text-main); color: var(--bg-color); border-color: var(--text-main); }
.titre-fr { font-size: 1.15em; font-weight: 800; line-height: 1.3; margin: 0 0 4px 0; }
.titre-us { font-size: 0.85em; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.resume-text { font-size: 0.9em; line-height: 1.6; color: var(--text-main); opacity: 0.9; margin-top: 8px; margin-bottom: 0; }

/* --- MARCHÉS FINANCIERS --- */
.market-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; margin-bottom: 25px; }
.market-card { padding: 15px; text-align: center; cursor: pointer; transition: 0.2s; display: flex; flex-direction: column; justify-content: center; border: 1px solid var(--glass-border) !important;}
.market-card:hover { transform: scale(1.05); border-color: var(--tab-active) !important; }
.mkt-symbol { font-weight: 800; font-size: 0.95em; margin-bottom: 6px; }
.mkt-price { font-size: 1.15em; font-weight: 500; font-variant-numeric: tabular-nums; }
.mkt-change { font-size: 0.85em; font-weight: 700; margin-top: 4px; display: inline-block; background: transparent; padding: 0;}

/* MODAL GRAPHIQUE */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 1000; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(8px); }
.modal-content { width: 90%; max-width: 700px; padding: 25px; }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.btn-close { background: transparent; color: var(--text-main); border: none; width: 32px; height: 32px; font-size: 1.2em; cursor: pointer; transition: 0.2s; display: flex; align-items: center; justify-content: center;}
.btn-close:hover { color: var(--bad); }
.timeframe-selector { display: flex; gap: 8px; margin-bottom: 20px; justify-content: center; }
.btn-timeframe { background: transparent; color: var(--text-muted); border: 1px solid var(--glass-border); padding: 4px 14px; border-radius: 8px; cursor: pointer; font-size: 0.85em; font-weight: 600; transition: 0.2s;}
.btn-timeframe.active, .btn-timeframe:hover { background: var(--text-main); color: var(--bg-color); border-color: var(--text-main); }

/* --- CONTENEUR IA ET ADMIN --- */
.analyse-container { padding: 25px; word-wrap: break-word; overflow-wrap: break-word; box-sizing: border-box;}
.synthesis-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; border-bottom: 1px solid var(--glass-border); padding-bottom: 15px;}
.pretty-select {
    appearance: none; -webkit-appearance: none; cursor: pointer; 
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23787880' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 8px center; background-size: 16px;
    max-width: 65%;
}
.syn-section-title { color: var(--text-muted); font-size: 0.8em; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; margin-top: 25px; margin-bottom: 8px; border-bottom: 1px solid var(--glass-border); padding-bottom: 5px;}
.syn-text { font-size: 0.95em; line-height: 1.6; opacity: 0.9;}
.brief-list { padding-left: 20px; list-style-type: square; }
.prospective-box { margin-top: 25px; padding: 15px; border-left: 4px solid var(--tab-active); background: rgba(150,150,150,0.05); border-radius: 8px;}

/* STATS ET TABLES */
.users-table { width: 100%; border-collapse: collapse; text-align: left; margin-top: 10px;}
.users-table th { color: var(--text-muted); font-size: 0.75em; text-transform: uppercase; border-bottom: 1px solid var(--glass-border); padding: 10px; }
.users-table td { padding: 10px; border-bottom: 1px solid var(--glass-border); font-size: 0.85em; vertical-align: middle;}
.stats-table th { text-align: center; } .stats-table th:first-child, .stats-table td:first-child { text-align: left; } .stats-table td { text-align: center; font-variant-numeric: tabular-nums; }
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; width: 100%; }
.charts-grid .analyse-container { min-width: 0; overflow: hidden; }

/* BADGES ROLES */
.badge-admin { background: transparent; color: var(--bad); padding: 2px 6px; border-radius: 6px; font-weight: 800; font-size: 0.7em; text-transform: uppercase; border: 1px solid var(--bad);}
.badge-lecteur { background: transparent; color: var(--good); padding: 2px 6px; border-radius: 6px; font-weight: 800; font-size: 0.7em; text-transform: uppercase; border: 1px solid var(--good);}
.badge-limite { background: transparent; color: var(--text-muted); padding: 2px 6px; border-radius: 6px; font-weight: 800; font-size: 0.7em; text-transform: uppercase; border: 1px solid var(--text-muted);}
.badge-superuser { background: transparent; color: var(--tab-active); padding: 2px 6px; border-radius: 6px; font-weight: 800; font-size: 0.7em; text-transform: uppercase; border: 1px solid var(--tab-active);}

/* --- LOGIN --- */
#login-screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 10000; }
.login-box { padding: 40px; width: 100%; max-width: 400px; text-align: center; }
.login-box input { margin-bottom: 12px; width: 100%; }
.btn-google {
    width: 100%; box-sizing: border-box; display: flex; align-items: center; justify-content: center; gap: 10px;
    background: #ffffff; color: #000000; font-weight: 600; font-family: inherit; border-radius: 8px; padding: 10px; border: none; cursor: pointer; transition: 0.2s; font-size: 0.9em;
}
.btn-google:hover { filter: brightness(0.9); }

@media (max-width: 768px) {
    body { padding: 8px; }
    .header-branding-row { grid-template-columns: auto 1fr auto; gap: 10px; }
    .main-title { font-size: 1.25em; }
    .btn-logout { width: 36px; height: 36px; padding: 0; border-color: transparent;}
    .btn-logout .btn-text { display: none; }
    .btn-logout .btn-icon { display: block; font-size: 1.4em;}
    .charts-grid { grid-template-columns: 1fr; }
    .tab-text { display: none; } 
    .tab-btn { font-size: 1.4em; padding: 0 15px;}
    .header-container { padding: 10px; }
}

/* Drapeaux plus grands et rapprochés */
#veille-controls .sub-tabs-wrapper { gap: 2px; }
#veille-controls .sub-tab-btn { font-size: 1.4em; padding: 2px 6px; }
#veille-controls .spacer-v { margin: 0 4px; }

/* ==========================================
   📱 ANIMATION DU HEADER SUR MOBILE
========================================== */
.header-container {
    position: sticky; /* Garde le header en haut de l'écran */
    top: 0;
    z-index: 1000; /* S'assure qu'il reste par-dessus les articles */
    transition: transform 0.3s ease-in-out; /* Animation fluide de glissement */
}

/* Classe activée dynamiquement par le JS pour cacher le header */
.header-hidden {
    transform: translateY(-100%);
}