/* ROM InformatiK — Interface de gestion */
/* Police: Inter (Google Fonts) */

:root {
    --bg: #f8f9fa;
    --surface: #ffffff;
    --surface-2: #f1f3f5;
    --border: #dee2e6;
    --border-light: #e9ecef;
    --text: #212529;
    --text-muted: #6c757d;
    --text-light: #adb5bd;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --success: #16a34a;
    --success-light: #f0fdf4;
    --warning: #d97706;
    --warning-light: #fffbeb;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --sidebar-bg: #1e293b;
    --sidebar-text: #94a3b8;
    --sidebar-active: #ffffff;
    --sidebar-hover: #334155;
    --radius: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

/* ── LOGIN ── */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sidebar-bg);
}
.login-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 40px;
    width: 360px;
    box-shadow: var(--shadow-md);
}
.login-logo {
    text-align: center;
    margin-bottom: 28px;
}
.login-logo h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.3px;
}
.login-logo span { color: var(--primary); }
.login-logo p { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── LAYOUT ── */
.app-wrap { display: flex; min-height: 100vh; }

.sidebar {
    width: 220px;
    min-height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
}
.sidebar-brand {
    padding: 20px 20px 16px;
    border-bottom: 1px solid #334155;
}
.sidebar-brand h1 {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -.2px;
}
.sidebar-brand h1 span { color: #60a5fa; }
.sidebar-brand p { font-size: 11px; color: var(--sidebar-text); margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-section {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #475569;
    padding: 12px 20px 4px;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13.5px;
    transition: background .15s, color .15s;
    border-left: 3px solid transparent;
}
.sidebar-nav a:hover {
    background: var(--sidebar-hover);
    color: #e2e8f0;
}
.sidebar-nav a.active {
    color: var(--sidebar-active);
    background: #1d4ed820;
    border-left-color: #60a5fa;
}
.sidebar-nav a svg { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid #334155;
}
.sidebar-footer a {
    font-size: 12px;
    color: var(--sidebar-text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}
.sidebar-footer a:hover { color: #e2e8f0; }

.main-content {
    margin-left: 220px;
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 28px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar h2 { font-size: 15px; font-weight: 600; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.page-body { padding: 24px 28px; flex: 1; }

/* ── CARDS ── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-header h3 { font-size: 14px; font-weight: 600; }
.card-body { padding: 20px; }

/* ── STATS ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
}
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-bottom: 6px; }
.stat-value { font-size: 24px; font-weight: 700; letter-spacing: -.5px; }
.stat-value.green { color: var(--success); }
.stat-value.blue { color: var(--primary); }
.stat-value.orange { color: var(--warning); }
.stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ── TABLEAU ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    white-space: nowrap;
}
td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--primary-light); }
.td-actions { display: flex; gap: 6px; }

/* ── BADGES ── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}
.badge-green  { background: var(--success-light); color: var(--success); }
.badge-blue   { background: var(--primary-light); color: var(--primary); }
.badge-orange { background: var(--warning-light); color: var(--warning); }
.badge-red    { background: var(--danger-light); color: var(--danger); }
.badge-gray   { background: var(--surface-2); color: var(--text-muted); }

/* ── FORMS ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 12px; font-weight: 500; color: var(--text-muted); }
input, select, textarea {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
textarea { resize: vertical; min-height: 80px; }

/* ── BUTTONS ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: background .15s, border-color .15s, color .15s;
    white-space: nowrap;
}
.btn svg { width: 14px; height: 14px; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger-light); color: var(--danger); border-color: #fca5a5; }
.btn-danger:hover { background: #fee2e2; }
.btn-success { background: var(--success-light); color: var(--success); border-color: #86efac; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-sm svg { width: 12px; height: 12px; }

/* ── ALERTS ── */
.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 16px; }
.alert-error { background: var(--danger-light); color: var(--danger); border: 1px solid #fca5a5; }
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid #86efac; }

/* ── MODAL ── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 100;
    align-items: center;
    justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--surface);
    border-radius: var(--radius);
    width: 580px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
}
.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-body { padding: 20px; }
.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.modal-close { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 18px; line-height: 1; }

/* ── FILTRES ── */
.filters-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.filters-bar input, .filters-bar select { max-width: 180px; }

/* ── CHART ── */
.chart-wrap { height: 220px; position: relative; }

/* ── EMPTY STATE ── */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}
.empty-state svg { width: 40px; height: 40px; margin-bottom: 12px; opacity: .3; }
.empty-state p { font-size: 13px; }

/* ── UTILS ── */
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.font-mono { font-family: 'SF Mono', 'Fira Code', monospace; }
.mb-4 { margin-bottom: 16px; }
.mt-4 { margin-top: 16px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.positive { color: var(--success); font-weight: 600; }
.negative { color: var(--danger); font-weight: 600; }
