/* Admin shell layout — dark sidebar + light content area.
   Variables exposed here are the contract every /admin/* page consumes. */

:root {
  --bg-dark: #1a1f2e;
  --bg-dark-2: #232838;
  --bg-light: #f4f6f9;
  --card-bg: #ffffff;
  --text-light: #f5f7fb;
  --text-dim: #8a93a6;
  --text-body: #2a2f3a;
  --text-muted: #6b7280;
  --accent-green: #4CAF50;
  --accent-green-dim: rgba(76, 175, 80, 0.14);
  --accent-green-dark: #3d9140;
  --accent-red: #ff4444;
  --accent-red-dim: rgba(255, 68, 68, 0.12);
  --accent-blue: #2f7df0;
  --accent-blue-dim: rgba(47, 125, 240, 0.12);
  --accent-yellow: #f3e795;
  --accent-purple: #8b5cf6;
  --border: #e3e7ee;
  --border-dark: #2a3145;
  --status-available: #4CAF50;
  --status-sold: #ff4444;
  --status-booked: #f3e795;
  --status-builder: #bababa;
  --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-elev: 0 8px 24px rgba(15, 23, 42, 0.12);
  --sidebar-w: 220px;
  --header-h: 64px;
  --radius: 10px;
  --radius-sm: 6px;
  --font-stack: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

body.admin {
  font-family: var(--font-stack);
  background: var(--bg-light);
  color: var(--text-body);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ── Sidebar ─────────────────────────────────────────────── */
.admin-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-dark);
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--border-dark);
}

.sidebar-brand {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border-dark);
}
.sidebar-brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-brand-row img {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: #fff;
  padding: 3px;
  object-fit: contain;
}
.sidebar-brand-name {
  font-weight: 700;
  letter-spacing: 1px;
  font-size: 14px;
  color: var(--accent-green);
}
.sidebar-project {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-light);
  font-weight: 600;
}
.sidebar-admin-pill {
  display: inline-block;
  margin-top: 6px;
  background: var(--accent-green);
  color: #08130a;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: 4px;
}

.sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 12px 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 10px 14px;
  color: var(--text-dim);
  font-size: 13.5px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background .12s, color .12s, border-color .12s;
}
.sidebar-nav a .nav-icon {
  width: 18px; height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: .85;
}
.sidebar-nav a:hover {
  color: var(--text-light);
  background: var(--bg-dark-2);
}
.sidebar-nav a.is-active {
  color: var(--accent-green);
  background: var(--accent-green-dim);
  border-left-color: var(--accent-green);
  font-weight: 600;
}
.sidebar-nav a.is-active .nav-icon { opacity: 1; }
.sidebar-nav .nav-section {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-dim);
  opacity: 0.5;
  padding: 14px 16px 4px;
  pointer-events: none;
  user-select: none;
}
.sidebar-nav li.nav-section:first-child { padding-top: 2px; }

.sidebar-foot {
  border-top: 1px solid var(--border-dark);
  padding: 10px 0 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-foot a,
.sidebar-foot button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 10px 17px;
  color: var(--text-dim);
  font-size: 13.5px;
  font-weight: 500;
  background: transparent;
  border: none;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  width: 100%;
}
.sidebar-foot a:hover,
.sidebar-foot button:hover { color: var(--text-light); background: var(--bg-dark-2); }
.sidebar-foot .logout-form { margin: 0; }
.sidebar-foot .logout-btn { color: var(--accent-red); }
.sidebar-foot .logout-btn:hover { color: #ff7575; background: rgba(255,68,68,.08); }

/* ── Content ─────────────────────────────────────────────── */
.admin-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-light);
  position: relative;
}
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  min-height: var(--header-h);
}
.admin-header h1 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  color: var(--text-body);
}
.admin-header .header-sub {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}
.admin-header .header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-body {
  padding: 22px 28px 72px;
  flex: 1;
  min-width: 0;
}

.powered-by {
  position: fixed;
  right: 14px;
  bottom: 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 11px;
  color: var(--text-muted);
  box-shadow: var(--shadow-card);
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.powered-by strong { color: var(--accent-green); font-weight: 700; }

/* ── Responsive: ≤768px collapse to top bar ──────────────── */
@media (max-width: 768px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-dark);
  }
  .sidebar-brand {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
  .sidebar-brand-row { gap: 8px; }
  .sidebar-project { margin-top: 0; font-size: 12px; }
  .sidebar-admin-pill { margin-top: 0; margin-left: 6px; }
  .sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 6px 8px;
    gap: 4px;
    border-bottom: 1px solid var(--border-dark);
    -webkit-overflow-scrolling: touch;
  }
  .sidebar-nav a {
    border-left: none;
    border-bottom: 3px solid transparent;
    padding: 8px 12px;
    white-space: nowrap;
    font-size: 13px;
  }
  .sidebar-nav a.is-active {
    border-left-color: transparent;
    border-bottom-color: var(--accent-green);
  }
  .sidebar-nav .nav-section { display: none; }
  .sidebar-foot {
    flex-direction: row;
    border-top: none;
    padding: 6px 8px;
    gap: 4px;
    justify-content: flex-end;
  }
  .sidebar-foot a,
  .sidebar-foot button { padding: 8px 12px; font-size: 13px; width: auto; }
  .admin-header {
    padding: 14px 16px;
    flex-wrap: wrap;
  }
  .admin-header h1 { font-size: 18px; }
  .admin-body { padding: 16px 14px 80px; }
  .powered-by { right: 8px; bottom: 8px; font-size: 10px; padding: 4px 9px; }
}
