/* =============================================================================
   AWCM — African West Coast Mining Co — Design Industriel Premium
   Palette : #1a1a2e (fond) / #16213e (surfaces) / #d4a853 (or) / #c0c0c0 (argent)
   ============================================================================= */

:root {
    --bg-primary: #1a1a2e;
    --bg-surface: #16213e;
    --bg-surface-hover: #1a2744;
    --bg-card: #0f1b30;
    --accent-gold: #d4a853;
    --accent-gold-dim: rgba(212, 168, 83, 0.15);
    --accent-silver: #c0c0c0;
    --text-primary: #e8e8e8;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --success: #4ade80;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --border: rgba(212, 168, 83, 0.2);
    --border-subtle: rgba(255, 255, 255, 0.06);
    --radius: 8px;
    --radius-sm: 4px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --sidebar-width: 260px;
    --banner-height: 32px;
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

/* === ANTI-COPIE === */
body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Watermark invisible sur chaque page (visible sur screenshot) */
.app-layout::after {
    content: attr(data-watermark);
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-30deg);
    font-size: 4rem;
    color: rgba(212, 168, 83, 0.03);
    pointer-events: none;
    z-index: 9999;
    white-space: nowrap;
    letter-spacing: 0.3em;
    font-weight: 900;
}

/* Empêcher l'impression */
@media print {
    body { display: none !important; }
    html::after {
        content: "Impression interdite — Propriété exclusive de Bastion IT";
        display: block;
        padding: 4rem;
        font-size: 2rem;
        text-align: center;
    }
}

/* === LANDING PAGE === */
.landing-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    background: radial-gradient(ellipse at center, #16213e 0%, #1a1a2e 70%);
}

.landing-logo { text-align: center; margin-bottom: 2rem; }
.landing-logo h1 {
    font-size: 1.8rem;
    color: var(--accent-gold);
    margin-top: 1rem;
    letter-spacing: 0.05em;
}
.landing-subtitle { color: var(--text-secondary); margin-top: 0.5rem; }

.login-form {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow);
}

.form-group { margin-bottom: 1.2rem; }
.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.form-group input {
    width: 100%;
    padding: 0.7rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}
.form-group input:focus { border-color: var(--accent-gold); }

.error-text { color: var(--danger); font-size: 0.85rem; margin-top: 0.8rem; text-align: center; }

.landing-footer { margin-top: 1.5rem; }

/* === BUTTONS === */
.btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font);
}
.btn-primary {
    background: var(--accent-gold);
    color: #1a1a2e;
    font-weight: 600;
}
.btn-primary:hover { background: #e0b85c; }
.btn-secondary {
    background: transparent;
    border: 1px solid var(--accent-gold);
    color: var(--accent-gold);
}
.btn-secondary:hover { background: var(--accent-gold-dim); }
.btn-danger { background: var(--danger); color: white; }
.btn-full { width: 100%; }
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.8rem; }
.btn-link {
    background: none;
    border: none;
    color: var(--accent-gold);
    cursor: pointer;
    font-size: 0.85rem;
    text-decoration: underline;
}

/* === DEMO BANNER === */
.demo-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--banner-height);
    background: var(--accent-gold);
    color: #1a1a2e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    z-index: 1000;
}

/* === APP LAYOUT === */
.app-layout {
    display: flex;
    padding-top: var(--banner-height);
    min-height: 100vh;
}

/* === SIDEBAR === */
.sidebar {
    position: fixed;
    top: var(--banner-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--banner-height));
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}
.sidebar-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-gold);
    letter-spacing: 0.08em;
}

.nav-list { list-style: none; flex: 1; padding: 0.2rem 0; overflow-y: auto; min-height: 0; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.8rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.88rem;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}
.nav-item:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}
.nav-item.active {
    background: var(--accent-gold-dim);
    color: var(--accent-gold);
    border-left-color: var(--accent-gold);
}
.nav-icon { font-size: 0.95rem; width: 1.2rem; text-align: center; }

/* === QUOTA METER === */
.quota-meter {
    padding: 0.5rem 0.8rem;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.75rem;
    flex-shrink: 0;
}
.quota-meter h4 {
    color: var(--text-muted);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.3rem;
}
.quota-bar { margin-bottom: 0.2rem; }
.quota-bar span { color: var(--text-muted); font-size: 0.7rem; }
.progress-bar {
    height: 3px;
    background: var(--bg-card);
    border-radius: 2px;
    margin: 0.2rem 0;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--accent-gold);
    border-radius: 2px;
    transition: width 0.3s;
    width: 0%;
}
.progress-fill.warning { background: var(--warning); }
.progress-fill.danger { background: var(--danger); }

/* === SOVEREIGNTY SHIELD === */
.sovereignty-shield {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    margin: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 600;
    flex-shrink: 0;
}
.sovereignty-shield.local {
    background: rgba(74, 222, 128, 0.1);
    color: var(--success);
    border: 1px solid rgba(74, 222, 128, 0.2);
}
.sovereignty-shield.cloud {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
    border: 1px solid rgba(59, 130, 246, 0.2);
}
.shield-icon { font-size: 1.1rem; }

/* === SIDEBAR FOOTER === */
.sidebar-footer {
    padding: 0.4rem 0.8rem;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
    align-items: center;
    flex-shrink: 0;
}
.sidebar-footer span { font-size: 0.78rem; }
.badge {
    background: var(--accent-gold-dim);
    color: var(--accent-gold);
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* === MAIN CONTENT === */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 2rem;
    flex: 1;
    min-height: calc(100vh - var(--banner-height));
}

/* === CARDS === */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-gold);
}

/* === STATS GRID === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 1.2rem;
    text-align: center;
}
.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-gold);
}
.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* === SEARCH === */
.search-container { max-width: 800px; margin: 0 auto; }
.search-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.search-input {
    flex: 1;
    padding: 0.8rem 1.2rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
}
.search-input:focus { border-color: var(--accent-gold); }

.llm-toggle {
    display: flex;
    gap: 0.3rem;
    margin-bottom: 1rem;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 0.2rem;
}
.llm-toggle button {
    padding: 0.4rem 1rem;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}
.llm-toggle button.active {
    background: var(--accent-gold);
    color: #1a1a2e;
    font-weight: 600;
}

.suggested-queries {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}
.suggested-query {
    padding: 0.4rem 0.8rem;
    background: var(--accent-gold-dim);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--accent-gold);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}
.suggested-query:hover { background: rgba(212, 168, 83, 0.3); }

.search-result {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 1.2rem;
    margin-bottom: 0.8rem;
}
.search-result .source {
    font-size: 0.75rem;
    color: var(--accent-gold);
    margin-top: 0.5rem;
}
.answer-text { line-height: 1.6; white-space: pre-wrap; }

/* === TABLES === */
.table-container { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
th {
    text-align: left;
    padding: 0.7rem 1rem;
    background: var(--bg-card);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--border);
}
td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}
tr:hover td { background: var(--bg-surface-hover); }

/* === STATUS BADGES === */
.status-pending { color: var(--warning); }
.status-classified { color: var(--info); }
.status-validated { color: var(--success); }
.status-rejected { color: var(--danger); }

/* === GRAPH VIEW === */
#graph-container, #map-container {
    width: 100%;
    height: calc(100vh - 200px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

/* === FOOTER === */
.app-footer {
    text-align: center;
    padding: 1.5rem;
    border-top: 1px solid var(--border-subtle);
    margin-top: 2rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.app-footer a { color: var(--accent-gold); text-decoration: none; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar .nav-item span:not(.nav-icon) { display: none; }
    .sidebar-title, .sidebar-header span,
    .quota-meter, .sovereignty-shield span:not(.shield-icon),
    .sidebar-footer { display: none; }
    .main-content { margin-left: 60px; padding: 1rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .landing-logo h1 { font-size: 1.3rem; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .search-bar { flex-direction: column; }
}

/* === ANIMATIONS === */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.card, .stat-card, .search-result { animation: fadeIn 0.3s ease-out; }

/* === GUIDED TOUR OVERLAY === */
.tour-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tour-card {
    background: var(--bg-surface);
    border: 1px solid var(--accent-gold);
    border-radius: var(--radius);
    padding: 2rem;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 0 40px rgba(212, 168, 83, 0.2);
}
.tour-card h2 { color: var(--accent-gold); margin-bottom: 1rem; }
.tour-card p { color: var(--text-secondary); margin-bottom: 1.5rem; line-height: 1.5; }
.tour-actions { display: flex; gap: 0.5rem; justify-content: center; }

/* === LOADING === */
.loading { display: flex; align-items: center; gap: 0.5rem; color: var(--text-muted); }
.spinner {
    width: 16px; height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent-gold);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
