/* GaadiBhai Admin Panel */
:root {
  --bg:        #0f1117;
  --surface:   #1a1d27;
  --border:    #2a2d3e;
  --accent:    #6c63ff;
  --accent-h:  #5a52e0;
  --green:     #22c55e;
  --red:       #ef4444;
  --yellow:    #f59e0b;
  --text:      #e2e8f0;
  --muted:     #94a3b8;
  --sidebar-w: 240px;
}

html[data-theme="light"] {
  --bg:      #f1f5f9;
  --surface: #ffffff;
  --border:  #e2e8f0;
  --text:    #0f172a;
  --muted:   #64748b;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  transition: background .2s, color .2s;
}

/* ── Theme toggle button ─────────────────────────────────────────────────── */
.theme-toggle {
  background: none; border: 1px solid var(--border); color: var(--muted);
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer;
  font-size: 16px; display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

a { color: var(--accent); text-decoration: none; cursor: pointer; }
a:hover { text-decoration: underline; }
button, [onclick], label[for], select { cursor: pointer; }

/* ── Auth pages ─────────────────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
}
.auth-logo { font-size: 22px; font-weight: 700; color: var(--accent); margin-bottom: 8px; }
.auth-subtitle { color: var(--muted); margin-bottom: 28px; font-size: 13px; }

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

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}
.sidebar-logo {
  padding: 20px 20px 16px;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
}
.sidebar-logo span { font-size: 11px; color: var(--muted); display: block; font-weight: 400; }

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-section { padding: 12px 16px 4px; font-size: 10px; text-transform: uppercase;
               letter-spacing: 1px; color: var(--muted); }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px;
  color: var(--muted);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all .15s;
  font-size: 13px;
}
.nav-item:hover { color: var(--text); background: rgba(108,99,255,.08); }
.nav-item.active { color: var(--accent); border-left-color: var(--accent);
                   background: rgba(108,99,255,.12); }
.nav-item .icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}
.sidebar-footer strong { display: block; color: var(--text); font-size: 13px; }
.sidebar-footer .roles { font-size: 11px; color: var(--accent); margin-bottom: 8px; }
.logout-btn {
  background: none; border: 1px solid var(--border); color: var(--muted);
  padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 12px;
  width: 100%; transition: all .15s;
}
.logout-btn:hover { border-color: var(--red); color: var(--red); }

.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.topbar h1 { font-size: 18px; font-weight: 600; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }

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

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 16px; color: var(--text); }

/* ── Stats grid ─────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
}
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 32px; font-weight: 700; margin: 6px 0 4px; }
.stat-sub   { font-size: 12px; color: var(--muted); }

/* ── Table ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: 10px 14px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); border-bottom: 1px solid var(--border);
}
td { padding: 12px 14px; border-bottom: 1px solid rgba(42,45,62,.6); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(108,99,255,.04); }

.car-thumb { width: 60px; height: 40px; object-fit: cover; border-radius: 4px;
             background: var(--border); }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=date],
select, textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 7px;
  font-size: 13px;
  outline: none;
  transition: border .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.role-checkboxes { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.role-check { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.role-check input { width: auto; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 7px; font-size: 13px;
  font-weight: 500; cursor: pointer; border: none;
  transition: all .15s; white-space: nowrap;
}
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover  { background: var(--accent-h); }
.btn-danger   { background: var(--red); color: #fff; }
.btn-danger:hover   { opacity: .85; }
.btn-ghost    { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.btn-ghost:hover    { border-color: var(--text); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 3px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.badge-green  { background: rgba(34,197,94,.15);  color: var(--green); }
.badge-red    { background: rgba(239,68,68,.15);   color: var(--red); }
.badge-yellow { background: rgba(245,158,11,.15);  color: var(--yellow); }
.badge-blue   { background: rgba(108,99,255,.15);  color: var(--accent); }
.badge-gray   { background: rgba(148,163,184,.12); color: var(--muted); }

/* ── Modal ──────────────────────────────────────────────────────────────── */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 20px;
}
.modal-bg.hidden { display: none; }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; width: 100%; max-width: 640px;
  max-height: 90vh; overflow-y: auto;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--muted); font-size: 20px;
               cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ── Toolbar ────────────────────────────────────────────────────────────── */
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 12px; flex-wrap: wrap;
}
.toolbar-left { display: flex; gap: 10px; align-items: center; flex: 1; }
.search-input {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 8px 12px; border-radius: 7px; font-size: 13px; outline: none;
  width: 260px; transition: border .15s;
}
.search-input:focus { border-color: var(--accent); }

/* ── Pagination ─────────────────────────────────────────────────────────── */
.pagination { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 16px; }
.page-btn {
  background: var(--bg); border: 1px solid var(--border); color: var(--muted);
  padding: 5px 10px; border-radius: 6px; cursor: pointer; font-size: 12px;
}
.page-btn:hover, .page-btn.active { border-color: var(--accent); color: var(--accent); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }
.page-info { font-size: 12px; color: var(--muted); padding: 0 6px; }

/* ── Toast ──────────────────────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 18px;
  font-size: 13px; z-index: 999;
  transform: translateY(80px); opacity: 0;
  transition: all .25s; pointer-events: none;
}
#toast.show { transform: translateY(0); opacity: 1; }
#toast.success { border-color: var(--green); color: var(--green); }
#toast.error   { border-color: var(--red);   color: var(--red);   }

/* ── Light mode overrides for rgba-based rules ───────────────────────────── */
html[data-theme="light"] tr:hover td              { background: rgba(108,99,255,.06); }
html[data-theme="light"] td                       { border-bottom-color: #e2e8f0; }
html[data-theme="light"] .nav-item:hover          { background: rgba(108,99,255,.08); color: var(--text); }
html[data-theme="light"] .nav-item.active         { background: rgba(108,99,255,.1); }
html[data-theme="light"] .sidebar                 { background: #ffffff; }
html[data-theme="light"] .topbar                  { background: #ffffff; }
html[data-theme="light"] #toast                   { background: #ffffff; }
html[data-theme="light"] input[type=text],
html[data-theme="light"] input[type=email],
html[data-theme="light"] input[type=password],
html[data-theme="light"] input[type=date],
html[data-theme="light"] select,
html[data-theme="light"] textarea                 { background: var(--bg); }

/* ── Misc ───────────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state .icon { font-size: 40px; margin-bottom: 12px; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 12px; }
.mt-4 { margin-top: 16px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.items-center { align-items: center; }
