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

:root {
  --bg-base:    #0a0a16;
  --bg-card:    #12122a;
  --bg-sidebar: #0d0d20;
  --bg-input:   #1a1a35;
  --border:     rgba(108,99,255,.18);
  --primary:    #6c63ff;
  --primary-glow: rgba(108,99,255,.35);
  --cyan:       #00d4ff;
  --cyan-glow:  rgba(0,212,255,.25);
  --success:    #00c896;
  --warning:    #ffc107;
  --danger:     #ff4757;
  --text:       #e2e8f0;
  --text-muted: #718096;
  --text-dim:   #4a5568;
  --sidebar-w:  240px;
  --radius:     12px;
  --radius-sm:  8px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; font-family: 'Inter', sans-serif; background: var(--bg-base); color: var(--text); font-size: 14px; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Layout ── */
.app-layout { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo .logo-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.logo-text { line-height: 1.2; }
.logo-text .brand { font-size: 15px; font-weight: 700; color: var(--text); }
.logo-text .sub   { font-size: 11px; color: var(--text-muted); }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 12px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all .18s ease;
  margin-bottom: 2px;
}
.nav-item:hover { background: rgba(108,99,255,.1); color: var(--text); }
.nav-item.active { background: rgba(108,99,255,.18); color: var(--primary); }
.nav-item .nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge { margin-left: auto; background: var(--primary); color: #fff; font-size: 10px; padding: 2px 7px; border-radius: 20px; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  margin-bottom: 8px;
}
.user-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.user-info .user-name { font-size: 13px; font-weight: 600; color: var(--text); }
.user-info .user-role { font-size: 11px; color: var(--text-muted); text-transform: capitalize; }
.btn-logout {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  color: var(--text-muted); text-decoration: none; font-size: 13px;
  transition: all .18s; width: 100%;
}
.btn-logout:hover { background: rgba(255,71,87,.1); color: var(--danger); }

/* ── Main content ── */
.main-content { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }

.topbar {
  padding: 20px 28px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.page-title { font-size: 22px; font-weight: 700; color: var(--text); }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

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

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 12px;
}
.card-title { font-size: 15px; font-weight: 600; color: var(--text); }

/* ── Stat cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: transform .2s, border-color .2s;
}
.stat-card:hover { transform: translateY(-2px); border-color: var(--primary); }
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--cyan));
}
.stat-icon {
  font-size: 28px;
  margin-bottom: 12px;
}
.stat-value { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .5px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: none; text-decoration: none; transition: all .18s ease;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), #8b84ff);
  color: #fff;
  box-shadow: 0 4px 15px var(--primary-glow);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px var(--primary-glow); }
.btn-cyan { background: linear-gradient(135deg, var(--cyan), #0099cc); color: #fff; box-shadow: 0 4px 15px var(--cyan-glow); }
.btn-cyan:hover { transform: translateY(-1px); }
.btn-success { background: rgba(0,200,150,.15); color: var(--success); border: 1px solid rgba(0,200,150,.3); }
.btn-success:hover { background: rgba(0,200,150,.25); }
.btn-danger  { background: rgba(255,71,87,.15);  color: var(--danger);  border: 1px solid rgba(255,71,87,.3); }
.btn-danger:hover  { background: rgba(255,71,87,.25); }
.btn-warning { background: rgba(255,193,7,.15);  color: var(--warning); border: 1px solid rgba(255,193,7,.3); }
.btn-ghost   { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-icon { padding: 7px; width: 32px; height: 32px; justify-content: center; }

/* ── Table ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; min-width: 600px; }
thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .8px;
  background: rgba(255,255,255,.02);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid rgba(255,255,255,.04);
  transition: background .15s;
}
tbody tr:hover { background: rgba(108,99,255,.06); }
tbody tr:last-child { border-bottom: none; }
td { padding: 13px 16px; color: var(--text); font-size: 13px; vertical-align: middle; }
.td-muted { color: var(--text-muted); }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-green   { background: rgba(0,200,150,.15);  color: var(--success); }
.badge-red     { background: rgba(255,71,87,.15);   color: var(--danger); }
.badge-yellow  { background: rgba(255,193,7,.15);   color: var(--warning); }
.badge-blue    { background: rgba(0,212,255,.15);   color: var(--cyan); }
.badge-purple  { background: rgba(108,99,255,.15);  color: var(--primary); }
.badge-gray    { background: rgba(113,128,150,.15); color: var(--text-muted); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── Forms ── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
select, textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 13px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  transition: border-color .18s, box-shadow .18s;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
select option { background: var(--bg-card); }
textarea { resize: vertical; min-height: 80px; }

/* ── Form sections ── */
.form-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}
.form-section-header {
  padding: 14px 20px;
  background: rgba(108,99,255,.08);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.form-section-body { padding: 20px; }

/* ── Alerts / Flash ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-success { background: rgba(0,200,150,.1); border: 1px solid rgba(0,200,150,.3); color: var(--success); }
.alert-danger  { background: rgba(255,71,87,.1);  border: 1px solid rgba(255,71,87,.3);  color: var(--danger); }
.alert-info    { background: rgba(0,212,255,.1);  border: 1px solid rgba(0,212,255,.3);  color: var(--cyan); }
.alert-warning { background: rgba(255,193,7,.1);  border: 1px solid rgba(255,193,7,.3);  color: var(--warning); }

/* ── Search / Toolbar ── */
.toolbar {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap; margin-bottom: 16px;
}
.search-wrap { position: relative; flex: 1; min-width: 200px; }
.search-wrap input { padding-left: 36px; }
.search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }

/* ── Login page ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: fixed;
  top: -200px; left: -200px;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(108,99,255,.15) 0%, transparent 70%);
  pointer-events: none;
}
.login-page::after {
  content: '';
  position: fixed;
  bottom: -200px; right: -200px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(0,212,255,.1) 0%, transparent 70%);
  pointer-events: none;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  box-shadow: 0 25px 50px rgba(0,0,0,.5);
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo-icon {
  width: 68px; height: 68px;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  margin: 0 auto 16px;
  box-shadow: 0 8px 25px var(--primary-glow);
}
.login-logo h1 { font-size: 20px; font-weight: 700; color: var(--text); }
.login-logo p  { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.login-form .form-group { margin-bottom: 16px; }
.login-form label { display: block; margin-bottom: 6px; }
.btn-login {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all .2s;
  box-shadow: 0 4px 20px var(--primary-glow);
  margin-top: 8px;
}
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 8px 30px var(--primary-glow); }

/* ── 2FA page ── */
.otp-inputs { display: flex; gap: 10px; justify-content: center; margin: 20px 0; }
.otp-input {
  width: 52px; height: 62px;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 24px; font-weight: 700;
  text-align: center;
  color: var(--text);
  transition: border-color .18s;
}
.otp-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }

/* ── QR setup ── */
.qr-box {
  text-align: center;
  padding: 24px;
  background: var(--bg-input);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin: 20px 0;
}
.qr-box img { border-radius: 8px; }
.secret-key {
  font-family: monospace;
  font-size: 13px;
  background: var(--bg-base);
  padding: 8px 14px;
  border-radius: 6px;
  color: var(--cyan);
  display: inline-block;
  margin-top: 12px;
  letter-spacing: 2px;
}
.setup-steps { list-style: none; counter-reset: steps; }
.setup-steps li {
  counter-increment: steps;
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.04);
  color: var(--text-muted);
  font-size: 13px;
}
.setup-steps li::before {
  content: counter(steps);
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  color: #fff;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}

/* ── Actions cell ── */
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-icon { font-size: 52px; margin-bottom: 16px; }
.empty-state h3 { font-size: 17px; font-weight: 600; color: var(--text); margin-bottom: 8px; }

/* ── Vehicle detail view ── */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}
.detail-field { padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.04); }
.detail-field:last-child { border-bottom: none; }
.detail-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.detail-value { font-size: 14px; color: var(--text); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { position: fixed; left: -100%; transition: left .3s; }
  .sidebar.open { left: 0; }
  .app-layout { flex-direction: column; }
  .main-content { height: 100vh; }
  .login-card { padding: 32px 24px; }
}

/* ── Document Upload Sections (OCR) ── */
.doc-upload-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  position: relative;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
}
.doc-upload-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 20px;
}
.doc-upload-icon {
  font-size: 24px;
  background: rgba(108,99,255,.1);
  padding: 10px;
  border-radius: var(--radius-sm);
  color: var(--primary);
  flex-shrink: 0;
}
.doc-upload-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.doc-upload-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.5;
}
.doc-upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.doc-drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  background: rgba(255,255,255,.01);
  transition: all .2s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 140px;
}
.doc-drop-zone:hover {
  border-color: var(--primary);
  background: rgba(108,99,255,.03);
}
.doc-drop-zone.drag-over {
  border-color: var(--cyan);
  background: rgba(0,212,255,.05);
  transform: scale(1.02);
}
.doc-drop-zone.uploading {
  border-color: var(--warning);
  background: rgba(255,193,7,.02);
  pointer-events: none;
}
.doc-drop-zone.uploaded {
  border-color: var(--success);
  background: rgba(0,200,150,.02);
}
.doc-drop-icon {
  font-size: 28px;
  margin-bottom: 2px;
}
.doc-drop-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.doc-drop-hint {
  font-size: 11px;
  color: var(--text-muted);
}
.doc-status {
  font-size: 12px;
  margin-top: 6px;
  line-height: 1.4;
}
.ocr-scanning {
  color: var(--warning);
  font-weight: 500;
}
.ocr-success {
  color: var(--success);
  font-weight: 500;
}
.ocr-error {
  color: var(--danger);
  font-weight: 500;
}
.ocr-banner {
  margin-top: 20px;
  background: rgba(0,200,150,.1);
  border: 1px solid rgba(0,200,150,.3);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--success);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: fadeIn .3s ease;
}
.ocr-banner-icon {
  font-size: 18px;
}
.ocr-filled {
  border-color: var(--success) !important;
  box-shadow: 0 0 0 3px rgba(0,200,150,.25) !important;
  transition: all .3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}
