:root {
  --bg: #0f172a; --panel: #1e293b; --panel2: #334155;
  --text: #f1f5f9; --muted: #94a3b8; --border: #334155;
  --accent: #64748b; --accent2: #fb923c; --good: #10b981; --bad: #ef4444;
}

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

.container { max-width: 1100px; margin: auto; }

/* --- EN-TÊTE FIXE --- */
.header-container {
    position: sticky; top: 10px; z-index: 100; 
    background-image: url('world.png'); background-size: cover; background-position: top center; 
    padding: 12px 20px 0 20px; border-radius: 12px; border: 1px solid var(--border); margin-bottom: 20px; 
    box-shadow: 0 15px 20px -5px rgba(0,0,0,0.6);
}

.header-branding-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-bottom: 10px; 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; }

.desktop-title { display: block; margin: 0; font-size: 1.25em; font-weight: 800; color: #fff; letter-spacing: -0.01em; text-shadow: 0 3px 8px rgba(0,0,0,0.9); }
.mobile-title { display: none; margin: 0; font-size: 1.4em; font-weight: 900; color: #fff; text-shadow: 0 3px 8px rgba(0,0,0,0.9); }

.header-flag-logo { height: 100px; width: auto; border-radius: 4px; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.5)); margin-top: -5px; margin-bottom: -40px; position: relative; z-index: 10; }

.btn-logout { height: 32px; padding: 0 12px; border-radius: 6px; cursor: pointer; font-weight: 700; border: none; background: var(--bad); color: #fff; transition: 0.2s; font-size: 0.85em; box-shadow: 0 2px 5px rgba(0,0,0,0.5); }
.btn-logout:hover { filter: brightness(1.1); transform: scale(1.02); }

/* --- NAVIGATION PAR ONGLETS --- */
.tabs-container { display: flex; gap: 4px; margin-top: 5px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.tabs-container::-webkit-scrollbar { display: none; }

.tab-btn { background: #334155; color: #e2e8f0; border: 1px solid rgba(255,255,255,0.05); border-bottom: 3px solid #475569; padding: 7px 18px; cursor: pointer; font-weight: 600; font-size: 0.85em; transition: 0.2s; border-radius: 8px 8px 0 0; box-shadow: 0 -2px 5px rgba(0,0,0,0.2); position: relative; z-index: 11; white-space: nowrap; }
.tab-btn:hover { background: #475569; color: #fff; }
.tab-btn.active { background: var(--panel); color: #fff; border-bottom: 3px solid var(--accent2); border-top: 1px solid var(--border); border-left: 1px solid var(--border); border-right: 1px solid var(--border); }

.tab-pane { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* --- ONGLET NEWSLETTER --- */
.tab-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; padding: 0 5px; }

.newsletter-dropdown { background: transparent; color: #fff; border: 1px solid var(--border); padding: 4px 28px 4px 12px; border-radius: 6px; font-size: 0.85em; font-weight: 600; outline: none; cursor: pointer; appearance: none; background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2394a3b8%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E"); background-repeat: no-repeat; background-position: right 10px top 50%; background-size: 8px auto; }
.newsletter-dropdown:focus { border-color: var(--accent); }
.newsletter-dropdown option { background: var(--panel); color: #fff; }

.newsletter-meta-text { color: #e2e8f0; font-weight: normal; font-size: 0.85em; text-transform: lowercase; }

/* --- ONGLET STATISTIQUES --- */
.dashboard-container { display: flex; gap: 15px; margin-bottom: 15px; align-items: stretch; }
.dashboard-totals { flex: 1; display: flex; flex-direction: column; gap: 15px; } 
.stat-card { flex: 1; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 15px; text-align: center; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.2); display: flex; flex-direction: column; justify-content: center; }
.stat-card h3 { color: var(--muted); font-size: 0.7em; margin: 0 0 5px 0; text-transform: uppercase; font-weight: 700; letter-spacing: 0.05em; }
.stat-card p { color: var(--accent2); font-size: 1.6em; font-weight: 800; margin: 0; line-height: 1; }
.dashboard-chart { flex: 4; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 15px 20px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.2); display: flex; flex-direction: column; overflow: hidden; }
.chart-wrapper { flex: 1; position: relative; max-height: 450px; height: 450px; width: 100%; min-height: 250px; }

.analyse-container { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 20px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.2); }
.stats-title { margin-top: 0; margin-bottom: 10px; color: #fff; font-size: 0.9em; }
.stats-title-warning { margin-top: 0; color: var(--accent2); font-size: 0.9em; margin-bottom: 5px; }
.stats-subtitle { color: var(--muted); font-size: 0.85em; margin-top: 0; margin-bottom: 15px; }

/* --- ONGLET UTILISATEURS --- */
.users-table { width: 100%; border-collapse: collapse; text-align: left; }
.users-table th { color: var(--muted); font-size: 0.75em; text-transform: uppercase; border-bottom: 2px solid var(--border); padding: 10px 5px; }
.users-table td { padding: 12px 5px; border-bottom: 1px solid var(--border); color: #f1f5f9; font-size: 0.85em; }

/* --- ONGLET RECHERCHE --- */
.search-tools { background: var(--panel); padding: 10px 18px; border-radius: 12px; border: 1px solid var(--border); display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 20px; }
#search-bar { flex: 1; height: 34px; border-radius: 6px; padding: 0 12px; background: #0f172a; border: 1px solid var(--border); color: #fff; font-size: 0.85em; outline: none; box-sizing: border-box; }
#search-bar:focus { border-color: var(--accent); }
.filters-container { flex-shrink: 0; }
.filter-group { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 0.85em; font-weight: 500; }
.filter-group select { background: #0f172a; color: #fff; border: 1px solid var(--border); padding: 5px 10px; border-radius: 6px; outline: none; cursor: pointer; font-size: 0.85em; }

.search-split-view { display: flex; gap: 15px; align-items: flex-start; }
.search-list-col { flex: 3; max-height: calc(100vh - 180px); overflow-y: auto; padding-right: 5px; }
.search-preview-col { flex: 2; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 15px; position: sticky; top: 130px; max-height: calc(100vh - 150px); overflow-y: auto; display: flex; flex-direction: column; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.3); }

.preview-meta { font-size: 0.65em; color: var(--muted); text-transform: uppercase; font-weight: 700; margin-bottom: 5px; }
.preview-title { font-size: 0.9em; color: #fff; margin: 0 0 10px 0; line-height: 1.3; font-weight: 700; }
.preview-content { font-size: 0.85em; color: #cbd5e1; line-height: 1.5; white-space: pre-wrap; margin-bottom: 15px; }
.preview-sowhat-box { background: rgba(251, 146, 60, 0.08); border-left: 3px solid var(--accent2); padding: 10px; border-radius: 4px; }
.preview-sowhat-box strong { font-size: 0.75em; color: var(--accent2); display: block; margin-bottom: 4px; text-transform: uppercase; }
#preview-sowhat { font-size: 0.85em; color: #ffffff; font-style: italic; line-height: 1.4; white-space: pre-wrap; }

/* --- ONGLET ÉDITEUR --- */
.editor-panel { background: var(--panel); padding: 20px 25px; border-radius: 12px; border: 1px solid var(--border); }
.editor-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.editor-header h2 { margin: 0; color: #fff; font-size: 1.1em; }

/* Sécurité d'enregistrement */
#btn-save-article:disabled { cursor: not-allowed !important; filter: saturate(0.5); }

/* --- CARTES ARTICLES (Global) --- */
.articles-grid { display: flex; flex-direction: column; gap: 6px; }
.card { background: var(--panel); border-radius: 8px; border: 1px solid var(--border); cursor: pointer; position: relative; margin-bottom: 2px; }
.card:hover { background: #242f44; border-color: var(--accent); }

/* NEWSLETTER */
.card-newsletter { padding: 10px 15px; }
.card-title-newsletter { font-weight: 600; font-size: 0.9em; color: #fff; margin: 0; line-height: 1.3; padding-right: 25px; }
.card-body-visible { margin-top: 6px; }
.card-sowhat { color: #ffffff; font-size: 0.85em; font-style: italic; border-top: 1px solid rgba(255,255,255,0.08); padding-top: 6px; margin-top: 6px; line-height: 1.4; }
.card-sowhat strong { color: var(--accent2); }

.edit-icon { position: absolute; right: 10px; top: 10px; opacity: 0.25; font-size: 1.1em; transition: 0.2s; z-index: 2; }
.edit-icon:hover { opacity: 1; color: var(--accent2); transform: scale(1.1); }

/* RECHERCHE */
.card-search { padding: 8px 10px; transition: background 0.2s ease; }
.search-item-row { display: flex; align-items: center; gap: 6px; width: 100%; box-sizing: border-box; }
.card-issue { font-weight: 500; color: #94a3b8; font-size: 0.85em; white-space: nowrap; flex-shrink: 0; min-width: 20px; text-align: left; margin-left: -2px; }
.card-title-search { font-weight: normal; font-size: 0.85em; color: #f1f5f9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-grow: 1; margin: 0; }

/* --- MODALES --- */
.modal { position: fixed; inset: 0; background: rgba(2, 6, 23, 0.92); display: flex; align-items: center; justify-content: center; z-index: 9999; backdrop-filter: blur(6px); }
.modal-content { background: #1e293b; width: 92%; max-width: 820px; border-radius: 12px; border: 1px solid var(--border); overflow: hidden; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5); }
.modal-header { padding: 12px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: rgba(15, 23, 42, 0.5); }
.modal-body { padding: 20px 30px; overflow-y: auto; max-height: 75vh; }
.close-btn { font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; transition: 0.2s; }
.close-btn:hover { color: #fff; }

.view-title { color: #fff; margin-top: 0; margin-bottom: 12px; font-size: 1em; font-weight: 700; line-height: 1.3; } 
.view-text { line-height: 1.5; white-space: pre-wrap; color: #d1d5db; font-size: 0.85em; margin-bottom: 20px; } 
.sowhat-box { background: rgba(251, 146, 60, 0.08); border-left: 4px solid var(--accent2); padding: 15px 20px; border-radius: 6px; }
.sowhat-box strong { color: var(--accent2); display: block; margin-bottom: 6px; font-size: 0.75em; text-transform: uppercase; letter-spacing: 0.05em; }
.sowhat-content { font-style: italic; font-size: 0.85em; color: #ffffff; line-height: 1.5; } 

.source-badge { display: inline-block; background: rgba(96, 165, 250, 0.1); color: #60a5fa; padding: 6px 14px; border-radius: 20px; font-size: 0.8em; text-decoration: none; border: 1px solid rgba(96, 165, 250, 0.3); transition: 0.2s; font-weight: 600; }

/* Login */
#login-screen { position: fixed; inset: 0; background: #020617; display: flex; align-items: center; justify-content: center; z-index: 10000; }
.login-box { background: #1e293b; padding: 40px; border-radius: 12px; border: 1px solid var(--border); width: 320px; text-align: center; }
.login-box h2 { margin-bottom: 8px; font-weight: 800; }
.login-box input { width: 100%; padding: 10px 15px; margin-bottom: 12px; border-radius: 6px; border: 1px solid var(--border); background: #0f172a; color: #fff; box-sizing: border-box; font-size: 0.85em; }

/* =======================================================
   📱 RESPONSIVE DESIGN 
   ======================================================= */
@media (max-width: 768px) and (orientation: portrait) {
    .desktop-title { display: none; }
    .mobile-title { display: block; text-align: center; }
    
    .header-flag-logo { height: 50px; margin-top: -2px; margin-bottom: -15px; }
    .header-branding-row { grid-template-columns: auto 1fr auto; gap: 10px; }
    
    .tab-text { display: none; }
    .tab-btn { padding: 8px 12px; font-size: 1.1em; }
    
    .search-tools { flex-direction: column; align-items: stretch; gap: 10px; }
    .filter-label-mobile { display: none; }
    
    .search-split-view { flex-direction: column; }
    .search-list-col { max-height: calc(100vh - 220px); }
    .search-preview-col { display: none !important; }

    .card-title-search { font-size: 0.85em; font-weight: 600; white-space: normal; }
    .card-issue { font-size: 0.85em; margin-left: -2px; }

    .dashboard-container { flex-direction: column; }
    .dashboard-totals { flex-direction: row; width: 100%; }
    .stat-card { padding: 10px; }
    .stat-card p { font-size: 1.3em; } 
    
    .chart-wrapper { max-height: 250px; height: 250px; }
    
    .modal-content { width: 95%; max-height: 90vh; }
    .modal-body { padding: 15px; }
    .editor-panel { padding: 15px; }
}