/* ============================================================
   CARE_GAM — Thème d'administration moderne (self-hosted)
   Parc auto / carburant — CARE Burundi
   ============================================================ */
:root {
  --brand:        #C8102E;   /* rouge CARE */
  --brand-dark:   #9e0c22;
  --brand-soft:   #fdecef;
  --sidebar-bg:   #141926;
  --sidebar-bg-2: #1c2333;
  --sidebar-txt:  #b8c0d2;
  --sidebar-txt-hover:#ffffff;
  --content-bg:   #f4f6fb;
  --card-bg:      #ffffff;
  --ink:          #222838;
  --ink-soft:     #6b7385;
  --line:         #e7ebf3;
  --ok:           #1a9d6a;
  --warn:         #e8a400;
  --danger:       #d63636;
  --info:         #2b7fd4;
  --radius:       12px;
  --radius-sm:    8px;
  --shadow:       0 1px 3px rgba(20,25,38,.06), 0 6px 24px rgba(20,25,38,.06);
  --shadow-lg:    0 10px 40px rgba(20,25,38,.14);
  --sidebar-w:    256px;
  --topbar-h:     62px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  background: var(--content-bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-txt);
  position: fixed; top: 0; left: 0; bottom: 0;
  display: flex; flex-direction: column;
  z-index: 1040;
  transition: transform .25s ease;
}
.sidebar__brand {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex: 0 0 auto;
}
.sidebar__brand img { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; background:#fff; }
.sidebar__brand b { color: #fff; font-size: 17px; letter-spacing: .5px; font-style: italic; }
.sidebar__brand span { display:block; font-size: 10px; color: var(--sidebar-txt); font-style: normal; letter-spacing:1px; text-transform:uppercase;}
.sidebar__nav { overflow-y: auto; padding: 10px 0 30px; flex: 1 1 auto; }
.sidebar__nav::-webkit-scrollbar { width: 6px; }
.sidebar__nav::-webkit-scrollbar-thumb { background: #2b3346; border-radius: 6px; }
.nav-section { padding: 16px 20px 6px; font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.2px; color: #5c6580; font-weight: 700; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 20px; color: var(--sidebar-txt); font-size: 13.5px; cursor: pointer; border-left: 3px solid transparent; transition: all .15s; }
.nav-item i { width: 18px; text-align: center; font-size: 15px; opacity: .9; }
.nav-item:hover { background: var(--sidebar-bg-2); color: var(--sidebar-txt-hover); }
.nav-item.active { background: linear-gradient(90deg, rgba(200,16,46,.22), transparent); color: #fff; border-left-color: var(--brand); }
.nav-item.active i { color: var(--brand); opacity: 1; }
.nav-group > .nav-item .caret { margin-left: auto; transition: transform .2s; font-size: 11px; }
.nav-group.open > .nav-item .caret { transform: rotate(90deg); }
.nav-sub { max-height: 0; overflow: hidden; transition: max-height .25s ease; }
.nav-group.open .nav-sub { max-height: 600px; }
.nav-sub a { display: block; padding: 8px 20px 8px 50px; color: #9aa3b8; font-size: 13px; }
.nav-sub a:hover, .nav-sub a.active { color: #fff; background: var(--sidebar-bg-2); }

/* ---------- Main ---------- */
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px; padding: 0 22px;
  position: sticky; top: 0; z-index: 1030;
}
.topbar .burger { display: none; font-size: 20px; color: var(--ink); cursor: pointer; background:none;border:none;}
.topbar__title { font-size: 16px; font-weight: 700; color: var(--ink); }
.topbar__title small { display:block; font-weight:400; font-size:12px; color:var(--ink-soft);}
.topbar__spacer { flex: 1; }
.topbar__date { color: var(--ink-soft); font-size: 13px; }
.topbar__user { display: flex; align-items: center; gap: 10px; padding-left: 16px; border-left: 1px solid var(--line); }
.topbar__user .avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.topbar__user .u-name { font-weight: 600; font-size: 13px; line-height: 1.1; }
.topbar__user .u-role { font-size: 11px; color: var(--ink-soft); text-transform: capitalize; }

.content { padding: 24px 26px 60px; flex: 1; }
.page-head { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.page-head h1 { font-size: 20px; font-weight: 700; margin: 0; color: var(--ink); }
.page-head .sub { color: var(--ink-soft); font-size: 13px; }
.page-head .spacer { flex: 1; }

/* ---------- Cards ---------- */
.card2 { background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card2 .card2-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display:flex; align-items:center; gap:10px;}
.card2 .card2-head h2 { font-size: 15px; font-weight: 700; margin: 0; }
.card2 .card2-body { padding: 20px; }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px,1fr)); gap: 18px; margin-bottom: 22px; }
.kpi { background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px; position: relative; overflow: hidden;}
.kpi .kpi-ic { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 22px; color: #fff; flex: 0 0 auto;}
.kpi .kpi-val { font-size: 26px; font-weight: 800; line-height: 1; color: var(--ink); }
.kpi .kpi-lbl { font-size: 12.5px; color: var(--ink-soft); margin-top: 6px; }
.kpi.k-red .kpi-ic{background:linear-gradient(135deg,#e23b52,#c8102e);}
.kpi.k-blue .kpi-ic{background:linear-gradient(135deg,#4f9be8,#2b7fd4);}
.kpi.k-green .kpi-ic{background:linear-gradient(135deg,#38c98a,#1a9d6a);}
.kpi.k-amber .kpi-ic{background:linear-gradient(135deg,#f2b544,#e8a400);}
.kpi.k-purple .kpi-ic{background:linear-gradient(135deg,#9b7bea,#6f4fd1);}
.kpi.k-slate .kpi-ic{background:linear-gradient(135deg,#5c6580,#3a4157);}

/* ---------- Buttons ---------- */
.btn { font-size: 13px; border-radius: var(--radius-sm); font-weight: 600; }
.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-brand:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-soft { background: var(--brand-soft); color: var(--brand); border: 1px solid transparent; }
.btn-soft:hover { background: var(--brand); color: #fff; }
.btn-icon { display:inline-flex; align-items:center; gap:7px; }

/* ---------- Tables / DataTables ---------- */
table.dataTable { border-collapse: collapse !important; }
table.dataTable thead th { background: #f7f9fc; color: var(--ink); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; border-bottom: 2px solid var(--line) !important; }
table.dataTable tbody td { font-size: 13.5px; vertical-align: middle; }
table.dataTable tbody tr:hover { background: #fafbfe; }
.dt-buttons .btn { margin-right: 4px; }
.dataTables_wrapper .dataTables_filter input { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 10px; }
.dataTables_wrapper .dataTables_length select { border-radius: var(--radius-sm); }
div.dt-button-collection { z-index: 2000; }
.badge-soft { padding: 4px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.badge-ok { background: #e3f6ee; color: var(--ok); }
.badge-warn { background: #fdf3dc; color: #b3820b; }
.badge-danger { background: #fbe4e4; color: var(--danger); }
.badge-info { background: #e5f0fb; color: var(--info); }
.row-actions { display: flex; gap: 6px; }
.row-actions .btn { padding: 4px 9px; font-size: 12px; line-height: 1.2; }

/* ---------- Forms in modals ---------- */
.form-label { font-weight: 600; font-size: 12.5px; color: var(--ink); margin-bottom: 4px; }
.modal-title { font-weight: 700; }
.modal-content { border: none; border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.modal-header { background: var(--brand); color: #fff; border-radius: var(--radius) var(--radius) 0 0; }
.modal-header .close { color: #fff; opacity: .9; text-shadow: none; }
.detail-list { margin: 0; }
.detail-list dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-soft); font-weight: 700; margin-top: 12px; }
.detail-list dd { font-size: 14px; margin: 2px 0 0; color: var(--ink); }

/* ---------- Select2 tweak ---------- */
.select2-container--default .select2-selection--single { height: 38px; border: 1px solid #ced4da; border-radius: var(--radius-sm); }
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 36px; }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 36px; }

/* ---------- Overlay for mobile sidebar ---------- */
.sidebar-overlay { display:none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1035; }

/* ---------- Responsive ---------- */
@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-overlay { display: block; }
  .main { margin-left: 0; }
  .topbar .burger { display: inline-block; }
}
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main { margin-left: 0; }
  .content { padding: 0; }
}

/* ============================================================
   Page de connexion
   ============================================================ */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; }
.login-hero {
  position: relative; color: #fff; display: flex; flex-direction: column; justify-content: space-between;
  padding: 46px 52px;
  background: linear-gradient(160deg, rgba(20,25,38,.86), rgba(158,12,34,.86)), center/cover no-repeat url('../../images/care_gag.JPG');
}
.login-hero .lh-top { display:flex; align-items:center; gap:14px; }
.login-hero .lh-top img { width: 52px; height: 52px; border-radius: 12px; background:#fff; padding:4px;}
.login-hero .lh-top b { font-size: 22px; letter-spacing:.5px; font-style: italic;}
.login-hero h2 { font-size: 34px; font-weight: 800; line-height: 1.15; margin: 0 0 14px; max-width: 460px; }
.login-hero p { font-size: 15px; color: rgba(255,255,255,.85); max-width: 440px; }
.login-hero .lh-foot { font-size: 12.5px; color: rgba(255,255,255,.7); }
.login-hero .lh-badges { display:flex; gap:22px; margin-top:20px;}
.login-hero .lh-badges div { font-size:13px; }
.login-hero .lh-badges b { font-size:22px; display:block; }

.login-form-side { display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--content-bg); }
.login-card { width: 100%; max-width: 380px; }
.login-card h1 { font-size: 24px; font-weight: 800; margin: 0 0 6px; }
.login-card .muted { color: var(--ink-soft); margin-bottom: 26px; }
.login-card .form-group { margin-bottom: 18px; }
.login-card label { font-weight: 600; font-size: 13px; }
.login-card .input-ic { position: relative; }
.login-card .input-ic i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-soft); }
.login-card .input-ic input { padding-left: 40px; height: 46px; border-radius: 10px; }
.login-card .btn-brand { height: 46px; border-radius: 10px; font-size: 15px; font-weight: 700; }
@media (max-width: 900px) { .login-wrap { grid-template-columns: 1fr; } .login-hero { display: none; } }
