/* ============================================================
   Burraq Vehicles DMS — Light Theme Stylesheet
   Aesthetic: Clean professional automotive dealership
   Fonts: Syne (headings), DM Sans (body), DM Mono (data)
   ============================================================ */

:root {
  --bg:       #f5f6fa;
  --bg2:      #ffffff;
  --bg3:      #f0f2f8;
  --border:   #e2e5ef;
  --border2:  #d0d5e8;
  --text:     #1a1e2e;
  --text2:    #4a5068;
  --text3:    #8b92a8;
  --accent:   #2563eb;
  --accent2:  #1d4ed8;
  --green:    #16a34a;
  --yellow:   #ca8a04;
  --red:      #dc2626;
  --purple:   #7c3aed;
  --orange:   #ea580c;
  --cyan:     #0891b2;
  --sidebar-w: 235px;
  --radius:   8px;
  --shadow:   0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow2:  0 4px 12px rgba(0,0,0,0.08);
  --mono: 'DM Mono', monospace;
  --sans: 'DM Sans', sans-serif;
  --head: 'Syne', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  display: flex;
  min-height: 100vh;
  line-height: 1.55;
}

/* ============ SIDEBAR ============ */
.sidebar {
  width: var(--sidebar-w);
  background: #1e2235;
  border-right: none;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 2px 0 8px rgba(0,0,0,0.12);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-icon { font-size: 1.5rem; }
.brand-name {
  font-family: var(--head);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.12em;
  color: #60a5fa;
}
.brand-sub {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.nav-section {
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  padding: 14px 18px 4px;
  font-family: var(--mono);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  font-size: 0.875rem;
  transition: all 0.15s;
  border-left: 2px solid transparent;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,0.06); }
.nav-item.active {
  color: #60a5fa;
  background: rgba(96,165,250,0.1);
  border-left-color: #60a5fa;
}
.nav-item.logout { color: #f87171; margin-top: 4px; }
.nav-icon { font-size: 0.8rem; width: 16px; text-align: center; }

.sidebar-footer {
  padding: 12px 18px;
  font-family: var(--mono);
  font-size: 0.65rem;
  color: rgba(255,255,255,0.25);
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* ============ MAIN ============ */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

/* ============ PAGE HEADER ============ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 28px 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.page-title {
  font-family: var(--head);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--text);
}
.page-sub { font-size: 0.8rem; color: var(--text3); margin-top: 2px; }

/* ============ CONTENT ============ */
.content { padding: 24px 28px; flex: 1; }

/* ============ CARDS ============ */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.card-title {
  font-family: var(--head);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ============ STAT CARDS ============ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow2); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent-color, var(--accent));
}
.stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text3);
  font-family: var(--mono);
}
.stat-value {
  font-family: var(--head);
  font-size: 1.7rem;
  font-weight: 700;
  margin: 6px 0 2px;
  color: var(--text);
}
.stat-sub { font-size: 0.72rem; color: var(--text3); }
.stat-icon {
  position: absolute;
  top: 16px; right: 16px;
  font-size: 1.4rem;
  opacity: 0.15;
}

/* ============ TABLE ============ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
thead { background: var(--bg3); }
th {
  padding: 10px 14px;
  text-align: left;
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text3);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
}
tr:hover td { background: #f8f9ff; color: var(--text); }
.vin-cell {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent);
  letter-spacing: 0.04em;
}
td.money { font-family: var(--mono); color: var(--text); }
td.money.neg { color: var(--red); }
td.money.pos { color: var(--green); }

/* ============ BADGES ============ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.badge-auction     { background: #fff3e8; color: var(--orange); border: 1px solid #fcd9b8; }
.badge-transit     { background: #f3e8ff; color: var(--purple); border: 1px solid #e0c4fd; }
.badge-repair      { background: #fefce8; color: var(--yellow); border: 1px solid #fde68a; }
.badge-inventory   { background: #f0fdf4; color: var(--green);  border: 1px solid #bbf7d0; }
.badge-sold-pending{ background: #ecfeff; color: var(--cyan);   border: 1px solid #a5f3fc; }
.badge-sold        { background: #eff6ff; color: var(--accent); border: 1px solid #bfdbfe; }
.badge-aging       { background: #fef2f2; color: var(--red);    border: 1px solid #fecaca; }

/* ============ FORMS ============ */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  font-family: var(--mono);
  font-weight: 500;
}
input, select, textarea {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.875rem;
  padding: 8px 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
input.flagged {
  border-color: var(--red) !important;
  background: #fff5f5;
}
.field-warning {
  font-size: 0.7rem;
  color: var(--red);
  font-family: var(--mono);
  display: none;
}
.field-warning.show { display: block; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 3px rgba(37,99,235,0.3); }
.btn-primary:hover { background: var(--accent2); box-shadow: 0 2px 6px rgba(37,99,235,0.4); }
.btn-secondary { background: var(--bg2); color: var(--text2); border: 1px solid var(--border2); }
.btn-secondary:hover { color: var(--text); border-color: var(--accent); background: #f0f4ff; }
.btn-danger { background: #fef2f2; color: var(--red); border: 1px solid #fecaca; }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 0.75rem; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============ FLASH ============ */
.flash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
  font-size: 0.85rem;
}
.flash-success { background: #f0fdf4; color: #15803d; border-bottom: 1px solid #bbf7d0; }
.flash-error   { background: #fef2f2; color: var(--red); border-bottom: 1px solid #fecaca; }
.flash-warning { background: #fefce8; color: #a16207; border-bottom: 1px solid #fde68a; }
.flash button  { background: none; border: none; cursor: pointer; color: inherit; font-size: 1rem; }

/* ============ SEARCH BAR ============ */
.search-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.search-bar input { max-width: 340px; }

/* ============ DASHBOARD GRID ============ */
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }

/* ============ AFC AGING ============ */
.aging-row td { background: #fff5f5 !important; }
.days-cell { font-family: var(--mono); }
.days-cell.over { color: var(--red); font-weight: 600; }

/* ============ TABS ============ */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-btn {
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text3);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 0.82rem;
  transition: all 0.15s;
  margin-bottom: -2px;
  font-weight: 500;
}
.tab-btn:hover { color: var(--text2); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============ UPLOAD ZONE ============ */
.upload-zone {
  border: 2px dashed var(--border2);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg3);
}
.upload-zone:hover, .upload-zone.drag {
  border-color: var(--accent);
  background: #eff6ff;
}
.upload-zone p { color: var(--text3); margin-top: 8px; font-size: 0.82rem; }

/* ============ TOOLTIPS ============ */
[data-tip] { position: relative; cursor: help; }
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e2235;
  border: 1px solid #374151;
  color: #f87171;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 0.72rem;
  white-space: nowrap;
  z-index: 999;
  font-family: var(--mono);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.25s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
}

/* ============ MISC ============ */
.text-muted { color: var(--text3); }
.text-mono  { font-family: var(--mono); }
.divider    { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.section-actions { display: flex; gap: 8px; align-items: center; }

/* ============ LOGIN ============ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e2235 0%, #2d3561 100%);
}
.login-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 40px;
  width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.login-logo {
  font-family: var(--head);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-align: center;
  margin-bottom: 6px;
}
.login-tagline { text-align: center; color: var(--text3); font-size: 0.78rem; margin-bottom: 28px; }

/* ============ JACKET FILES ============ */
.jacket-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.jacket-item {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text2);
  transition: box-shadow 0.15s;
}
.jacket-item:hover { box-shadow: var(--shadow2); }
.jacket-item .file-icon { font-size: 1.8rem; margin-bottom: 6px; }
.jacket-item a { color: var(--accent); text-decoration: none; word-break: break-all; }

/* ============ ALERTS ============ */
.alert {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.82rem;
  margin-bottom: 14px;
}
.alert-warning { background: #fefce8; border: 1px solid #fde68a; color: #a16207; }
.alert-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: var(--accent); }
.alert-danger  { background: #fef2f2; border: 1px solid #fecaca; color: var(--red); }

/* ============ PROFIT INDICATOR ============ */
.profit-indicator { height: 4px; border-radius: 2px; background: var(--bg3); overflow: hidden; margin-top: 6px; }
.profit-fill { height: 100%; border-radius: 2px; background: var(--green); transition: width 0.4s; }
.profit-fill.neg { background: var(--red); }

/* ============ TOP NAV BAR ============ */
.topbar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  font-size: 0.82rem;
  color: var(--text3);
}
.topbar-user { display: flex; align-items: center; gap: 6px; }
