/* ============================================================
   CarRent Pro - Premium Dark Theme
   Dark Navy + Gold Accent
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Barlow:wght@400;500;600;700;800;900&display=swap');

/* ── CSS Variables ──────────────────────────────────────── */
:root {
  --navy-900:  #0a0e1a;
  --navy-800:  #0f1627;
  --navy-700:  #152035;
  --navy-600:  #1a2a45;
  --navy-500:  #243556;
  --navy-400:  #2e4268;

  --gold-500:  #c9963a;
  --gold-400:  #d4a84b;
  --gold-300:  #e2bf6e;
  --gold-200:  #f0d89a;
  --gold-glow: rgba(201,150,58,0.25);

  --white:     #ffffff;
  --gray-100:  #f0f2f7;
  --gray-200:  #d8dce8;
  --gray-400:  #9099b5;
  --gray-600:  #5a6280;

  --success:   #22c55e;
  --warning:   #f59e0b;
  --danger:    #ef4444;
  --info:      #3b82f6;

  --sidebar-w: 260px;
  --topbar-h:  64px;
  --radius:    10px;
  --radius-lg: 16px;
  --shadow:    0 4px 24px rgba(0,0,0,0.35);
  --shadow-sm: 0 2px 10px rgba(0,0,0,0.25);

  --font-display: 'Barlow', 'Inter', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, sans-serif;
}

/* ── Reset & Base ───────────────────────────────────────── */
.chart-container{
  height:320px;
  position:relative;
}

canvas{
  display:block;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background:  var(--bg-body);
  color:       var(--text-primary);
  font-size:   14px;
  line-height: 1.6;
  min-height:  100vh;
  overflow-x:  hidden;
}

a { color: var(--gold-400); text-decoration: none; transition: color .2s; }
a:hover { color: var(--gold-300); }

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
  position:   fixed;
  top: 0; left: 0; bottom: 0;
  width:      var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-sidebar);
  display:    flex;
  flex-direction: column;
  z-index:    1000;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}


.sidebar-brand {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-divider);
  display: block;
  text-align: center;
}

.brand-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--gold-500), var(--gold-300));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  box-shadow: 0 0 20px var(--gold-glow);
}

.brand-text {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.1;
}
.brand-sub {
  font-size: 10px;
  color: var(--gold-400);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--bg-nav-hover); border-radius: 2px; }

.nav-section-title {
  padding: 12px 20px 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
}


/* Orange (Maintenance) */
.nav-badge-warning {
  background: #f59e0b;
  color: #111;
}



/* 1. L-link l-3adi (Gris) */
.nav-item .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: #8a8a8a !important; 
  border-radius: 0;
  transition: all .2s;
  font-size: 13.5px;
  font-weight: 400;
  position: relative;
  text-decoration: none;
  justify-content: flex-start; /* Text ib9a l-liser */
}

/* Span dial l-text bach ib9a f blastu */
.nav-item .nav-link .nav-link-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 2. Fach kat-dir hover (Mouse) */
.nav-item .nav-link:hover {
  color: var(--text-heading) !important;
  background: var(--bg-nav-hover);
}

/* 3. L-link li "Active" (Gold) */
.nav-item .nav-link.active {
  color: var(--gold-400) !important; /* Hadchi li ghadi i-tla3 f Voitures */
  background: rgba(201,150,58,0.1);
  border-right: 3px solid var(--gold-500);
}

/* 4. Force l-lon dial l-icons (SVG) */
.nav-item .nav-link svg {
  color: #8a8a8a; /* Icon gris f l-awal */
}

.nav-item .nav-link.active svg {
  color: var(--gold-400); /* Icon gold ila kant active */
}
.nav-item .nav-link.active svg,
.nav-item .nav-link:hover svg { color: inherit; }
.nav-link svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  font-size: 10px; font-weight: 700;
  padding: 1px 7px; border-radius: 10px;
  line-height: 1.6; flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-divider);
}
.user-card {
  display: flex; align-items: center; gap: 10px;
}
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-500), var(--gold-300));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: var(--bg-body);
}
.user-name { font-size: 13px; font-weight: 500; color: var(--text-heading); }
.user-role { font-size: 11px; color: var(--text-secondary); }

/* ── Main Layout ────────────────────────────────────────── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin .3s;
}

.topbar {
  height: var(--topbar-h);
  background: var(--bg-sidebar);
  border-bottom: 1px solid rgba(201,150,58,0.12);
  display: flex; align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky; top: 0; z-index: 900;
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--text-heading);
  font-weight: 600;
  flex: 1;
}

.topbar-btn {
  background: transparent;
  border: 1px solid rgba(201,150,58,0.25);
  color: var(--text-secondary);
  border-radius: var(--radius);
  padding: 7px 12px;
  cursor: pointer;
  transition: all .2s;
  display: flex; align-items: center; gap: 6px;
  font-size: 13px;
}
.topbar-btn:hover {
  border-color: var(--gold-400);
  color: var(--gold-400);
}

.sidebar-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  cursor: pointer;
  padding: 6px;
}

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

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

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border-card);
  padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between;
}

.card-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-heading);
  margin: 0;
}

.card-body { padding: 20px; }

/* ── Stat Cards ─────────────────────────────────────────── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: transform .2s, box-shadow .2s;
  position: relative;
  overflow: hidden;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--accent-color, rgba(201,150,58,0.1));
  transform: translate(20px,-20px);
}

.stat-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
  background: var(--accent-color, rgba(201,150,58,0.15));
}
.stat-icon svg { width: 22px; height: 22px; color: var(--accent-text, var(--gold-400)); }
.stat-value {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 28px; font-weight: 800; color: var(--text-heading);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; text-transform: uppercase; letter-spacing: 1px; }
.stat-change { font-size: 12px; margin-top: 8px; color: var(--success); }

/* ── Tables ─────────────────────────────────────────────── */
.table-dark-custom {
  color: var(--text-primary);
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.table-dark-custom thead th {
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-modal);
  white-space: nowrap;
}
.table-dark-custom tbody tr {
  border-bottom: 1px solid var(--border-table);
  transition: background .15s;
}
.table-dark-custom tbody tr:hover { background: var(--bg-table-hover); }
.table-dark-custom td {
  padding: 13px 16px;
  vertical-align: middle;
  font-size: 13.5px;
}
.table-dark-custom thead th:first-child { border-radius: 8px 0 0 0; }
.table-dark-custom thead th:last-child  { border-radius: 0 8px 0 0; }

/* ── Forms ──────────────────────────────────────────────── */
.form-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control, .form-select {
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  color: var(--text-heading);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 14px;
  transition: border-color .2s, box-shadow .2s;
}
.form-control:focus, .form-select:focus {
  background: var(--bg-input);
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px var(--gold-glow);
  color: var(--text-heading);
  outline: none;
}
.form-control::placeholder { color: var(--text-muted); }
.form-select option { background: var(--bg-card); color: var(--text-heading); }

.form-text { color: var(--text-muted); font-size: 12px; }

textarea.form-control { resize: vertical; min-height: 80px; }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  padding: 9px 18px;
  transition: all .2s;
  display: inline-flex; align-items: center; gap: 7px;
  cursor: pointer;
}
.btn svg { width: 15px; height: 15px; }

.btn-gold {
  background: linear-gradient(135deg, var(--gold-500), var(--gold-400));
  border: none;
  color: var(--bg-body);
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(201,150,58,0.35);
}
.btn-gold:hover {
  background: linear-gradient(135deg, var(--gold-400), var(--gold-300));
  color: var(--bg-body);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(201,150,58,0.45);
}

.btn-outline-gold {
  background: transparent;
  border: 1px solid var(--gold-500);
  color: var(--gold-400);
}
.btn-outline-gold:hover {
  background: var(--gold-500);
  color: var(--bg-body);
}

.btn-outline-light {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text-primary);
}
.btn-outline-light:hover {
  background: var(--bg-table-hover);
  color: var(--text-heading);
  border-color: rgba(255,255,255,0.25);
}

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-sm svg { width: 13px; height: 13px; }

.btn-danger-soft {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.3);
  color: #f87171;
}
.btn-danger-soft:hover { background: rgba(239,68,68,0.2); color: #fca5a5; }

.btn-success-soft {
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.25);
  color: #4ade80;
}
.btn-success-soft:hover { background: rgba(34,197,94,0.18); }

.btn-info-soft {
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.25);
  color: #60a5fa;
}
.btn-info-soft:hover { background: rgba(59,130,246,0.18); }

/* ── Badges ─────────────────────────────────────────────── */
.badge {
  font-size: 11px; font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: .3px;
}
.bg-success { background: #16a34a !important; color: #ffffff !important; border: none; box-shadow: 0 2px 6px rgba(22,163,74,0.45); }
.bg-warning  { background: #d97706 !important; color: #ffffff !important; border: none; box-shadow: 0 2px 6px rgba(217,119,6,0.45); }
.bg-danger   { background: #dc2626 !important; color: #ffffff !important; border: none; box-shadow: 0 2px 6px rgba(220,38,38,0.45); }
.bg-primary  { background: rgba(59,130,246,0.15) !important; color: #60a5fa !important; border: 1px solid rgba(59,130,246,0.25); }
.bg-info     { background: rgba(6,182,212,0.15) !important; color: #22d3ee !important; border: 1px solid rgba(6,182,212,0.25); }
.bg-secondary{ background: rgba(90,98,128,0.3) !important; color: var(--text-secondary) !important; border: 1px solid rgba(90,98,128,0.3); }
.text-dark   { color: var(--bg-body) !important; }

/* ── Alerts ─────────────────────────────────────────────── */
.alert {
  border-radius: var(--radius);
  border: none;
  font-size: 13.5px;
  padding: 12px 16px;
}
.alert-success { background: rgba(34,197,94,0.12); color: #4ade80; border-left: 3px solid #22c55e; }
.alert-error, .alert-danger { background: rgba(239,68,68,0.12); color: #f87171; border-left: 3px solid #ef4444; }
.alert-warning { background: rgba(245,158,11,0.12); color: #fbbf24; border-left: 3px solid #f59e0b; }
.alert-info { background: rgba(59,130,246,0.12); color: #60a5fa; border-left: 3px solid #3b82f6; }
.btn-close { filter: invert(1) opacity(.6); }

/* ── Modals ─────────────────────────────────────────────── */
.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 60px rgba(0,0,0,0.6);
}
.modal-header {
  border-bottom: 1px solid var(--border-modal);
  padding: 18px 24px;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--text-heading);
}
.modal-body { padding: 24px; }
.modal-footer {
  border-top: 1px solid var(--border-modal);
  padding: 16px 24px;
}
.modal-backdrop { background: rgba(0,0,0,0.6); }

/* ── Pagination ─────────────────────────────────────────── */
.page-link {
  background: var(--bg-input);
  border-color: var(--border-input);
  color: var(--text-secondary);
  font-size: 12px;
}
.page-link:hover { background: var(--bg-nav-hover); color: var(--gold-400); border-color: var(--gold-500); }
.page-item.active .page-link { background: var(--gold-500); border-color: var(--gold-500); color: #ffffff; font-weight: 600; }
.page-item.disabled .page-link { background: var(--bg-sidebar); color: var(--text-muted); }

/* ── Car Image ──────────────────────────────────────────── */
.car-thumb {
  width: 52px; height: 36px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border-input);
}
.car-thumb-placeholder {
  width: 52px; height: 36px;
  border-radius: 6px;
  background: var(--bg-nav-hover);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: 18px;
}

/* ── Section Header ─────────────────────────────────────── */
.section-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.section-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-heading);
  margin: 0;
}
.section-subtitle { font-size: 13px; color: var(--text-secondary); margin: 2px 0 0; }

/* ── Search & Filter Bar ────────────────────────────────── */
.filter-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 20px;
}

/* ── Login Page ─────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  background: var(--bg-body);
  position: relative;
  overflow: hidden;
}
.login-bg-decor {
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201,150,58,0.08) 0%, transparent 70%);
  top: -200px; right: -200px;
  pointer-events: none;
}
.login-bg-decor2 {
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(30,58,138,0.3) 0%, transparent 70%);
  bottom: -100px; left: -100px;
  pointer-events: none;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid rgba(201,150,58,0.2);
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%; max-width: 420px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
  position: relative; z-index: 10;
}
.login-logo {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--gold-500), var(--gold-300));
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  margin-bottom: 24px;
  box-shadow: 0 0 30px var(--gold-glow);
}


/* ── Dashboard Specific ─────────────────────────────────── */
.recent-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-table);
}
.recent-item:last-child { border-bottom: none; }

/* ── Invoice Preview ────────────────────────────────────── */
.invoice-preview {
  background: white;
  color: #1a1a2e;
  padding: 40px;
  border-radius: var(--radius);
  font-family: var(--font-body);
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 1100;
    transition: transform .25s cubic-bezier(.4,0,.2,1);
  }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .sidebar-toggle { display: flex !important; }
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 1050;
    backdrop-filter: blur(2px);
  }
  .sidebar-overlay.show { display: block; }
  .page-content { padding: 14px 12px; }
  .topbar { padding: 0 14px; }
  .stat-value { font-size: 22px; }
  .topbar-title { font-size: 16px; }

  /* Tables on tablet */
  .table-dark-custom th, .table-dark-custom td { padding: 10px 10px; }
}

@media (max-width: 767.98px) {
  /* Cards stack nicely */
  .row.g-3 > [class*='col-lg'] { margin-bottom: 0; }

  /* Smaller page title */
  .section-title { font-size: 18px; }
  .section-subtitle { font-size: 12px; }

  /* Section header wraps */
  .section-header { flex-wrap: wrap; gap: 10px; }
  .section-header .btn { width: 100%; justify-content: center; }

  /* KPI grid on mobile */
  .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
  .kpi { padding: 14px 14px 12px; }
  .kpi-val { font-size: 22px; }
  .kpi-val.sm { font-size: 17px; }
  .kpi-lbl { font-size: 10px; }

  /* Dashboard main: single column on mobile */
  .dash-main { grid-template-columns: 1fr !important; }

  /* Filter bars */
  .filter-bar .row { gap: 8px; }
  .filter-bar .col-md-4, .filter-bar .col-md-3, .filter-bar .col-md-2 { width: 100%; }

  /* Forms */
  .card-body .row.g-3 > .col-md-6,
  .card-body .row.g-3 > .col-md-4,
  .card-body .row.g-3 > .col-md-3 { width: 100%; }
}

@media (max-width: 575.98px) {
  .page-content { padding: 10px 10px; }
  .topbar { height: 54px; }
  .topbar-title { font-size: 15px; }

  /* Section header */
  .section-header { flex-direction: column; align-items: flex-start; gap: 8px; }

  /* Tables: hide less important columns */
  .table-responsive { font-size: 11px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-dark-custom th, .table-dark-custom td { padding: 8px 8px; white-space: nowrap; }

  /* Buttons */
  .btn { font-size: 12px; padding: 7px 12px; }
  .btn-sm { font-size: 11px; padding: 4px 10px; }

  /* Cards */
  .card-body { padding: 14px; }
  .card-header { padding: 12px 14px; }

  /* KPI: single column on very small screens? No, 2 is fine */
  .kpi { padding: 12px 12px 10px; border-radius: 10px; }
  .kpi-icon { width: 32px; height: 32px; border-radius: 8px; margin-bottom: 10px; }
  .kpi-icon svg { width: 15px; height: 15px; }
  .kpi-val { font-size: 20px; }
  .kpi-val.sm { font-size: 15px; }

  /* Stat cards (legacy) */
  .stat-card { padding: 14px; border-radius: 10px; }
  .stat-value { font-size: 20px; }
  .stat-label { font-size: 10px; letter-spacing: 0.6px; }
  .stat-icon { width: 36px; height: 36px; margin-bottom: 12px; }

  /* Tables hide extra cols */
  .hide-xs { display: none !important; }

  /* Quick link row wraps */
  .ql-row { gap: 6px; }
  .ql { font-size: 11px; padding: 5px 9px; }

  /* Reservation view page */
  .res-grid-2 { grid-template-columns: 1fr !important; }

  /* Login page */
  .login-card { padding: 24px 20px; margin: 10px; }
}

/* Touch improvements */
@media (hover: none) and (pointer: coarse) {
  .res-bar { padding: 5px 8px; font-size: 11.5px; }
  .btn { min-height: 38px; }
  .btn-sm { min-height: 32px; }
  .sidebar-nav .nav-link { padding: 13px 18px; }
}

/* ── Utility ────────────────────────────────────────────── */
.text-gold  { color: var(--gold-400) !important; }
.text-muted { color: var(--text-secondary) !important; }
.divider    { border-color: var(--border-table); }

.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.fade-in { animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.gold-rule {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold-500), transparent);
  opacity: .4;
  margin: 20px 0;
}
