/* ═══════════════════════════════════════════════════════════════════════════
   NEW SEMENCE VBS — Feuille de style principale
   Palette : Vert #1a6b3c | Jaune/Or #f5a623 | Noir #111 | Blanc #fff
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Variables ────────────────────────────────────────────────────────────── */
:root {
  --ns-primary:        #1a6b3c;
  --ns-primary-dark:   #0d3d22;
  --ns-primary-light:  #2d9b60;
  --ns-accent:         #f5a623;
  --ns-accent-dark:    #d4871a;
  --ns-sidebar-bg:     #0f2518;
  --ns-sidebar-width:  260px;
  --ns-topbar-h:       64px;
  --ns-text:           #212529;
  --ns-text-muted:     #6c757d;
  --ns-border:         #dee2e6;
  --ns-bg-body:        #f0f4f0;
  --ns-card-bg:        #ffffff;
  --ns-shadow:         0 2px 12px rgba(0,0,0,.08);
  --ns-shadow-hover:   0 6px 24px rgba(0,0,0,.14);
  --ns-radius:         .75rem;
  --ns-transition:     all .25s ease;
}

[data-bs-theme="dark"] {
  --ns-bg-body:   #0e1a0e;
  --ns-card-bg:   #1a2b1a;
  --ns-text:      #e8f0e8;
  --ns-border:    #2d4a2d;
  --ns-shadow:    0 2px 12px rgba(0,0,0,.4);
  --ns-sidebar-bg: #081208;
}

/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--ns-bg-body);
  color: var(--ns-text);
  overflow-x: hidden;
}

a { color: var(--ns-primary); }
a:hover { color: var(--ns-primary-light); }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--ns-sidebar-width);
  height: 100vh;
  background: var(--ns-sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: var(--ns-transition);
  overflow: hidden;
}

.main-wrapper {
  margin-left: var(--ns-sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: var(--ns-transition);
}

/* ── Sidebar Brand ────────────────────────────────────────────────────────── */
.sidebar-brand {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: var(--ns-topbar-h);
  background: linear-gradient(135deg, #0d2414, #1a6b3c55);
}

.sidebar-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: .5rem;
}

.sidebar-brand-text .brand-main {
  display: block;
  font-weight: 800;
  font-size: .95rem;
  color: #fff;
  letter-spacing: .04em;
  line-height: 1.2;
}

.sidebar-brand-text .brand-sub {
  display: block;
  font-size: .7rem;
  color: var(--ns-accent);
  text-transform: uppercase;
  letter-spacing: .08em;
}

/* ── Sidebar Navigation ───────────────────────────────────────────────────── */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: .75rem 0;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

.sidebar-nav .nav-section-title {
  padding: .6rem 1.25rem .25rem;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.35);
  list-style: none;
  margin-top: .5rem;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 1.25rem;
  color: rgba(255,255,255,.7);
  font-size: .875rem;
  font-weight: 500;
  border-radius: 0;
  transition: var(--ns-transition);
  position: relative;
}

.sidebar-nav .nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,.07);
}

.sidebar-nav .nav-link.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(26,107,60,.8) 0%, rgba(26,107,60,.3) 100%);
  border-left: 3px solid var(--ns-accent);
}

.nav-icon {
  width: 18px;
  text-align: center;
  font-size: .9rem;
  opacity: .85;
  flex-shrink: 0;
}

/* ── Sidebar Footer ───────────────────────────────────────────────────────── */
.sidebar-footer {
  padding: .75rem;
  border-top: 1px solid rgba(255,255,255,.08);
}

.sidebar-footer .nav-link {
  border-radius: var(--ns-radius);
  padding: .5rem .75rem;
  gap: .75rem;
  font-size: .875rem;
}

/* ── Sidebar Overlay (mobile) ─────────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1039;
}

/* ── Topbar ───────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  height: var(--ns-topbar-h);
  background: var(--ns-card-bg);
  border-bottom: 1px solid var(--ns-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.topbar-search {
  width: 280px;
}

.topbar-search .form-control {
  border-right: none;
}

.topbar-search .btn {
  background: var(--ns-primary);
  border-color: var(--ns-primary);
  color: #fff;
}

/* ── Breadcrumb ───────────────────────────────────────────────────────────── */
.breadcrumb { font-size: .8rem; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--ns-border);
  background: transparent;
  color: var(--ns-text);
  transition: var(--ns-transition);
}

.btn-icon:hover { background: var(--ns-bg-body); }

.btn-success {
  background-color: var(--ns-primary) !important;
  border-color: var(--ns-primary) !important;
}
.btn-success:hover {
  background-color: var(--ns-primary-dark) !important;
  border-color: var(--ns-primary-dark) !important;
}

.sidebar-toggle {
  border: none;
  background: transparent;
  font-size: 1.2rem;
  color: var(--ns-text-muted);
  padding: .25rem .5rem;
}

/* ── Content Area ─────────────────────────────────────────────────────────── */
.content-area {
  flex: 1;
  padding: 1.5rem;
  max-width: 100%;
}

.flash-container { margin-bottom: 1rem; }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.app-footer {
  padding: .75rem 1.5rem;
  border-top: 1px solid var(--ns-border);
  background: var(--ns-card-bg);
  font-size: .8rem;
  color: var(--ns-text-muted);
  text-align: center;
}

/* ── Page Header ──────────────────────────────────────────────────────────── */
.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ns-text);
  margin-bottom: .25rem;
}

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--ns-card-bg);
  border: 1px solid var(--ns-border);
  border-radius: var(--ns-radius);
  box-shadow: var(--ns-shadow);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--ns-border);
  padding: .875rem 1.25rem;
  font-size: .95rem;
}

/* ── Stat Cards ───────────────────────────────────────────────────────────── */
.stat-card {
  background: var(--ns-card-bg);
  border-radius: var(--ns-radius);
  padding: 1.25rem;
  box-shadow: var(--ns-shadow);
  border: 1px solid var(--ns-border);
  transition: var(--ns-transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px;
  height: 100%;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--ns-shadow-hover);
}

.stat-card-green::before { background: var(--ns-primary); }
.stat-card-yellow::before { background: var(--ns-accent); }
.stat-card-blue::before { background: #0d6efd; }
.stat-card-teal::before { background: #20c997; }

.stat-icon {
  font-size: 1.5rem;
  margin-bottom: .5rem;
}

.stat-card-green .stat-icon { color: var(--ns-primary); }
.stat-card-yellow .stat-icon { color: var(--ns-accent); }
.stat-card-blue .stat-icon { color: #0d6efd; }
.stat-card-teal .stat-icon { color: #20c997; }

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  color: var(--ns-text);
}

.stat-label {
  font-size: .8rem;
  color: var(--ns-text-muted);
  margin-top: .25rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.stat-link {
  font-size: .75rem;
  color: var(--ns-text-muted);
  text-decoration: none;
  display: inline-block;
  margin-top: .5rem;
}

.stat-link:hover { color: var(--ns-primary); }

/* ── Vehicle Status Badges ────────────────────────────────────────────────── */
.vehicle-status-badge {
  padding: 1rem;
  border-radius: var(--ns-radius);
}

.status-available {
  background: rgba(26,107,60,.1);
  color: var(--ns-primary);
}

.status-mission {
  background: rgba(245,166,35,.1);
  color: var(--ns-accent-dark);
}

/* ── Revenue Cards ────────────────────────────────────────────────────────── */
.revenue-mini-card {
  background: var(--ns-bg-body);
  border-radius: .5rem;
  padding: .75rem;
  text-align: center;
  border: 1px solid var(--ns-border);
}

.revenue-highlight {
  background: rgba(26,107,60,.08);
  border-color: rgba(26,107,60,.2);
}

.revenue-top {
  background: rgba(245,166,35,.08);
  border-color: rgba(245,166,35,.2);
}

.revenue-period {
  font-size: .7rem;
  color: var(--ns-text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
}

.revenue-amount {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--ns-primary);
}

/* ── Tables ───────────────────────────────────────────────────────────────── */
.table { font-size: .875rem; }
.table th { font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.table-dark th { background: #1a2b1a !important; }

/* ── Detail Items ─────────────────────────────────────────────────────────── */
.detail-item {
  display: flex;
  flex-direction: column;
  gap: .2rem;
}

.detail-label {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ns-text-muted);
  font-weight: 600;
}

.detail-value {
  font-size: .95rem;
  color: var(--ns-text);
}

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-label.required::after {
  content: ' *';
  color: #dc3545;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--ns-primary);
  box-shadow: 0 0 0 .2rem rgba(26,107,60,.2);
}

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge { font-weight: 600; }

/* ── Dark Mode ────────────────────────────────────────────────────────────── */
[data-bs-theme="dark"] .topbar,
[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .app-footer {
  background: var(--ns-card-bg);
  border-color: var(--ns-border);
}

[data-bs-theme="dark"] .table-dark th { background: #0e1e0e !important; }
[data-bs-theme="dark"] .revenue-mini-card { background: var(--ns-sidebar-bg); }
[data-bs-theme="dark"] .vehicle-status-badge.status-available { background: rgba(26,107,60,.2); }
[data-bs-theme="dark"] .vehicle-status-badge.status-mission { background: rgba(245,166,35,.2); }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.sidebar-open {
    transform: translateX(0);
    box-shadow: 6px 0 24px rgba(0,0,0,.3);
  }

  .sidebar-overlay.show {
    display: block;
  }

  .main-wrapper {
    margin-left: 0;
  }

  .topbar-search {
    width: 200px;
  }
}

@media (max-width: 575.98px) {
  .content-area { padding: 1rem .75rem; }
  .page-title { font-size: 1.3rem; }
  .topbar { padding: 0 .75rem; }
  .topbar-search { display: none !important; }
}

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.35); }

/* ── Notifications (V2) ───────────────────────────────────────────────────── */
.notification-menu {
  width: 340px;
  max-width: 90vw;
}

.notification-list {
  max-height: 380px;
  overflow-y: auto;
}

.notification-item { white-space: normal; }

.notif-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  flex-shrink: 0;
  background: var(--ns-bg-body);
}

.notif-icon-lg {
  width: 42px;
  height: 42px;
  border-radius: .75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* ── Bandelette statut facture (V2.1) ─────────────────────────────────────── */
.ribbon-wrapper {
  position: relative;
  overflow: hidden;
}

.ribbon {
  position: absolute;
  top: 22px;
  right: -42px;
  transform: rotate(45deg);
  width: 170px;
  text-align: center;
  padding: .35rem 0;
  color: #fff;
  font-weight: 700;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  box-shadow: 0 3px 10px rgba(0,0,0,.25);
  z-index: 5;
  pointer-events: none;
}

.ribbon-unpaid    { background: #dc3545; }
.ribbon-partial   { background: #e6a700; }
.ribbon-paid      { background: #1a9e4b; }
.ribbon-cancelled { background: #6c757d; }

/* ── Jauge carburant (V2.1) ───────────────────────────────────────────────── */
.fuel-gauge {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
}

.fuel-gauge .gauge-body {
  position: relative;
  width: 140px;
  height: 70px;
  overflow: hidden;
}

.fuel-gauge .gauge-arc {
  position: absolute;
  inset: 0;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  /* anneau gris de fond ; le remplissage coloré est appliqué inline via conic-gradient */
  background: conic-gradient(from -90deg, #e9ecef 0deg 180deg, transparent 180deg);
  -webkit-mask: radial-gradient(circle at 50% 50%, transparent 40px, #000 41px);
          mask: radial-gradient(circle at 50% 50%, transparent 40px, #000 41px);
}

.fuel-gauge .gauge-needle {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 4px;
  height: 58px;
  background: #212529;
  border-radius: 4px 4px 0 0;
  transform-origin: bottom center;
  transition: transform .6s cubic-bezier(.4, 2, .55, .9);
  z-index: 3;
}

[data-bs-theme="dark"] .fuel-gauge .gauge-needle { background: #e8f0e8; }

.fuel-gauge .gauge-pivot {
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #212529;
  z-index: 4;
}

[data-bs-theme="dark"] .fuel-gauge .gauge-pivot { background: #e8f0e8; }

.fuel-gauge .gauge-marks {
  position: absolute;
  inset: 0;
  font-size: .6rem;
  color: var(--ns-text-muted);
  font-weight: 700;
}

.fuel-gauge .gauge-marks .mark-e { position: absolute; bottom: 2px; left: 8px; }
.fuel-gauge .gauge-marks .mark-h { position: absolute; top: 2px; left: 50%; transform: translateX(-50%); }
.fuel-gauge .gauge-marks .mark-f { position: absolute; bottom: 2px; right: 8px; }

.fuel-gauge .gauge-value {
  font-weight: 800;
  font-size: 1.1rem;
  line-height: 1;
}

.fuel-gauge .gauge-label {
  font-size: .72rem;
  color: var(--ns-text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
}

/* Mini-barre carburant pour les tableaux */
.fuel-bar {
  min-width: 90px;
}

.fuel-bar .progress {
  height: 10px;
  border-radius: 5px;
}

.fuel-bar .fuel-bar-text {
  font-size: .7rem;
  font-weight: 600;
  color: var(--ns-text-muted);
  white-space: nowrap;
}

/* ── Print ────────────────────────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .app-footer, .btn, .sidebar-overlay { display: none !important; }
  .main-wrapper { margin-left: 0 !important; }
  .content-area { padding: 0 !important; }
}
