/* ── Master Schedule Admin Console ─────────────────────────────────────────
   admin/styles.css
   ─────────────────────────────────────────────────────────────────────────── */

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

:root {
  --admin-accent:    #4f46e5;   /* indigo — distinct from main app blue */
  --admin-accent-dk: #3730a3;
  --admin-accent-lt: #e0e7ff;
  --admin-danger:    #dc2626;
  --admin-danger-lt: #fee2e2;
  --admin-warn:      #d97706;
  --admin-warn-lt:   #fef3c7;
  --admin-success:   #16a34a;
  --admin-success-lt:#dcfce7;

  --sidebar-w: 220px;
  --topbar-h:  52px;

  --gray-50:  #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: var(--gray-800);
  background: var(--gray-100);
}

body { min-height: 100vh; }

/* ── Auth screens ─────────────────────────────────────────────────────────── */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-900);
}

.auth-card {
  background: white;
  border-radius: 12px;
  padding: 40px;
  width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.auth-card h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 4px;
}

.auth-card .subtitle {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 28px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.auth-card .badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--admin-accent-lt);
  color: var(--admin-accent);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  margin-bottom: 24px;
}

.auth-card input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 10px;
  outline: none;
  transition: border-color .15s;
}

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

.btn-primary {
  width: 100%;
  padding: 10px;
  background: var(--admin-accent);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  margin-top: 4px;
}

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

.auth-error {
  background: var(--admin-danger-lt);
  border: 1px solid #fca5a5;
  color: var(--admin-danger);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  margin-bottom: 12px;
}

/* ── Shell ────────────────────────────────────────────────────────────────── */
.admin-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Topbar ───────────────────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--gray-900);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.topbar-logo {
  font-size: 15px;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-logo .logo-badge {
  font-size: 10px;
  font-weight: 700;
  background: var(--admin-accent);
  color: white;
  padding: 2px 7px;
  border-radius: 10px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.topbar-spacer { flex: 1; }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gray-400);
  font-size: 12px;
}

.topbar-user .avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--admin-accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.topbar-signout {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  color: var(--gray-400);
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
}

.topbar-signout:hover {
  background: rgba(255,255,255,.14);
  color: white;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  width: var(--sidebar-w);
  bottom: 0;
  background: var(--gray-800);
  overflow-y: auto;
  padding: 16px 0;
  z-index: 90;
}

.sidebar-section {
  padding: 0 12px;
  margin-bottom: 4px;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--gray-500);
  padding: 8px 8px 4px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 7px;
  color: var(--gray-400);
  font-size: 13px;
  cursor: pointer;
  transition: all .12s;
  width: 100%;
  background: none;
  border: none;
  text-align: left;
}

.sidebar-item:hover {
  background: rgba(255,255,255,.06);
  color: white;
}

.sidebar-item.active {
  background: var(--admin-accent);
  color: white;
}

.sidebar-item svg { flex-shrink: 0; opacity: .8; }
.sidebar-item.active svg { opacity: 1; }

/* ── Main content ─────────────────────────────────────────────────────────── */
.main-content {
  margin-top: var(--topbar-h);
  margin-left: var(--sidebar-w);
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  min-height: calc(100vh - var(--topbar-h));
}

/* ── Page header ──────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-900);
}

.page-header .page-meta {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 2px;
}

/* ── Cards & tables ───────────────────────────────────────────────────────── */
.card {
  background: white;
  border-radius: 10px;
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-header h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-800);
}

.card-body { padding: 20px; }

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

.data-table thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--gray-500);
  padding: 10px 16px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}

.data-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13px;
  color: var(--gray-700);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--gray-50); }

/* ── Stat cards ───────────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 20px;
}

.stat-card .stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--gray-500);
  margin-bottom: 8px;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1;
}

.stat-card .stat-sub {
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 4px;
}

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green  { background: var(--admin-success-lt); color: var(--admin-success); }
.badge-red    { background: var(--admin-danger-lt);  color: var(--admin-danger);  }
.badge-yellow { background: var(--admin-warn-lt);    color: var(--admin-warn);    }
.badge-blue   { background: var(--admin-accent-lt);  color: var(--admin-accent);  }
.badge-gray   { background: var(--gray-100);          color: var(--gray-600);     }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .12s;
}

.btn-sm { padding: 4px 10px; font-size: 12px; }

.btn-default {
  background: white;
  border-color: var(--gray-300);
  color: var(--gray-700);
}
.btn-default:hover { background: var(--gray-50); border-color: var(--gray-400); }

.btn-accent {
  background: var(--admin-accent);
  color: white;
}
.btn-accent:hover { background: var(--admin-accent-dk); }

.btn-danger {
  background: var(--admin-danger);
  color: white;
}
.btn-danger:hover { background: #b91c1c; }

.btn-god {
  background: #7c3aed;
  color: white;
}
.btn-god:hover { background: #6d28d9; }

/* ── Search / filter bar ──────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-bar input {
  padding: 7px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  width: 260px;
  transition: border-color .15s;
}

.filter-bar input:focus { border-color: var(--admin-accent); }

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-400);
}

.empty-state svg { margin: 0 auto 12px; opacity: .3; }
.empty-state p { font-size: 13px; }

/* ── Loading ──────────────────────────────────────────────────────────────── */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: var(--gray-400);
  font-size: 13px;
  gap: 10px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--admin-accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}

/* ── God Mode banner ──────────────────────────────────────────────────────── */
.god-mode-banner {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  font-size: 13px;
}

.god-mode-banner strong { font-weight: 700; }
.god-mode-banner .gm-spacer { flex: 1; }

/* ── Confirm dialog ───────────────────────────────────────────────────────── */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.confirm-dialog {
  background: white;
  border-radius: 10px;
  padding: 28px;
  width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.confirm-dialog h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}

.confirm-dialog p {
  font-size: 13px;
  color: var(--gray-600);
  margin-bottom: 20px;
  line-height: 1.5;
}

.confirm-dialog .btn-row {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }
