/* Doorly Admin Panel — Dark Theme */
:root {
  --bg:       #0f1117;
  --surface:  #1a1d27;
  --border:   #2a2d3e;
  --accent:   #4f8ef7;
  --accent2:  #22c55e;
  --danger:   #ef4444;
  --warn:     #f59e0b;
  --text:     #e2e8f0;
  --muted:    #64748b;
  --radius:   8px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  min-height: 100vh;
}

/* ── Nav ── */
nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
}

/* desktop: single row */
.nav-top-row {
  display: flex;
  align-items: center;
  height: 52px;
  gap: 4px;
}
.nav-top-row .spacer { flex: 1; }

nav .logo {
  font-weight: 700;
  font-size: 16px;
  color: var(--accent);
  margin-right: 12px;
  white-space: nowrap;
}

/* desktop: nav-links laid out as a horizontal flex row inside nav-top-row via display:contents */
.nav-links {
  display: contents;
}

nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--radius);
  transition: all .15s;
  font-size: 13px;
  white-space: nowrap;
}
nav a:hover, nav a.active { color: var(--text); background: var(--border); }

nav .spacer { flex: 1; }

nav .logout-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 5px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  transition: all .15s;
  white-space: nowrap;
}
nav .logout-btn:hover { border-color: var(--danger); color: var(--danger); }

/* hamburger button — hidden on desktop */
.nav-hamburger {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 6px 10px;
  cursor: pointer;
  line-height: 1;
}

/* ── Layout ── */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px 16px;
}

h1 { font-size: 20px; margin-bottom: 20px; color: var(--text); }
h2 { font-size: 15px; margin-bottom: 12px; color: var(--text); }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

/* ── Forms ── */
label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }

input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { font-family: 'Cascadia Code', 'Consolas', monospace; resize: vertical; }

.field { margin-bottom: 14px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all .15s;
}
.btn-primary  { background: var(--accent);  color: #fff; }
.btn-primary:hover  { filter: brightness(1.1); }
.btn-success  { background: var(--accent2); color: #fff; }
.btn-success:hover  { filter: brightness(1.1); }
.btn-danger   { background: var(--danger);  color: #fff; }
.btn-danger:hover   { filter: brightness(1.1); }
.btn-outline  { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover  { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.badge-green  { background: #14532d; color: #86efac; }
.badge-blue   { background: #1e3a5f; color: #93c5fd; }
.badge-yellow { background: #451a03; color: #fcd34d; }
.badge-red    { background: #450a0a; color: #fca5a5; }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.02); }

/* table scroll on mobile */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── Alerts ── */
.alert {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 12px;
  display: none;
}
.alert.show { display: block; }
.alert-ok   { background: #052e16; border: 1px solid #166534; color: #86efac; }
.alert-err  { background: #450a0a; border: 1px solid #7f1d1d; color: #fca5a5; }
.alert-warn { background: #451a03; border: 1px solid #92400e; color: #fcd34d; }

/* ── Misc ── */
.mono { font-family: 'Cascadia Code', 'Consolas', monospace; font-size: 12px; }
.muted { color: var(--muted); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Spinner ── */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Login page ── */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 36px 28px;
  width: 100%;
  max-width: 360px;
}
.login-box .logo {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}
.login-box .sub {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 28px;
}

/* ── Tabs ── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  transition: all .15s;
  margin-bottom: -1px;
}
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Filter bar ── */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}
.filter-bar input[type=text],
.filter-bar select { width: auto; flex: 1; min-width: 120px; }

/* ── Toggle switch ── */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 22px;
  cursor: pointer;
  transition: .2s;
}
.toggle-slider:before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: .2s;
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider:before { transform: translateX(18px); }

/* ── Lucide icons sizing ── */
[data-lucide] { width: 16px; height: 16px; stroke: currentColor; display: inline-block; vertical-align: middle; }

/* ═══════════════════════════════
   RESPONSIVE — mobile-first
   ═══════════════════════════════ */

/* ─── ≤ 640px (phones) ─── */
@media (max-width: 640px) {
  body { font-size: 13px; }

  /* hamburger visible */
  .nav-hamburger { display: flex !important; align-items: center; }

  /* links become a vertical dropdown */
  .nav-links {
    display: none !important;
    flex-direction: column;
    width: 100%;
    padding: 8px 0 12px;
    gap: 2px;
    border-top: 1px solid var(--border);
  }
  .nav-links.open { display: flex !important; }
  .nav-links a { padding: 10px 12px; border-radius: 6px; font-size: 14px; }
  .nav-links .spacer { display: none; }
  .nav-links .logout-btn {
    margin-top: 4px;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    font-size: 14px;
  }

  .container { padding: 14px 12px; }
  h1 { font-size: 18px; margin-bottom: 14px; }

  .card { padding: 14px 12px; }

  .grid-2 { grid-template-columns: 1fr; }

  /* full-width buttons on mobile */
  .btn-row { flex-direction: column; }
  .btn-row .btn { justify-content: center; }

  /* filter bar stacks */
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar input[type=text],
  .filter-bar select { width: 100%; }

  /* table: allow horizontal scroll */
  .card > table,
  .table-wrap > table { min-width: 480px; }
  .card:has(> table) { padding: 0; overflow: hidden; }
  .card:has(> table) > table th,
  .card:has(> table) > table td { padding: 9px 12px; }
}

/* ─── 641px – 900px (tablets) ─── */
@media (min-width: 641px) and (max-width: 900px) {
  .container { padding: 18px 16px; }
  nav { padding: 0 12px; gap: 2px; }
  nav a { padding: 6px 8px; font-size: 12px; }
}
