/* ============================================================
   SoundRequest — Clean Minimal DJ Dashboard
   Theme: Deep charcoal + warm white text + single lime accent
   Font: DM Sans + DM Mono
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&family=DM+Mono:wght@400;500&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg:           #0e0e10;
  --surface:      #18181b;
  --surface-2:    #222226;
  --surface-3:    #2a2a2f;
  --border:       #2c2c31;
  --border-light: #36363d;

  --accent:       #b8f54a;
  --accent-dim:   rgba(184, 245, 74, 0.10);
  --accent-hover: #caff5f;

  --text-1:  #f2f2ef;
  --text-2:  #a0a0a8;
  --text-3:  #5c5c66;

  --danger:      #e05757;
  --danger-dim:  rgba(224, 87, 87, 0.12);
  --success:     #4fc98a;
  --success-dim: rgba(79, 201, 138, 0.12);
  --warning:     #e0a54a;
  --warning-dim: rgba(224, 165, 74, 0.12);
  --info:        #5a9cf5;
  --info-dim:    rgba(90, 156, 245, 0.12);

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;

  --sidebar-w: 230px;
  --transition: 0.15s ease;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg: 0 12px 28px rgba(0,0,0,0.55);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body, body.dark-mode {
  font-family: 'DM Sans', sans-serif;
  background-color: var(--bg);
  color: var(--text-1);
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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

/* ── Loading Screen ────────────────────────────────────────── */
.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  z-index: 9999;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 2px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

.loading-screen p {
  color: var(--text-2);
  font-size: 0.8125rem;
  letter-spacing: 0.03em;
}

/* ── Layout ────────────────────────────────────────────────── */
.app-container {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0.75rem;
  overflow-y: auto;
  position: relative;
  z-index: 100;
}

.sidebar-header {
  padding: 0 0.5rem 1.25rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-close-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 1.125rem;
  cursor: pointer;
  padding: 0.3rem;
  border-radius: var(--radius-sm);
  line-height: 1;
  transition: color var(--transition), background var(--transition);
}

.sidebar-close-btn:hover { color: var(--text-1); background: var(--surface-2); }

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: -0.01em;
}

.logo-container i { color: var(--accent); font-size: 1.1rem; }

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.6rem 0.75rem;
  color: var(--text-2);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  position: relative;
}

.nav-item i {
  width: 1rem;
  text-align: center;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.nav-item:hover { background: var(--surface-2); color: var(--text-1); }

.nav-item.active { background: var(--accent-dim); color: var(--accent); }

.badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  padding: 0.1rem 0.45rem;
  border-radius: 99px;
  font-size: 0.6875rem;
  font-weight: 600;
  font-family: 'DM Mono', monospace;
  min-width: 1.35rem;
  text-align: center;
}

/* Sidebar Footer */
.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 1rem;
  margin-top: 1rem;
  border-top: 1px solid var(--border);
}

.user-profile { display: flex; align-items: center; gap: 0.625rem; flex: 1; min-width: 0; }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
  letter-spacing: 0.03em;
}

.user-info { flex: 1; min-width: 0; }

.user-info h4 {
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-1);
}

.user-info p { font-size: 0.6875rem; color: var(--success); margin: 0; }

.logout-btn {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 0.875rem;
  padding: 0.375rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  flex-shrink: 0;
}

.logout-btn:hover { color: var(--danger); background: var(--danger-dim); }

/* ── Main Content ──────────────────────────────────────────── */
.main-content { display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }

/* ── Top Bar ───────────────────────────────────────────────── */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1.75rem;
  height: 58px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  gap: 1rem;
  flex-shrink: 0;
}

.top-bar-left { display: flex; align-items: center; gap: 0.875rem; }

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-1);
  font-size: 1.125rem;
  cursor: pointer;
}

.top-bar-left h1 { font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; }

.top-bar-right { display: flex; align-items: center; gap: 0.5rem; }

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  color: var(--text-2);
  padding: 0.3rem 0.75rem;
  background: var(--surface-2);
  border-radius: 99px;
  border: 1px solid var(--border);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s ease infinite;
}

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.icon-btn {
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  position: relative;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover { background: var(--surface-2); color: var(--text-1); }

.notification-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--danger);
  color: #fff;
  border-radius: 50%;
  width: 15px;
  height: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 700;
}

/* ── Content Area ──────────────────────────────────────────── */
.content-area { flex: 1; overflow-y: auto; padding: 1.75rem; }

/* ── Views ─────────────────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.view-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.view-header h2 { font-size: 1rem; font-weight: 600; }

/* Filter Controls */
.filter-controls {
  display: flex;
  gap: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.filter-btn {
  padding: 0.35rem 0.875rem;
  background: transparent;
  border: none;
  color: var(--text-2);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  transition: background var(--transition), color var(--transition);
}

.filter-btn:hover { color: var(--text-1); }
.filter-btn.active { background: var(--surface-3); color: var(--text-1); }

.filter-badge {
  display: inline-block;
  background: var(--surface-3);
  color: var(--text-2);
  border-radius: 99px;
  font-size: 0.625rem;
  font-weight: 600;
  font-family: 'DM Mono', monospace;
  padding: 0.05rem 0.4rem;
  margin-left: 0.3rem;
  min-width: 1.1rem;
  text-align: center;
  vertical-align: middle;
  line-height: 1.5;
}

.filter-badge:empty { display: none; }

.filter-btn[data-filter="pending"] .filter-badge { background: var(--warning-dim); color: var(--warning); }
.filter-btn[data-filter="accepted"] .filter-badge { background: var(--success-dim); color: var(--success); }
.filter-btn[data-filter="played"] .filter-badge { background: var(--accent-dim); color: var(--accent); }
.filter-btn[data-filter="all"] .filter-badge { background: var(--info-dim); color: var(--info); }

.action-buttons { display: flex; gap: 0.5rem; }

/* ── Request Cards ─────────────────────────────────────────── */
.requests-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.request-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.request-card:hover { border-color: var(--border-light); box-shadow: var(--shadow-sm); }

.request-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }

.request-info h3 { font-size: 0.9375rem; font-weight: 600; margin-bottom: 0.2rem; line-height: 1.3; }

.request-artist { font-size: 0.8125rem; color: var(--text-2); }

.status-badge {
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
}

.status-badge.pending  { background: var(--warning-dim); color: var(--warning); }
.status-badge.accepted { background: var(--success-dim); color: var(--success); }
.status-badge.rejected { background: var(--danger-dim);  color: var(--danger);  }
.status-badge.played   { background: var(--accent-dim);  color: var(--accent);  }

.request-body { display: flex; gap: 0.875rem; }

.thumbnail {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--surface-3);
  flex-shrink: 0;
}

.request-meta { flex: 1; display: flex; flex-direction: column; gap: 0.3rem; }

.meta-item { display: flex; gap: 0.4rem; font-size: 0.8125rem; align-items: center; }

.meta-item i { width: 0.9rem; text-align: center; color: var(--text-3); font-size: 0.75rem; }

.meta-label { color: var(--text-2); }
.meta-value { color: var(--text-1); font-weight: 500; }

.note-section {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  color: var(--text-2);
  max-height: 56px;
  overflow-y: auto;
  font-style: italic;
}

.request-actions { display: flex; gap: 0.5rem; margin-top: auto; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  font-size: 0.8125rem;
  font-family: 'DM Sans', sans-serif;
  transition: opacity var(--transition), background var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn:active { opacity: 0.8; }

.btn-primary { background: var(--accent); color: #0e0e10; font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-success { background: var(--success-dim); color: var(--success); border: 1px solid rgba(79,201,138,0.25); }
.btn-success:hover { background: rgba(79,201,138,0.22); }

.btn-danger { background: var(--danger-dim); color: var(--danger); border: 1px solid rgba(224,87,87,0.25); }
.btn-danger:hover { background: rgba(224,87,87,0.22); }

.btn-secondary { background: var(--surface-2); color: var(--text-1); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface-3); }

.btn-youtube { background: rgba(255,0,0,0.1); color: #ff4444; border: 1px solid rgba(255,0,0,0.25); text-decoration: none; }
.btn-youtube:hover { background: rgba(255,0,0,0.2); }

.btn-sm   { padding: 0.325rem 0.65rem; font-size: 0.75rem; }
.btn-block { width: 100%; justify-content: center; }

/* ── Empty State ───────────────────────────────────────────── */
.empty-state { grid-column: 1 / -1; text-align: center; padding: 4rem 2rem; color: var(--text-3); }
.empty-state i { font-size: 2rem; margin-bottom: 0.875rem; display: block; }
.empty-state p { font-size: 0.875rem; }

/* ── Queue ─────────────────────────────────────────────────── */
.queue-list { display: flex; flex-direction: column; gap: 0.625rem; }

.queue-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: grab;
  transition: border-color var(--transition);
}

.queue-item:hover { border-color: var(--border-light); }
.queue-item.dragging { opacity: 0.45; }

.queue-position {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-2);
  font-family: 'DM Mono', monospace;
  flex-shrink: 0;
}

.queue-content { flex: 1; min-width: 0; }
.queue-title { font-size: 0.875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-subtitle { font-size: 0.8125rem; color: var(--text-2); margin-top: 0.15rem; }
.queue-duration { font-size: 0.8125rem; color: var(--text-3); font-family: 'DM Mono', monospace; flex-shrink: 0; }

.queue-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.875rem;
  transition: border-color var(--transition);
}
.queue-card:hover { border-color: var(--border-light); }

.queue-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}
.queue-thumb-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  flex-shrink: 0;
}
.queue-info { flex: 1; min-width: 0; }
.queue-info h3 { font-size: 0.9375rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0 0 0.2rem; }
.queue-info p { font-size: 0.8125rem; color: var(--text-2); margin: 0 0 0.25rem; }
.queue-requester { font-size: 0.75rem; color: var(--text-3); }
.queue-requester i { margin-right: 0.25rem; }

/* ── Analytics ─────────────────────────────────────────────── */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.stat-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.875rem; }

.stat-label { font-size: 0.8125rem; color: var(--text-2); font-weight: 500; }

.stat-header i { font-size: 1rem; color: var(--text-3); }

.stat-value {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text-1);
  line-height: 1;
  font-family: 'DM Mono', monospace;
}

.stat-subtitle { font-size: 0.75rem; color: var(--text-3); margin-top: 0.4rem; }

.chart-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.chart-container h3 { font-size: 0.875rem; font-weight: 600; color: var(--text-1); margin-bottom: 1.25rem; }

.status-breakdown { display: flex; flex-direction: column; gap: 0.875rem; }

.status-item {
  display: grid;
  grid-template-columns: 90px 1fr 40px;
  align-items: center;
  gap: 0.875rem;
}

.status-label { font-size: 0.8125rem; color: var(--text-2); font-weight: 500; }

.progress-bar { height: 5px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }

.progress-fill { height: 100%; border-radius: 99px; transition: width 0.4s ease; }
.progress-fill.accepted { background: var(--success); }
.progress-fill.pending  { background: var(--warning); }
.progress-fill.rejected { background: var(--danger);  }
.progress-fill.played   { background: var(--accent);  }

.status-item > span:last-child {
  font-size: 0.8125rem;
  color: var(--text-2);
  font-family: 'DM Mono', monospace;
  text-align: right;
}

/* ── Settings ──────────────────────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.settings-card h3 { font-size: 0.875rem; font-weight: 600; margin-bottom: 1.25rem; color: var(--text-1); }

.setting-group { margin-bottom: 1.125rem; }

.setting-group label {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.3rem;
}

.setting-group input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; accent-color: var(--accent); }

.setting-group input[type="text"],
.setting-group input[type="number"],
.setting-group input[type="email"] {
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-size: 0.875rem;
  font-family: 'DM Sans', sans-serif;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.setting-group input[type="text"]:focus,
.setting-group input[type="number"]:focus,
.setting-group input[type="email"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.help-text { font-size: 0.75rem; color: var(--text-3); margin-top: 0.3rem; }

.qr-code-container {
  text-align: center;
  padding: 1.5rem 1rem;
  background: var(--surface-2);
  border-radius: var(--radius);
  margin-bottom: 0.875rem;
  border: 1px solid var(--border);
}

/* ── Modals ────────────────────────────────────────────────── */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: #0e0e10;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active { display: flex; animation: fadeIn 0.2s ease; }

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease;
}

@keyframes slideUp {
  from { transform: translateY(14px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* Auth Modal */
.auth-modal { width: 100%; max-width: 380px; padding: 2rem; }

/* PIN Modal */
.pin-modal {
  width: 100%;
  max-width: 360px;
  padding: 2.25rem 2rem;
  text-align: center;
}
.pin-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}
.pin-icon i {
  font-size: 1.375rem;
  color: var(--accent);
}
.pin-modal-header h2 { margin: 0 0 0.375rem; font-size: 1.25rem; }
.pin-modal-header p  { color: var(--text-2); font-size: 0.875rem; margin: 0; }

.pin-inputs {
  display: flex;
  justify-content: center;
  gap: 0.875rem;
  margin: 2rem 0 0.625rem;
}
.pin-input {
  width: 56px;
  height: 64px;
  text-align: center;
  font-size: 1.75rem;
  font-weight: 700;
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-1);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), transform 0.1s;
  caret-color: transparent;
}
.pin-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.pin-input.filled {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-2));
}

@keyframes pin-shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}
.pin-inputs.shake { animation: pin-shake 0.4s ease; }

.pin-error {
  color: var(--danger);
  font-size: 0.8125rem;
  margin: 0.25rem 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
}
.pin-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.75rem;
  justify-content: center;
}
.pin-actions .btn { min-width: 100px; justify-content: center; }

.auth-header { text-align: center; margin-bottom: 1.75rem; }

.auth-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: -0.02em;
  margin-bottom: 0.3rem;
}

.auth-header p { font-size: 0.8125rem; color: var(--text-2); }

.auth-tabs {
  display: flex;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  flex: 1;
  padding: 0.75rem;
  background: none;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition), border-color var(--transition);
}

.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.auth-form { display: none; }
.auth-form.active { display: block; }

.form-group { margin-bottom: 1.125rem; }

.form-group label { display: block; margin-bottom: 0.4rem; font-size: 0.8125rem; font-weight: 500; color: var(--text-2); }

.form-group input {
  width: 100%;
  padding: 0.625rem 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-size: 0.875rem;
  font-family: 'DM Sans', sans-serif;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input::placeholder { color: var(--text-3); }

.form-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-group small { display: block; margin-top: 0.3rem; color: var(--text-3); font-size: 0.75rem; }

.form-help { text-align: center; font-size: 0.8125rem; color: var(--text-2); margin-top: 1rem; }
.form-help a { color: var(--accent); transition: opacity var(--transition); }
.form-help a:hover { opacity: 0.75; }

/* Request Modal */
.request-modal { width: 100%; max-width: 540px; max-height: 80vh; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.125rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 { font-size: 0.9375rem; font-weight: 600; }

.close-btn {
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color var(--transition);
}

.close-btn:hover { color: var(--text-1); }

.modal-body { padding: 1.5rem; }

.modal-footer {
  display: flex;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
}

/* ── Toasts ────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  animation: slideIn 0.25s ease;
  min-width: 280px;
  max-width: 360px;
  font-size: 0.875rem;
}

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

.toast.success { border-color: rgba(79, 201, 138, 0.35); }
.toast.error   { border-color: rgba(224, 87, 87, 0.35);  }
.toast.warning { border-color: rgba(224, 165, 74, 0.35); }
.toast.info    { border-color: rgba(90, 156, 245, 0.35); }

.toast i { font-size: 1rem; }
.toast.success i { color: var(--success); }
.toast.error   i { color: var(--danger);  }
.toast.warning i { color: var(--warning); }
.toast.info    i { color: var(--info);    }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ── Sidebar Overlay (mobile) ──────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 150;
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
}

.sidebar-overlay.active { display: block; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-container { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    left: calc(-1 * var(--sidebar-w));
    top: 0;
    height: 100%;
    z-index: 200;
    transition: left 0.25s ease;
  }

  .sidebar.open { left: 0; }
  .menu-toggle { display: flex; }

  .top-bar {
    padding: 0 1rem;
    height: auto;
    min-height: 58px;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }

  .top-bar-right { flex-wrap: wrap; gap: 0.375rem; }
  .status-indicator { font-size: 0.75rem; padding: 0.25rem 0.6rem; }

  .content-area { padding: 1rem; }

  .sidebar-close-btn { display: flex; }

  .view-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.625rem;
  }

  .filter-controls { width: 100%; }

  .filter-btn {
    flex: 1;
    justify-content: center;
    white-space: nowrap;
  }

  .action-buttons { width: 100%; justify-content: flex-end; }

  .requests-list { grid-template-columns: 1fr; }
  .analytics-grid { grid-template-columns: repeat(2, 1fr); }
  .settings-grid { grid-template-columns: 1fr; }

  .auth-modal { max-width: 92%; padding: 1.5rem; }
  .request-modal { max-width: 96%; }

  .toast-container { right: 0.75rem; left: 0.75rem; top: 0.75rem; }
  .toast { min-width: auto; max-width: 100%; }

  .notif-panel { width: 280px; right: -0.5rem; }

  .modal-content { margin: 0.75rem; }
}

@media (max-width: 480px) {
  .analytics-grid { grid-template-columns: 1fr; }
  .analytics-row-2 { grid-template-columns: 1fr; }
  .stat-value { font-size: 1.375rem; }
  .filter-controls { flex-wrap: wrap; }
  .action-buttons { flex-wrap: wrap; }
  .view-header h2 { font-size: 0.9375rem; }
  .appearance-grid { grid-template-columns: 1fr; }
  .theme-presets-grid { grid-template-columns: repeat(3, 1fr); }
  .pin-inputs { gap: 0.5rem; }
  .pin-input { width: 48px; height: 56px; font-size: 1.5rem; }
}

/* ── Light Mode ────────────────────────────────────────────── */
body.light-mode {
  --bg:           #f4f4f6;
  --surface:      #ffffff;
  --surface-2:    #f0f0f3;
  --surface-3:    #e8e8ec;
  --border:       #d8d8de;
  --border-light: #c8c8d0;
  --text-1: #111115;
  --text-2: #5c5c70;
  --text-3: #9090a0;
}

/* ── Genre & Tip Badges ────────────────────────────────────── */
.genre-tag {
  display: inline-block;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(184,245,74,.25);
  border-radius: 99px;
  font-size: .6875rem;
  font-weight: 600;
  padding: .15rem .55rem;
  margin-left: .4rem;
  vertical-align: middle;
}

.tip-badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  background: var(--success-dim);
  color: var(--success);
  border: 1px solid rgba(79,201,138,.25);
  border-radius: 99px;
  font-size: .6875rem;
  font-weight: 600;
  padding: .15rem .55rem;
  margin-top: .25rem;
}

/* ── Blacklist ─────────────────────────────────────────────── */
.blacklist-list {
  list-style: none;
  margin-top: .75rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
}

.blacklist-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .625rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .8125rem;
}

.blacklist-type {
  color: var(--accent);
  font-weight: 600;
  min-width: 3rem;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.blacklist-value { flex: 1; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.blacklist-remove {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 1rem;
  padding: 0 .2rem;
  line-height: 1;
  transition: color var(--transition);
  flex-shrink: 0;
}

.blacklist-remove:hover { color: var(--danger); }

.blacklist-add-row {
  display: flex;
  gap: .5rem;
  margin-top: .75rem;
  align-items: center;
}

.blacklist-add-row select,
.blacklist-add-row input {
  padding: .5rem .65rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-size: .8125rem;
  font-family: 'DM Sans', sans-serif;
}

.blacklist-add-row select { width: 90px; flex-shrink: 0; }
.blacklist-add-row input  { flex: 1; }

/* ── Announcement ──────────────────────────────────────────── */
.announcement-textarea {
  width: 100%;
  padding: .625rem .75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-family: 'DM Sans', sans-serif;
  font-size: .875rem;
  resize: vertical;
  min-height: 72px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.announcement-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.announcement-actions { display: flex; gap: .5rem; margin-top: .75rem; }

/* ── Appearance Customizer ─────────────────────────────────── */
.appearance-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}

.appearance-color-row {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.appearance-color-row input[type="color"] {
  width: 36px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
  padding: 2px;
  flex-shrink: 0;
}

.appearance-color-row span {
  font-size: .8125rem;
  color: var(--text-2);
}

/* ── Theme Presets ─────────────────────────────────────────── */
.theme-presets-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .4rem;
  margin-top: .375rem;
}

.theme-preset-card {
  cursor: pointer;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  padding: .4rem .3rem;
  text-align: center;
  background: var(--surface-2);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.theme-preset-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.theme-preset-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.theme-preset-preview {
  width: 100%;
  height: 34px;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
  margin-bottom: .3rem;
}
.theme-preset-inner {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 68%;
  height: 52%;
  border-radius: 3px;
  opacity: .95;
}
.theme-preset-dot {
  position: absolute;
  bottom: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.theme-preset-name {
  font-size: .625rem;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: .01em;
}
.theme-preset-card.active .theme-preset-name {
  color: var(--accent);
}

.settings-card select {
  width: 100%;
  padding: .55rem .75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-size: .875rem;
  font-family: 'DM Sans', sans-serif;
  transition: border-color var(--transition);
}

.settings-card select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
/* ── Analytics ──────────────────────────────────────────────── */
.analytics-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.analytics-toolbar-label {
  font-size: .8125rem;
  color: var(--text-3);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.range-pills {
  display: flex;
  gap: .375rem;
  flex-wrap: wrap;
}
.range-pill {
  padding: .35rem .875rem;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: .8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.range-pill:hover { border-color: var(--border-light); color: var(--text-1); }
.range-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0e0e10;
  font-weight: 600;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: .875rem;
  margin-bottom: 1.25rem;
}

.analytics-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
@media (max-width: 760px) {
  .analytics-row-2 { grid-template-columns: 1fr; }
}

.chart-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.chart-container h3 {
  font-size: .9375rem;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 1rem;
}

/* ── Bar chart (CSS) ────────────────────────────────────────── */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 80px;
  width: 100%;
}
.bar-chart.tall { height: 120px; }

.bar-col {
  flex: 1;
  background: var(--accent-dim);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  transition: background var(--transition);
  position: relative;
  cursor: default;
}
.bar-col:hover { background: rgba(184,245,74,.45); }
.bar-col.peak  { background: var(--accent); }

.bar-chart-labels {
  display: flex;
  gap: 3px;
  margin-top: .375rem;
}
.bar-chart-labels.sparse .bar-label:not(.show) { visibility: hidden; }

.bar-label {
  flex: 1;
  font-size: .5rem;
  color: var(--text-3);
  text-align: center;
  font-family: 'DM Mono', monospace;
  white-space: nowrap;
  overflow: hidden;
}

/* ── Leaderboard ────────────────────────────────────────────── */
.leaderboard { display: flex; flex-direction: column; gap: .5rem; }

.lb-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem .625rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  transition: background var(--transition);
}
.lb-item:hover { background: var(--surface-3); }

.lb-rank {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .6875rem;
  font-weight: 700;
  color: var(--text-3);
  font-family: 'DM Mono', monospace;
  flex-shrink: 0;
}
.lb-rank.gold   { background: rgba(224,165,74,.2); border-color: var(--warning); color: var(--warning); }
.lb-rank.silver { background: rgba(160,160,168,.15); border-color: var(--text-3); color: var(--text-2); }
.lb-rank.bronze { background: rgba(184,245,74,.1); border-color: rgba(184,245,74,.3); color: var(--accent); }

.lb-thumb {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--surface-3);
  flex-shrink: 0;
}
.lb-thumb-placeholder {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  font-size: .75rem;
  flex-shrink: 0;
}

.lb-info { flex: 1; min-width: 0; }
.lb-title {
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb-sub {
  font-size: .75rem;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-count {
  font-size: .8125rem;
  font-weight: 700;
  color: var(--accent);
  font-family: 'DM Mono', monospace;
  flex-shrink: 0;
  background: var(--accent-dim);
  padding: .15rem .5rem;
  border-radius: 99px;
}

.analytics-empty {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-3);
  font-size: .875rem;
}

/* ── Notification panel ─────────────────────────────────────── */
.notif-wrapper {
  position: relative;
}

.notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 300px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  overflow: hidden;
}

.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .6rem .875rem;
  border-bottom: 1px solid var(--border);
  font-size: .8125rem;
  font-weight: 600;
  color: var(--text-1);
}

.notif-clear-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: .75rem;
  color: var(--text-3);
  padding: 0;
}
.notif-clear-btn:hover { color: var(--accent); }

.notif-list {
  list-style: none;
  max-height: 320px;
  overflow-y: auto;
}

.notif-empty {
  padding: 1.25rem .875rem;
  text-align: center;
  font-size: .8125rem;
  color: var(--text-3);
}

.notif-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: .6rem .875rem;
  border-bottom: 1px solid var(--border);
  font-size: .8125rem;
}
.notif-item:last-child { border-bottom: none; }

.notif-msg { color: var(--text-1); line-height: 1.4; }
.notif-time { color: var(--text-3); font-size: .6875rem; font-family: 'DM Mono', monospace; }

.notif-item.notif-info .notif-msg::before  { content: '♪ '; color: var(--accent); }
.notif-item.notif-error .notif-msg::before { content: '⚠ '; color: var(--danger); }

/* ── Admin / Dashboard page nav links ───────────────────────── */
[data-admin-only],
[data-dashboard-only] {
  display: none; /* hidden by default; JS reveals correct set after load */
}

.nav-link-page {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: .75rem;
  margin-top: .5rem;
  opacity: .75;
}
.nav-link-page:hover { opacity: 1; background: var(--surface-2); color: var(--text-1); }
