/* ── Flavly Admin Dashboard — Dark Theme ─────────────────────────── */

:root {
  --bg: #0e0f11;
  --surface: #15161a;
  --surface-hover: #1c1d22;
  --surface-alt: #1a1b20;
  --border: #2a2b30;
  --gold: #d4a843;
  --gold-dim: rgba(212, 168, 67, 0.15);
  --gold-text: #e8c56a;
  --green: #4caf50;
  --green-dim: rgba(76, 175, 80, 0.15);
  --red: #ef5350;
  --red-dim: rgba(239, 83, 80, 0.15);
  --blue: #42a5f5;
  --blue-dim: rgba(66, 165, 245, 0.15);
  --orange: #ff9800;
  --orange-dim: rgba(255, 152, 0, 0.15);
  --text: #e8e6e0;
  --text-soft: #9e9a92;
  --text-muted: #6b6760;
  --font-heading: 'Syne', sans-serif;
  --font-mono: 'Inconsolata', monospace;
  --font-body: 'Lato', sans-serif;
  --sidebar-width: 220px;
  --radius: 10px;
  --radius-sm: 6px;
}

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

html, body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

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

/* ── Login ────────────────────────────────────────────────────────── */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: var(--bg);
}

.login-card {
  text-align: center;
  padding: 48px 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 360px;
  width: 90%;
}

.login-logo {
  font-family: var(--font-heading);
  font-size: 36px;
  font-weight: 600;
  margin-bottom: 4px;
}

.logo-flav { color: var(--text); }
.logo-ly { color: var(--gold); font-style: italic; }
.logo-admin {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-left: 6px;
}

.login-subtitle {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 32px;
}

.google-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 28px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.google-btn:hover {
  background: var(--gold-dim);
  border-color: var(--gold);
}

.login-footer {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 24px;
}

/* ── Dashboard Layout ─────────────────────────────────────────────── */
.dashboard {
  display: flex;
  height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  overflow-y: auto;
}

.sidebar-logo {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 600;
  padding: 0 20px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.nav-links { list-style: none; flex: 1; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: var(--text-soft);
  text-decoration: none;
  font-size: 13px;
  font-weight: 400;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.nav-link:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.nav-link.active {
  color: var(--gold);
  background: var(--gold-dim);
  border-left-color: var(--gold);
  font-weight: 700;
}

.nav-icon { font-size: 15px; width: 20px; text-align: center; }

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

.admin-email {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signout-btn {
  font-size: 12px;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.signout-btn:hover { color: var(--red); border-color: var(--red); }

/* ── Mobile Header ────────────────────────────────────────────────── */
.mobile-header {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.hamburger {
  font-size: 20px;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
}

.mobile-logo { font-family: var(--font-heading); font-size: 18px; font-weight: 600; }
.mobile-title {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-left: auto;
}

/* ── Content ──────────────────────────────────────────────────────── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
}

.page { display: none; }
.page.active { display: block; }

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

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.card-subtitle {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ── KPI Grid ─────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.kpi-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.kpi-value {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 700;
  color: var(--gold);
}

.kpi-delta {
  font-family: var(--font-mono);
  font-size: 11px;
  margin-top: 4px;
}

.kpi-delta.positive { color: var(--green); }
.kpi-delta.negative { color: var(--red); }

/* ── Tables ───────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-soft);
  vertical-align: middle;
}

tr:hover td { background: var(--surface-hover); }

/* ── Badges & Pills ───────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.badge-gold { background: var(--gold-dim); color: var(--gold-text); }
.badge-green { background: var(--green-dim); color: var(--green); }
.badge-red { background: var(--red-dim); color: var(--red); }
.badge-blue { background: var(--blue-dim); color: var(--blue); }
.badge-orange { background: var(--orange-dim); color: var(--orange); }

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  background: var(--surface);
  color: var(--text);
}

.btn:hover { background: var(--surface-hover); }

.btn-gold { border-color: var(--gold); color: var(--gold); }
.btn-gold:hover { background: var(--gold-dim); }

.btn-green { border-color: var(--green); color: var(--green); }
.btn-green:hover { background: var(--green-dim); }

.btn-red { border-color: var(--red); color: var(--red); }
.btn-red:hover { background: var(--red-dim); }

.btn-sm { padding: 5px 10px; font-size: 11px; }

/* ── Activity Feed ────────────────────────────────────────────────── */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.activity-text { font-size: 13px; color: var(--text-soft); flex: 1; }
.activity-time { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* ── Photo Queue ──────────────────────────────────────────────────── */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.photo-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.photo-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.photo-card-body { padding: 12px; }

.photo-card-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.photo-card-actions {
  display: flex;
  gap: 8px;
}

/* ── Feedback List ────────────────────────────────────────────────── */
.feedback-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.feedback-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.feedback-message {
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.5;
}

.feedback-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* ── Charts ───────────────────────────────────────────────────────── */
.chart-container {
  position: relative;
  height: 260px;
}

/* ── Map ──────────────────────────────────────────────────────────── */
.map-container {
  height: 400px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

/* ── Section Headers ──────────────────────────────────────────────── */
.section-header {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text);
}

.section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ── Grid Layouts ─────────────────────────────────────────────────── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
}

/* ── Select / Input ───────────────────────────────────────────────── */
.input, .select {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 7px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  outline: none;
}

.input:focus, .select:focus { border-color: var(--gold); }

/* ── Loading Spinner ──────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.loading-center {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  gap: 10px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ── Empty State ──────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ── Toast ────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
  animation: slideIn 0.3s ease;
  max-width: 340px;
}

.toast.success { border-color: var(--green); }
.toast.error { border-color: var(--red); }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Pagination ───────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  justify-content: center;
}

/* ── Report Sections ──────────────────────────────────────────────── */
.report-section {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.report-section:last-child { border-bottom: none; }

.report-section h4 {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 10px;
}

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .dashboard { flex-direction: column; }

  .sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    bottom: 0;
    width: 260px;
    z-index: 1000;
    transition: left 0.25s ease;
  }

  .sidebar.open { left: 0; }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
  }

  .mobile-header { display: flex; }

  .content { padding: 16px; }

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

  .kpi-grid { grid-template-columns: repeat(2, 1fr); }

  .chart-container { height: 200px; }

  .map-container { height: 280px; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .photo-grid { grid-template-columns: 1fr; }
}

/* ── MFA Flow ─────────────────────────────────────────────────────────
 * Used by admin-frontend/pages/mfa.js — enroll, QR, verify,
 * backup-codes, lost-phone, exhausted screens.
 * Reuses: --surface, --surface-hover, --border, --gold, --gold-dim,
 *          --text, --text-soft, --text-muted, --red, --font-mono.
 */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mfa-card {
  max-width: 440px;
  padding: 40px 36px;
}

.mfa-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-top: 20px;
  margin-bottom: 8px;
  letter-spacing: -0.2px;
}

.mfa-subtitle {
  font-size: 14px;
  color: var(--text-soft);
  line-height: 1.5;
  margin-bottom: 20px;
}

.mfa-apps-header {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  text-align: left;
  margin: 16px 0 8px;
}

.mfa-apps-list {
  list-style: none;
  text-align: left;
  margin-bottom: 24px;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.8;
  padding-left: 4px;
}

.mfa-apps-list li::before {
  content: "·";
  color: var(--gold);
  margin-right: 8px;
}

.mfa-btn {
  width: 100%;
  justify-content: center;
  margin-top: 12px;
}

.mfa-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: var(--surface-hover);
  border-color: var(--border);
}

.mfa-btn:disabled:hover {
  background: var(--surface-hover);
  border-color: var(--border);
}

.mfa-error {
  font-size: 13px;
  color: var(--red);
  margin-top: 12px;
  text-align: center;
}

.mfa-input {
  display: block;
  width: 100%;
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 18px;
  letter-spacing: 4px;
  text-align: center;
  color: var(--text);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 16px 0 8px;
  outline: none;
}

.mfa-input:focus {
  border-color: var(--gold);
}

.mfa-input-mono {
  letter-spacing: 3px;
}

.mfa-qr-wrap {
  display: flex;
  justify-content: center;
  padding: 16px;
  background: #ffffff;
  border-radius: var(--radius-sm);
  margin: 16px 0;
}

.mfa-qr {
  display: block;
}

.mfa-manual {
  margin: 12px 0 16px;
  padding: 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: left;
}

.mfa-secret {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--gold-text);
  word-break: break-all;
  user-select: all;
}

.mfa-backup-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 20px 0 16px;
}

.mfa-backup-code {
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--gold-text);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  user-select: all;
}

.mfa-backup-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.mfa-action-btn {
  flex: 1;
  padding: 8px 12px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.mfa-action-btn:hover {
  color: var(--gold);
  border-color: var(--gold);
}

.mfa-saved-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  margin: 12px 0;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-soft);
  text-align: left;
  line-height: 1.5;
  cursor: pointer;
}

.mfa-saved-label input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--gold);
  flex-shrink: 0;
}

.mfa-link-btn {
  display: inline-block;
  margin-top: 12px;
  padding: 4px 0;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
}

.mfa-link-btn:hover {
  color: var(--gold);
  text-decoration-color: var(--gold);
}
