/* ============================================================
   Cosmos Smart Parking — Admin Panel Styles
   ============================================================ */

:root {
  --bg:         #0d1117;
  --sidebar-w:  220px;
  --sidebar-bg: #111827;
  --card:       #161d2b;
  --card-2:     #1e2a3e;
  --line:       #1e2d40;
  --text:       #e2e8f0;
  --muted:      #64748b;
  --muted-2:    #94a3b8;
  --accent:     #3b82f6;
  --accent-h:   #2563eb;
  --accent-2:   #f59e0b;
  --danger:     #ef4444;
  --success:    #10b981;
  --warning:    #f59e0b;
  --font-head:  'Unbounded', sans-serif;
  --font-body:  'DM Sans', sans-serif;
  --radius:     12px;
  --radius-sm:  8px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

/* ── LOGIN ── */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(135deg, #060b14 0%, #0d1f42 100%);
}

.login-card {
  background: #111827;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 32px 80px rgba(0,0,0,.5);
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-mark {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2855d8, var(--accent-2));
  display: grid; place-items: center;
  font-size: 20px; color: #fff;
  box-shadow: 0 6px 20px rgba(40,85,216,.4);
  flex-shrink: 0;
}

.brand {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -.02em;
  color: #f1f5f9;
  line-height: 1.1;
}

.brand-sub {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .14em;
}

.login-card h1 {
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 900;
  color: #f1f5f9;
  margin-bottom: 4px;
}

.subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 24px;
}

.login-card label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin: 14px 0 7px;
}

.login-card input {
  width: 100%;
  padding: 11px 14px;
  background: #0d1117;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  outline: none;
  transition: border-color .2s;
}

.login-card input:focus {
  border-color: var(--accent);
}

/* ── BUTTONS ── */
button {
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  transition: all .15s ease;
}

.btn-primary {
  width: 100%;
  margin-top: 20px;
  padding: 13px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-head);
  font-size: 12px;
  letter-spacing: .04em;
}

.btn-primary:hover { background: var(--accent-h); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-logout {
  width: 100%;
  padding: 10px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 13px;
}

.btn-logout:hover { background: var(--card); color: var(--text); }

.btn-refresh {
  padding: 8px 14px;
  background: var(--card-2);
  color: var(--muted-2);
  border: 1px solid var(--line);
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.btn-refresh:hover { color: var(--text); background: var(--card); }

.btn-danger {
  padding: 6px 12px;
  background: rgba(239,68,68,.12);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,.25);
  font-size: 12px;
  border-radius: 6px;
}

.btn-danger:hover { background: rgba(239,68,68,.22); }

.btn-close {
  padding: 6px 10px;
  background: var(--card-2);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
}

.btn-close:hover { color: var(--text); }

/* ── LAYOUT ── */
#dashboardPage {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

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

.brand-mark-sm {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #2855d8, var(--accent-2));
  display: grid; place-items: center;
  font-size: 16px; color: #fff;
  flex-shrink: 0;
}

.brand-sm {
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 900;
  color: #f1f5f9;
  line-height: 1.1;
}

.brand-sub-sm {
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .12em;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  background: transparent;
  color: var(--muted-2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}

.nav-item:hover { background: var(--card); color: var(--text); }
.nav-item.active { background: var(--card-2); color: var(--text); }

.nav-icon { font-size: 15px; }

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--line);
}

.sidebar-user {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
  font-weight: 600;
}

/* ── MAIN ── */
.dashboard-main {
  flex: 1;
  overflow-y: auto;
  position: relative;
}

.tab-content {
  padding: 28px;
  max-width: 1100px;
}

/* ── PAGE HEADER ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-header h2 {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -.02em;
  color: #f1f5f9;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── TOGGLE GROUP ── */
.toggle-group {
  display: flex;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.toggle-btn {
  padding: 7px 14px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  border-radius: 0;
}

.toggle-btn:hover { color: var(--text); background: var(--card-2); }
.toggle-btn.active { background: var(--accent); color: #fff; }

/* ── FILTERS ── */
.filters-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filters-row input,
.filters-row select {
  padding: 9px 13px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  outline: none;
  flex: 1;
  min-width: 140px;
}

.filters-row input:focus,
.filters-row select:focus { border-color: var(--accent); }

.filters-row select option { background: var(--card); }

/* ── STATS ROW ── */
.stats-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.stat-chip {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted-2);
  white-space: nowrap;
}

.stat-chip span { color: var(--text); margin-left: 4px; }

/* ── TABLE ── */
.table-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  background: var(--card-2);
  padding: 11px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted-2);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.02); }

.td-plate {
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--text);
}

.td-link {
  cursor: pointer;
  color: var(--accent);
  font-weight: 700;
}

.td-link:hover { text-decoration: underline; }

/* ── STATUS BADGES ── */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-active          { background: rgba(59,130,246,.15); color: #60a5fa; }
.badge-awaiting        { background: rgba(245,158,11,.15); color: #fbbf24; }
.badge-paid            { background: rgba(16,185,129,.15); color: #34d399; }
.badge-whitelisted     { background: rgba(139,92,246,.15); color: #a78bfa; }
.badge-timed_out       { background: rgba(100,116,139,.15); color: #94a3b8; }
.badge-cancelled       { background: rgba(239,68,68,.12);  color: #f87171; }

/* ── TABLE EMPTY / LOADING ── */
.table-msg {
  padding: 40px;
  text-align: center;
  color: var(--muted);
  font-weight: 500;
}

/* ── DETAIL OVERLAY ── */
.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
}

.detail-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 32px 80px rgba(0,0,0,.6);
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--card);
}

.detail-header h3 {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 900;
  color: #f1f5f9;
}

.detail-body { padding: 20px 22px; }

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  gap: 16px;
}

.detail-row:last-of-type { border-bottom: none; }
.detail-lbl { color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.detail-val { color: var(--text); font-size: 13px; font-weight: 600; text-align: right; }

.detail-photo {
  width: 100%;
  border-radius: var(--radius-sm);
  margin: 12px 0;
  max-height: 200px;
  object-fit: cover;
}

/* ── REVENUE ── */
.revenue-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.rev-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.rev-card-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.rev-card-value {
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: -.02em;
}

.rev-card-value.green { color: var(--success); }
.rev-card-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ── WHITELIST ── */
.wl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 700px) { .wl-grid { grid-template-columns: 1fr; } }

.panel-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.panel-title {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 900;
  color: #f1f5f9;
  margin-bottom: 4px;
}

.panel-sub {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.panel-box label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 12px 0 6px;
}

.panel-box input {
  width: 100%;
  padding: 9px 12px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
}

.panel-box input:focus { border-color: var(--accent); }

/* ── CAMERAS ── */
.camera-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 600px) { .camera-grid { grid-template-columns: 1fr; } }

.camera-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.camera-name {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 900;
  color: #f1f5f9;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.camera-status-ok   { color: var(--success); font-size: 11px; font-weight: 700; }
.camera-status-err  { color: var(--danger);  font-size: 11px; font-weight: 700; }

.plate-tag {
  display: inline-block;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 10px;
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--text);
  margin: 3px;
}

/* ── MESSAGES ── */
.error-msg {
  min-height: 18px;
  margin-top: 8px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
}

.info-msg {
  padding: 12px 16px;
  background: rgba(59,130,246,.1);
  border: 1px solid rgba(59,130,246,.2);
  border-radius: var(--radius-sm);
  color: #93c5fd;
  font-size: 13px;
  font-weight: 600;
}

/* ── UTILITY ── */
.hidden { display: none !important; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar { width: 60px; min-width: 60px; }
  .brand-sm, .brand-sub-sm, .sidebar-user, .nav-item span:not(.nav-icon) { display: none; }
  .nav-item { justify-content: center; padding: 12px; }
  .sidebar-brand { justify-content: center; padding: 16px 10px; }
  .tab-content { padding: 18px 14px; }
}
