/* ═══════════════════════════════════════════
   FLEET PROFIT MANAGER — MAIN STYLES
   Design: Industrial precision, Arabic-first ERP
   Palette: Deep navy + amber gold + slate
═══════════════════════════════════════════ */

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

/* ── TOKENS ── */
:root {
  --navy-950: #0a0f1e;
  --navy-900: #0f172a;
  --navy-800: #1e2d4a;
  --navy-700: #263a5e;
  --navy-600: #2e4a78;
  --navy-500: #3d5f96;

  --amber-500: #f59e0b;
  --amber-400: #fbbf24;
  --amber-300: #fcd34d;
  --amber-100: #fef3c7;

  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;

  --green-500: #22c55e;
  --green-100: #dcfce7;
  --red-500: #ef4444;
  --red-100: #fee2e2;
  --orange-500: #f97316;
  --orange-100: #ffedd5;
  --blue-500: #3b82f6;
  --blue-100: #dbeafe;

  --sidebar-w: 240px;
  --header-h: 64px;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.08);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.18), 0 4px 12px rgba(0,0,0,.1);

  --font-main: 'Cairo', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --transition: 180ms cubic-bezier(.4,0,.2,1);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: var(--font-main);
  background: var(--slate-100);
  color: var(--navy-900);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--navy-950);
  display: flex;
  flex-direction: column;
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
  border-left: 1px solid rgba(255,255,255,.06);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px 18px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.logo-icon {
  font-size: 26px;
  color: var(--amber-400);
  line-height: 1;
  filter: drop-shadow(0 0 8px rgba(251,191,36,.4));
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.logo-main {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .3px;
}

.logo-sub {
  font-size: 11px;
  color: var(--slate-400);
  font-weight: 400;
  letter-spacing: .5px;
}

/* ── NAV ── */
.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--slate-400);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
  position: relative;
}

.nav-item:hover {
  background: rgba(255,255,255,.06);
  color: var(--slate-200);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(245,158,11,.18), rgba(245,158,11,.08));
  color: var(--amber-400);
  border: 1px solid rgba(245,158,11,.2);
}

.nav-item.active .nav-icon {
  color: var(--amber-400);
  filter: drop-shadow(0 0 4px rgba(245,158,11,.5));
}

.nav-icon {
  font-size: 15px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  color: inherit;
}

.nav-divider {
  height: 1px;
  background: rgba(255,255,255,.07);
  margin: 8px 4px;
}

/* ── SIDEBAR FOOTER ── */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.07);
}

.db-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--slate-500);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green-500);
  box-shadow: 0 0 6px rgba(34,197,94,.6);
  flex-shrink: 0;
  animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}

/* ── MAIN CONTENT ── */
.main-content {
  flex: 1;
  margin-right: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#pageContainer {
  flex: 1;
  padding: 28px 32px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* ── PAGE HEADER ── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--navy-900);
  letter-spacing: -.3px;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 13.5px;
  color: var(--slate-500);
  margin-top: 4px;
  font-weight: 400;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--slate-400); }

/* ── UTILITY ── */
.text-green { color: var(--green-500); }
.text-red   { color: var(--red-500); }
.text-amber { color: var(--amber-500); }
.text-blue  { color: var(--blue-500); }
.text-muted { color: var(--slate-500); }
.font-mono  { font-family: var(--font-mono); }
.text-sm    { font-size: 12.5px; }
.text-xs    { font-size: 11.5px; }
.fw-600     { font-weight: 600; }
.fw-700     { font-weight: 700; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--slate-400);
}
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; opacity: .5; }
.empty-state p { font-size: 14px; }


/* ═══════════════════════════════════════════
   PRINT STYLES — A4 RTL Arabic
═══════════════════════════════════════════ */

@media print {

  @page { size: A4 portrait; margin: 10mm 12mm; }

  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

  body {
    background: #fff !important;
    color: #000 !important;
    direction: rtl !important;
    font-size: 11px !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Hide screen elements */
  .sidebar, .no-print, button, .btn, .page-actions,
  .tabs, .filters, .search-bar, .kpi-icon,
  #toastContainer, .modal-overlay, .nav-divider,
  .sidebar-footer, .db-status { display: none !important; }

  /* Layout */
  .main-content { margin: 0 !important; padding: 0 !important; width: 100% !important; }
  #pageContainer { padding: 0 !important; max-width: 100% !important; }

  /* Print header */
  .print-header {
    display: flex !important;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 8px;
    margin-bottom: 12px;
    border-bottom: 2px solid #1e3a5f;
  }
  .print-company { font-size: 15px; font-weight: 700; color: #1e3a5f; }
  .print-report-title { font-size: 12px; font-weight: 600; color: #2e4a78; margin-top: 2px; }
  .print-date { font-size: 10px; color: #666; margin-top: 2px; }

  /* Cards */
  .card, .kpi-card {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    box-shadow: none !important;
    border: 1px solid #ddd !important;
    margin-bottom: 8px !important;
    border-radius: 4px !important;
  }
  .card-header { background: #f5f5f5 !important; padding: 6px 10px !important; }
  .card-title  { font-size: 12px !important; font-weight: 700 !important; }
  .card-body   { padding: 8px 10px !important; }

  /* KPI Grid */
  .kpi-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px !important;
    margin-bottom: 10px !important;
  }
  .kpi-card  { padding: 8px 10px !important; }
  .kpi-label { font-size: 9px !important; }
  .kpi-value { font-size: 13px !important; }
  .kpi-meta  { font-size: 9px !important; }

  /* Tables */
  .table-wrapper { box-shadow: none !important; border: 1px solid #ddd !important; overflow: visible !important; }
  table { width: 100% !important; border-collapse: collapse !important; }
  thead th { background: #1e3a5f !important; color: #fff !important; padding: 5px 6px !important; font-size: 9px !important; border: 1px solid #ddd !important; }
  tbody td { padding: 4px 6px !important; border: 1px solid #ddd !important; font-size: 9px !important; }
  tfoot td  { padding: 5px 6px !important; border: 1px solid #ccc !important; font-size: 9px !important; background: #f5f5f5 !important; font-weight: 700 !important; }
  tbody tr:nth-child(even) { background: #fafafa !important; }

  /* Colors */
  .text-green { color: #166534 !important; }
  .text-red   { color: #991b1b !important; }
  .text-amber { color: #92400e !important; }
  .text-blue  { color: #1e40af !important; }
  .fw-600, .fw-700 { font-weight: 700 !important; }

  /* Badges */
  .badge { border: 1px solid #999 !important; background: transparent !important; color: #000 !important; font-size: 8px !important; padding: 1px 4px !important; }

  /* Hide charts */
  .progress-bar { display: none !important; }

  /* Grid */
  .grid-2 { display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 8px !important; }
  .grid-auto { display: grid !important; grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important; }
  .section-gap { margin-bottom: 10px !important; }

}