/* ─── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --navy:   #0E2148;
  --accent: #E8A33D;
  --red:    #E8556B;
  --green:  #3AAE73;
  --purple: #7B5EA7;
  --blue:   #3B82F6;
  --bg:     #F4F6FA;
  --surface:#FFFFFF;
  --line:   #E5E9F0;
  --text:   #1A2540;
  --soft:   #64748B;
  --faint:  #94A3B8;
  --sidebar-w: 240px;
  --top-h:    60px;
}
html, body { height: 100%; font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ─── Layout ──────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w); background: var(--navy);
  display: flex; flex-direction: column; z-index: 100;
}
.main-wrap { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--top-h); background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
}
.content { flex: 1; padding: 28px; }

/* ─── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 20px 16px; border-bottom: 1px solid rgba(255,255,255,.1);
}
.brand-logo { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; }
.brand-name { color: #fff; font-weight: 800; font-size: 16px; letter-spacing: .04em; }
.brand-tag  { background: var(--accent); color: #fff; font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 4px; text-transform: uppercase; letter-spacing: .08em; }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 20px; color: rgba(255,255,255,.65);
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.12); color: #fff; border-right: 3px solid var(--accent); }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }
.nav-label { font-size: 13.5px; font-weight: 500; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.1); }
.logout-btn {
  display: flex; align-items: center; gap: 8px;
  color: rgba(255,255,255,.5); font-size: 13px; transition: color .15s;
}
.logout-btn:hover { color: var(--red); }

/* ─── Topbar ──────────────────────────────────────────────────────────────── */
.page-title { font-size: 18px; font-weight: 700; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.admin-chip { background: var(--bg); border: 1px solid var(--line); border-radius: 20px; padding: 5px 12px; font-size: 13px; color: var(--soft); }

/* ─── Cards Stats ─────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px 22px; display: flex; align-items: center; gap: 16px;
}
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.stat-icon.blue   { background: #EFF6FF; }
.stat-icon.green  { background: #ECFDF5; }
.stat-icon.purple { background: #F5F3FF; }
.stat-icon.orange { background: #FFF7ED; }
.stat-icon.red    { background: #FFF1F2; }
.stat-val  { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label{ font-size: 12px; color: var(--soft); margin-top: 3px; }

/* ─── Panels & Tables ─────────────────────────────────────────────────────── */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-bottom: 24px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.panel-title { font-size: 15px; font-weight: 700; }
.panel-body  { padding: 0; }
.table-wrap  { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th { background: var(--bg); padding: 10px 16px; text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--soft); white-space: nowrap; }
tbody td { padding: 12px 16px; border-top: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: #FAFBFD; }
.no-data { padding: 40px; text-align: center; color: var(--faint); }

/* ─── Badges ──────────────────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 9px; border-radius: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.badge-blue   { background: #DBEAFE; color: #1D4ED8; }
.badge-green  { background: #D1FAE5; color: #065F46; }
.badge-yellow { background: #FEF3C7; color: #92400E; }
.badge-purple { background: #EDE9FE; color: #5B21B6; }
.badge-red    { background: #FEE2E2; color: #991B1B; }
.badge-grey   { background: #F1F5F9; color: #475569; }
.badge-orange { background: #FED7AA; color: #9A3412; }

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; border: none; transition: opacity .15s; }
.btn:hover { opacity: .85; }
.btn-primary  { background: var(--navy); color: #fff; }
.btn-accent   { background: var(--accent); color: #fff; }
.btn-danger   { background: var(--red); color: #fff; }
.btn-success  { background: var(--green); color: #fff; }
.btn-outline  { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: 5px; }

/* ─── Forms ───────────────────────────────────────────────────────────────── */
.search-bar { display: flex; gap: 8px; align-items: center; }
.search-input { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; outline: none; transition: border .15s; background: var(--bg); }
.search-input:focus { border-color: var(--navy); background: #fff; }
.select-filter { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; outline: none; background: var(--bg); }
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--soft); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .05em; }
.form-control { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; outline: none; transition: border .15s; }
.form-control:focus { border-color: var(--navy); }

/* ─── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(14,33,72,.45); display: none; align-items: center; justify-content: center; z-index: 1000; }
.modal-overlay.open { display: flex; }
.modal { background: var(--surface); border-radius: 18px; width: 100%; max-width: 540px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--faint); cursor: pointer; line-height: 1; }
.modal-body  { padding: 22px; }
.modal-footer{ padding: 16px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

/* ─── Login ───────────────────────────────────────────────────────────────── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--navy); }
.login-card { background: #fff; border-radius: 20px; padding: 40px; width: 360px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo img { height: 56px; object-fit: contain; }
.login-title { font-size: 22px; font-weight: 800; text-align: center; color: var(--navy); margin-bottom: 4px; }
.login-sub   { font-size: 13px; text-align: center; color: var(--soft); margin-bottom: 28px; }
.login-error { background: #FEE2E2; color: #991B1B; border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-size: 13px; }
.login-btn   { width: 100%; padding: 13px; background: var(--navy); color: #fff; border: none; border-radius: 10px; font-size: 15px; font-weight: 700; cursor: pointer; margin-top: 8px; transition: opacity .15s; }
.login-btn:hover { opacity: .88; }

/* ─── Detail row ──────────────────────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.detail-item .d-label { font-size: 11px; color: var(--soft); text-transform: uppercase; font-weight: 700; margin-bottom: 3px; }
.detail-item .d-val   { font-size: 14px; color: var(--text); font-weight: 500; }

/* ─── Misc ────────────────────────────────────────────────────────────────── */
.text-soft   { color: var(--soft); }
.text-faint  { color: var(--faint); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.font-mono   { font-family: 'JetBrains Mono', 'Courier New', monospace; font-size: 12px; }
.two-cols    { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.flex-gap    { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--line); display: inline-flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.avatar-placeholder { background: var(--navy); color: #fff; border-radius: 50%; width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-name  { font-weight: 600; font-size: 14px; }
.user-email { font-size: 12px; color: var(--soft); }
.price-green { color: var(--green); font-weight: 700; }
.carb-essence   { color: #F59E0B; }
.carb-diesel    { color: #3B82F6; }
.carb-hybride   { color: var(--green); }
.carb-electrique{ color: #8B5CF6; }
.actions-cell { white-space: nowrap; display: flex; gap: 4px; align-items: center; }
.toggle-switch { position: relative; display: inline-block; width: 38px; height: 22px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: #CBD5E1; border-radius: 22px; cursor: pointer; transition: .25s; }
.slider:before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .25s; }
input:checked + .slider { background: var(--green); }
input:checked + .slider:before { transform: translateX(16px); }
.pagination { display: flex; gap: 6px; align-items: center; justify-content: flex-end; padding: 14px 20px; }
.page-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 7px; padding: 6px 11px; font-size: 13px; cursor: pointer; }
.page-btn.active, .page-btn:hover { background: var(--navy); color: #fff; border-color: var(--navy); }
.breadcrumb { font-size: 12px; color: var(--soft); margin-bottom: 20px; }
.breadcrumb a { color: var(--soft); }
.breadcrumb a:hover { color: var(--navy); }
.breadcrumb span { margin: 0 6px; }
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 13px; font-weight: 500; }
.alert-success { background: #D1FAE5; color: #065F46; }
.alert-danger  { background: #FEE2E2; color: #991B1B; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; background: var(--bg); color: var(--soft); border: 1px solid var(--line); }
