/* ═══════════════════════════════════════════════════════════
   AMBRA Transport 2026 — Design système
   Base : Bootstrap 5.3  +  Bootstrap Icons
   Palette : Ardoise foncée / Ambre / Blanc
═══════════════════════════════════════════════════════════ */

/* ─── Variables ────────────────────────────────────────────── */
:root {
  --brand:        #E8A020;        /* ambre */
  --brand-dark:   #C4841A;
  --brand-light:  #FDE8B8;
  --sidebar-bg:   #1A1F2E;
  --sidebar-w:    230px;
  --sidebar-text: #B8BDD0;
  --topbar-h:     56px;
  --radius:       8px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.08);
  --shadow:       0 2px 8px rgba(0,0,0,.12);
}

/* ─── Reset & base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  background: #F4F5F7;
  color: #2D3142;
  margin: 0;
}

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

/* ─── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  transition: transform .25s ease;
}

.sidebar-logo {
  padding: 18px 20px 14px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo .logo-icon {
  width: 32px; height: 32px;
  background: var(--brand);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: #fff;
  flex-shrink: 0;
}
.sidebar-logo .logo-text {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  letter-spacing: .3px;
}
.sidebar-logo .logo-sub {
  font-size: 11px;
  color: var(--sidebar-text);
}

.sidebar-section {
  padding: 14px 12px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .8px;
  color: #5A6080;
  text-transform: uppercase;
}

.sidebar-nav { padding: 0 8px; flex: 1; }

.nav-item { margin-bottom: 1px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius);
  color: var(--sidebar-text) !important;
  text-decoration: none;
  font-size: 13.5px;
  transition: background .15s, color .15s;
}
.nav-link i { font-size: 15px; flex-shrink: 0; opacity: .75; }
.nav-link:hover  { background: rgba(255,255,255,.06); color: #fff !important; }
.nav-link:hover i { opacity: 1; }
.nav-link.active { background: rgba(232,160,32,.15); color: var(--brand) !important; }
.nav-link.active i { opacity: 1; color: var(--brand); }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.sidebar-footer .nav-link { font-size: 12.5px; }

/* ─── Main area ─────────────────────────────────────────────── */
.main-area {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── Topbar ────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid #E8EAF0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0;
  z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-title { font-size: 15px; font-weight: 600; color: #2D3142; }
.topbar-breadcrumb {
  font-size: 12px; color: #8B90A7;
  display: flex; align-items: center; gap: 4px;
}
.topbar-breadcrumb a { color: inherit; text-decoration: none; }
.topbar-breadcrumb a:hover { color: var(--brand); }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-badge {
  background: #FDE8B8; color: #C4841A;
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px; font-weight: 500;
  display: flex; align-items: center; gap: 5px;
}
.topbar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px;
  border-radius: 20px;
  background: #F4F5F7;
  font-size: 12.5px; font-weight: 500; color: #2D3142;
  cursor: default;
}
.topbar-avatar {
  width: 26px; height: 26px;
  background: var(--brand);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
}

/* ─── Content ───────────────────────────────────────────────── */
.page-content { padding: 20px 24px 40px; flex: 1; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.page-header h1 {
  font-size: 20px;
  font-weight: 700;
  color: #1A1F2E;
  margin: 0;
}

/* ─── Cards ─────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid #E8EAF0;
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid #F0F1F5;
  display: flex; align-items: center; justify-content: space-between;
  background: transparent;
  border-radius: 10px 10px 0 0;
}
.card-header h5, .card-header h6 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #1A1F2E;
}
.card-body { padding: 16px 18px; }

/* ─── Stats cards ───────────────────────────────────────────── */
.stat-card {
  background: #fff;
  border: 1px solid #E8EAF0;
  border-radius: 10px;
  padding: 16px 20px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow-sm);
}
.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-icon.amber  { background: #FDE8B8; color: #C4841A; }
.stat-icon.blue   { background: #DBEAFE; color: #1D4ED8; }
.stat-icon.green  { background: #DCFCE7; color: #15803D; }
.stat-icon.red    { background: #FEE2E2; color: #B91C1C; }
.stat-icon.purple { background: #EDE9FE; color: #6D28D9; }
.stat-icon.teal   { background: #CCFBF1; color: #0F766E; }
.stat-icon.orange { background: #FFEDD5; color: #C2410C; }
.stat-label { font-size: 12px; color: #8B90A7; margin-bottom: 2px; }
.stat-value { font-size: 22px; font-weight: 700; color: #1A1F2E; line-height: 1; }
.stat-sub   { font-size: 11.5px; color: #8B90A7; margin-top: 2px; }

/* ─── Tableaux ──────────────────────────────────────────────── */
.table-card {
  background: #fff;
  border: 1px solid #E8EAF0;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.table { margin: 0; }
.table thead th {
  background: #F8F9FB;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #6B7280;
  border-bottom: 1px solid #E8EAF0;
  padding: 10px 14px;
  white-space: nowrap;
}
.table tbody td {
  padding: 10px 14px;
  vertical-align: middle;
  font-size: 13.5px;
  color: #2D3142;
  border-bottom: 1px solid #F4F5F7;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #FAFBFC; }

/* ─── Filtres ───────────────────────────────────────────────── */
.filter-bar {
  background: #fff;
  border: 1px solid #E8EAF0;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 14px;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  box-shadow: var(--shadow-sm);
}
.filter-bar .form-label { font-size: 11.5px; font-weight: 600; color: #6B7280; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .3px; }
.filter-bar .form-control, .filter-bar .form-select {
  font-size: 13px; padding: 5px 10px; height: 34px;
}

/* ─── Formulaires ───────────────────────────────────────────── */
.form-label { font-size: 12.5px; font-weight: 600; color: #4B5563; margin-bottom: 5px; }
.form-control, .form-select {
  font-size: 13.5px;
  border-color: #D1D5DB;
  border-radius: var(--radius);
  padding: 7px 12px;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(232,160,32,.15);
}
.form-section {
  border-top: 1px solid #E8EAF0;
  padding-top: 16px;
  margin-top: 16px;
}
.form-section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #9CA3AF;
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.form-section-title::after {
  content: ''; flex: 1;
  height: 1px; background: #E8EAF0;
}

/* ─── Boutons ───────────────────────────────────────────────── */
.btn { font-size: 13px; font-weight: 500; border-radius: var(--radius); padding: 7px 16px; }
.btn-sm { font-size: 12px; padding: 4px 10px; }
.btn-xs { font-size: 11px; padding: 3px 8px; }
.btn-brand { background: var(--brand); color: #fff; border: none; }
.btn-brand:hover { background: var(--brand-dark); color: #fff; }
.btn-outline-brand { border: 1.5px solid var(--brand); color: var(--brand); background: transparent; }
.btn-outline-brand:hover { background: var(--brand); color: #fff; }
.btn-icon { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius); }

/* ─── Badges ────────────────────────────────────────────────── */
.badge-actif    { background:#DCFCE7; color:#15803D; font-size:11px; padding:3px 8px; border-radius:12px; font-weight:500; }
.badge-inactif  { background:#F3F4F6; color:#6B7280; font-size:11px; padding:3px 8px; border-radius:12px; font-weight:500; }
.badge-warning  { background:#FEF3C7; color:#92400E; font-size:11px; padding:3px 8px; border-radius:12px; font-weight:500; }
.badge-danger   { background:#FEE2E2; color:#B91C1C; font-size:11px; padding:3px 8px; border-radius:12px; font-weight:500; }
.badge-info     { background:#DBEAFE; color:#1E40AF; font-size:11px; padding:3px 8px; border-radius:12px; font-weight:500; }
.badge-interne  { background:#EDE9FE; color:#5B21B6; font-size:11px; padding:3px 8px; border-radius:12px; font-weight:500; }

/* ─── Montants ──────────────────────────────────────────────── */
.amount      { font-weight: 600; font-variant-numeric: tabular-nums; }
.amount-pos  { color: #15803D; }
.amount-neg  { color: #B91C1C; }
.amount-zero { color: #9CA3AF; }

/* ─── Alertes flash ─────────────────────────────────────────── */
.flash-container { position: fixed; top: 70px; right: 20px; z-index: 9999; min-width: 280px; max-width: 380px; }
.flash-msg {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow);
  animation: slideIn .2s ease;
}
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.flash-success { background: #ECFDF5; border-left: 3px solid #22C55E; color: #15803D; }
.flash-error   { background: #FEF2F2; border-left: 3px solid #EF4444; color: #B91C1C; }
.flash-warning { background: #FFFBEB; border-left: 3px solid #F59E0B; color: #92400E; }
.flash-info    { background: #EFF6FF; border-left: 3px solid #3B82F6; color: #1E40AF; }

/* ─── Fiche détail ──────────────────────────────────────────── */
.detail-row {
  display: flex;
  padding: 8px 0;
  border-bottom: 1px solid #F4F5F7;
  align-items: baseline;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { min-width: 160px; font-size: 12px; font-weight: 600; color: #6B7280; text-transform: uppercase; letter-spacing: .3px; }
.detail-value { font-size: 13.5px; color: #2D3142; }

/* ─── Tabs ──────────────────────────────────────────────────── */
.tabs-bar {
  display: flex; gap: 2px;
  border-bottom: 2px solid #E8EAF0;
  margin-bottom: 20px;
}
.tab-btn {
  padding: 8px 18px;
  font-size: 13px; font-weight: 500;
  color: #6B7280;
  background: none; border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
  display: flex; align-items: center; gap: 6px;
}
.tab-btn.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab-btn:hover  { color: #2D3142; }

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .main-area { margin-left: 0; }
}

/* ─── Login page ────────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  background: #fff;
  border-radius: 14px;
  padding: 40px 36px;
  width: 100%; max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo .icon {
  width: 56px; height: 56px;
  background: var(--brand);
  border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 24px; color: #fff; font-weight: 700;
  margin-bottom: 12px;
}
.login-logo h4 { font-size: 18px; font-weight: 700; color: #1A1F2E; margin: 0 0 4px; }
.login-logo p  { font-size: 13px; color: #8B90A7; margin: 0; }

/* ─── Utilitaires ───────────────────────────────────────────── */
.text-muted-sm { font-size: 12px; color: #9CA3AF; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.border-dashed { border-style: dashed !important; }
.cursor-pointer { cursor: pointer; }
.w-auto { width: auto !important; }
.nowrap { white-space: nowrap; }
