/* ============================================
   Songwunsch – Dark Music Theme
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg-deep: #09090b;
  --bg-base: #0f0f13;
  --bg-card: #16161d;
  --bg-elevated: #1c1c26;
  --bg-hover: #22222e;
  --border: #2a2a3a;
  --border-light: #3a3a4e;
  --text-primary: #e8e6f0;
  --text-secondary: #9895a8;
  --text-muted: #6b6880;
  --accent: #8b5cf6;
  --accent-glow: #a78bfa;
  --accent-dim: #6d28d9;
  --accent-bg: rgba(139, 92, 246, 0.08);
  --green: #22c55e;
  --green-bg: rgba(34, 197, 94, 0.1);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.1);
  --yellow: #eab308;
  --yellow-bg: rgba(234, 179, 8, 0.1);
  --blue: #3b82f6;
  --blue-bg: rgba(59, 130, 246, 0.1);
  --orange: #f97316;
  --pink: #ec4899;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.6);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'Outfit', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: 
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(139,92,246,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(59,130,246,0.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

a { color: var(--accent-glow); text-decoration: none; transition: var(--transition); }
a:hover { color: #c4b5fd; }

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

/* ---- Header ---- */
.header {
  background: rgba(15, 15, 19, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--pink));
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.header-actions { display: flex; align-items: center; gap: 12px; }

/* ---- Stream Status Badge ---- */
.stream-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stream-badge.live {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid rgba(239,68,68,0.2);
}

.stream-badge.live::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  animation: pulse-dot 1.5s infinite;
}

.stream-badge.offline {
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.stream-badge.paused {
  background: var(--yellow-bg);
  color: var(--yellow);
  border: 1px solid rgba(234,179,8,0.2);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 12px rgba(139,92,246,0.3);
}
.btn-primary:hover { background: var(--accent-glow); transform: translateY(-1px); }

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-light); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-hover); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { padding: 8px; width: 36px; height: 36px; }

.btn-success { background: var(--green); color: white; }
.btn-success:hover { background: #16a34a; }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #dc2626; }

/* ---- Main Container ---- */
.container { max-width: 1200px; margin: 0 auto; padding: 32px 24px; position: relative; z-index: 1; }

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: var(--transition);
}
.card:hover { border-color: var(--border-light); }

/* ---- Offline Page ---- */
.offline-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  text-align: center;
  gap: 24px;
}

.offline-icon {
  width: 120px;
  height: 120px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.offline-page h2 { font-size: 28px; font-weight: 700; }
.offline-page p { color: var(--text-secondary); font-size: 16px; max-width: 500px; }

/* ---- Hero Section ---- */
.hero {
  text-align: center;
  padding: 48px 0 32px;
}

.hero h1 {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-glow) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}

.hero p { color: var(--text-secondary); font-size: 16px; max-width: 600px; margin: 0 auto; }

/* ---- Toolbar / Filters ---- */
.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 24px;
}

.search-box {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  transition: var(--transition);
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.15);
}

.search-box::before {
  content: '🔍';
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  pointer-events: none;
}

select, .select {
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239895a8'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

select:focus { outline: none; border-color: var(--accent); }

/* ---- Song Cards ---- */
.song-grid { display: flex; flex-direction: column; gap: 12px; }

.song-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: var(--transition);
  cursor: default;
}

.song-card:hover { border-color: var(--border-light); background: var(--bg-elevated); }
.song-card.is-live { border-color: rgba(239,68,68,0.3); background: rgba(239,68,68,0.03); }

.song-rank {
  min-width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border-radius: var(--radius);
}

.song-rank.top { color: var(--accent-glow); background: var(--accent-bg); }

.song-info { flex: 1; min-width: 0; }
.song-title { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-artist { color: var(--text-secondary); font-size: 14px; }
.song-meta { display: flex; gap: 12px; margin-top: 6px; flex-wrap: wrap; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tag-guitar { background: var(--yellow-bg); color: var(--yellow); }
.tag-piano { background: var(--blue-bg); color: var(--blue); }
.tag-either { background: var(--accent-bg); color: var(--accent-glow); }
.tag-pending { background: var(--yellow-bg); color: var(--yellow); }
.tag-approved { background: var(--green-bg); color: var(--green); }
.tag-queued { background: var(--blue-bg); color: var(--blue); }
.tag-live { background: var(--red-bg); color: var(--red); }
.tag-played { background: var(--bg-elevated); color: var(--text-muted); }
.tag-rejected { background: var(--red-bg); color: var(--red); }

.vote-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 16px;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font);
  min-width: 60px;
}

.vote-btn:hover { border-color: var(--accent); color: var(--accent-glow); }
.vote-btn.voted { background: var(--accent-bg); border-color: var(--accent); color: var(--accent-glow); }

.vote-count { font-weight: 700; font-size: 18px; line-height: 1; }
.vote-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; }

/* ---- Forms / Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.2s;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 90%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s;
}

.modal h2 { font-size: 22px; font-weight: 700; margin-bottom: 20px; }
.modal h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; color: var(--text-secondary); }

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

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }

.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  transition: var(--transition);
}

.form-group input:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.15);
}

.form-group textarea { resize: vertical; min-height: 80px; }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

/* ---- Toast Notifications ---- */
.toast-container { position: fixed; top: 80px; right: 24px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }

.toast {
  padding: 12px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s, fadeOut 0.3s 2.7s;
  max-width: 360px;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--blue); }

@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
@keyframes fadeOut { to { opacity: 0; transform: translateX(30px); } }

/* ---- Auth Section ---- */
.auth-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
}

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--pink));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
}

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-size: 18px; color: var(--text-secondary); margin-bottom: 8px; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .header { padding: 0 16px; }
  .container { padding: 20px 16px; }
  .hero h1 { font-size: 28px; }
  .song-card { flex-wrap: wrap; padding: 16px; gap: 12px; }
  .song-rank { display: none; }
  .toolbar { flex-direction: column; }
  .search-box { width: 100%; }
}

/* ---- Tabs ---- */
.tabs { display: flex; gap: 4px; margin-bottom: 24px; background: var(--bg-card); border-radius: var(--radius); padding: 4px; }
.tab {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: none;
  font-family: var(--font);
}
.tab:hover { color: var(--text-primary); }
.tab.active { background: var(--accent); color: white; }

/* ---- Counter Badge ---- */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
}
.badge-accent { background: var(--accent); color: white; }
.badge-red { background: var(--red); color: white; }
