/* ═══════════════════════════════════════════════
   LicensePlate.Management — Layout CSS
   Design language: Inter/Sarabun · Gold accent
   ═══════════════════════════════════════════════ */

:root {
  --bg:          #f5f4f1;
  --bg2:         #eeede8;
  --surface:     #ffffff;
  --border:      rgba(0,0,0,0.07);
  --border2:     rgba(0,0,0,0.12);
  --text:        #1a1a1a;
  --muted:       #888880;
  --accent:      #b8952a;
  --accent-light:#fdf4dc;
  --black:       #0a0a0a;
  --sidebar-w:   240px;
  --topbar-h:    56px;
  --font: 'Inter', 'Sarabun', -apple-system, sans-serif;
  --radius: 12px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* ── SHELL ── */
.mgmt-shell {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.mgmt-sidebar {
  width: var(--sidebar-w);
  background: var(--black);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform 0.25s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-header {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-plate {
  width: 34px; height: 34px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: var(--black);
  flex-shrink: 0;
}

.logo-text { display: flex; flex-direction: column; }
.logo-name  { font-size: 15px; font-weight: 700; color: #fff; line-height: 1.2; letter-spacing: 0.5px; }
.logo-tag   { font-size: 11px; font-weight: 500; color: var(--accent); letter-spacing: 1px; }

/* ── SIDEBAR NAV ── */
.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-section {
  padding: 4px 10px;
  margin-bottom: 4px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ── GROUP TOGGLE BUTTON ── */
.nav-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px 8px 4px;
  border-radius: 6px;
  transition: background 0.15s;
  gap: 6px;
}
.nav-group-toggle:hover {
  background: rgba(255,255,255,0.04);
}
.toggle-chevron {
  width: 13px; height: 13px;
  flex-shrink: 0;
  color: rgba(255,255,255,0.25);
  transition: transform 0.2s ease;
}
.nav-group-toggle.open .toggle-chevron {
  transform: rotate(180deg);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  transition: all 0.15s;
  margin-bottom: 2px;
}

.nav-link:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.9);
}

.nav-link.active {
  background: rgba(184,149,42,0.15);
  color: var(--accent);
}

.nav-icon {
  width: 16px; height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-link.active .nav-icon,
.nav-link:hover .nav-icon {
  opacity: 1;
}

.nav-child {
  padding-left: 20px;
  font-size: 12.5px;
}

/* ── SIDEBAR FOOTER ── */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.sidebar-footer-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--black);
  flex-shrink: 0;
}

.user-name  { font-size: 12px; font-weight: 600; color: #fff; }
.user-role  { font-size: 11px; color: rgba(255,255,255,0.35); }

/* ── MAIN AREA ── */
.mgmt-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── TOP BAR ── */
.mgmt-topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 100;
}

.sidebar-toggle {
  display: none;
  background: none; border: none;
  cursor: pointer; color: var(--muted);
  padding: 6px; border-radius: 8px;
  transition: all 0.15s;
}
.sidebar-toggle:hover { background: var(--bg2); color: var(--text); }

.topbar-breadcrumb {
  font-size: 14px; font-weight: 600; color: var(--text);
  flex: 1;
}

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

.topbar-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 8px;
  font-size: 12px; font-weight: 600;
  color: var(--muted); text-decoration: none;
  border: 1px solid var(--border2);
  background: none;
  transition: all 0.15s;
}
.topbar-btn:hover { background: var(--bg2); color: var(--text); }

/* ── PAGE CONTENT ── */
.mgmt-content {
  flex: 1;
  padding: 28px 28px;
}

/* ── PAGE HEADER (reusable in pages) ── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}
.page-title   { font-size: 22px; font-weight: 800; letter-spacing: -0.3px; color: var(--black); }
.page-sub     { font-size: 13px; color: var(--muted); margin-top: 3px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── CARD ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
}
.card-title {
  font-size: 14px; font-weight: 700; color: var(--black);
  margin-bottom: 16px;
}

/* ── STAT CARDS ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex; align-items: center; gap: 14px;
}
.stat-icon {
  width: 42px; height: 42px; flex-shrink: 0;
  background: var(--accent-light); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
}
.stat-body { flex: 1; min-width: 0; }
.stat-value { font-size: 26px; font-weight: 800; color: var(--accent); line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 500; }

/* ── DASHBOARD GRID ── */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* ── QUICK LINKS ── */
.quick-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.quick-link {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg2);
  text-decoration: none; color: var(--text);
  transition: all 0.15s; text-align: center;
}
.quick-link:hover { border-color: var(--accent); background: var(--accent-light); color: var(--accent); }
.ql-icon { color: var(--accent); }
.ql-label { font-size: 12px; font-weight: 600; }

/* ── INFO LIST ── */
.info-list { display: flex; flex-direction: column; gap: 10px; }
.info-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; }
.info-key { color: var(--muted); font-size: 12px; font-weight: 500; }
.info-val { color: var(--text); font-weight: 600; }

/* ── TABLE ── */
.mgmt-table-wrap { overflow-x: auto; }
.mgmt-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.mgmt-table th {
  text-align: left; padding: 10px 14px;
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.6px;
  border-bottom: 1px solid var(--border2);
  background: var(--bg2);
  white-space: nowrap;
}
.mgmt-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}
.mgmt-table tr:last-child td { border-bottom: none; }
.mgmt-table tr:hover td { background: var(--bg); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 600; font-family: var(--font);
  cursor: pointer; transition: all 0.15s;
  border: none; text-decoration: none;
  white-space: nowrap;
}
.btn-primary  { background: var(--black); color: #fff; }
.btn-primary:hover { background: var(--accent); color: var(--black); }
.btn-gold     { background: var(--accent); color: var(--black); }
.btn-gold:hover { background: #a07820; color: #fff; }
.btn-outline  { background: none; border: 1px solid var(--border2); color: var(--text); }
.btn-outline:hover { background: var(--bg2); }
.btn-danger   { background: none; border: 1px solid rgba(239,68,68,0.3); color: #ef4444; }
.btn-danger:hover { background: rgba(239,68,68,0.08); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 7px; border-radius: 8px; }

/* ── BADGE ── */
.badge {
  display: inline-flex; align-items: center;
  border-radius: 100px; padding: 2px 8px;
  font-size: 11px; font-weight: 700;
}
.badge-green  { background: rgba(34,197,94,0.12);  color: #16a34a; }
.badge-gold   { background: rgba(184,149,42,0.12); color: var(--accent); }
.badge-red    { background: rgba(239,68,68,0.1);   color: #ef4444; }
.badge-gray   { background: rgba(100,116,139,0.1); color: #64748b; }

/* ── FORM ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  border: 1.5px solid var(--border2); border-radius: 8px;
  padding: 9px 12px; font-size: 13px; font-family: var(--font);
  color: var(--text); background: var(--bg);
  transition: border-color 0.15s;
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent); background: var(--accent-light);
}
.form-textarea { resize: vertical; min-height: 90px; }

/* ── SIDEBAR OVERLAY (mobile) ── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 199;
}
.sidebar-overlay.open { display: block; }

/* ── ERROR UI ── */
#blazor-error-ui {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  padding: 12px 20px;
  background: #1e1e1e; color: #fff;
  font-size: 13px; z-index: 9999;
  display: none;
  align-items: center; gap: 12px;
}
#blazor-error-ui .reload { color: var(--accent); }
#blazor-error-ui .dismiss { cursor: pointer; margin-left: auto; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .mgmt-sidebar {
    transform: translateX(-100%);
  }
  .mgmt-sidebar.open {
    transform: translateX(0);
  }
  .mgmt-main {
    margin-left: 0;
  }
  .sidebar-toggle {
    display: flex;
  }
  .mgmt-content {
    padding: 20px 16px;
  }
}
