/* ═══════════════════════════════════════════════════════
   GigRequest — Stage-light aesthetic
   Warm amber tones, dark backdrop, big touch targets
   ═══════════════════════════════════════════════════════ */

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

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

:root {
  --bg:          #0d0d12;
  --bg-card:     #16161e;
  --bg-elevated: #1e1e28;
  --border:      #2a2a38;
  --text:        #e8e4dd;
  --text-dim:    #8a8690;
  --accent:      #e6a54a;
  --accent-glow: #e6a54a44;
  --accent-hover:#f0b860;
  --green:       #4ecb71;
  --green-dim:   #4ecb7133;
  --red:         #e85d5d;
  --red-dim:     #e85d5d22;
  --blue:        #5d9fe8;
  --blue-dim:    #5d9fe822;
  --radius:      12px;
  --radius-sm:   8px;
  --font-body:   'DM Sans', system-ui, sans-serif;
  --font-display:'Playfair Display', Georgia, serif;
  --shadow:      0 2px 12px rgba(0,0,0,.4);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── Ambient background glow ──────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, var(--accent-glow), transparent 70%),
    radial-gradient(ellipse 40% 50% at 80% 20%, #e85d5d11, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ─── Layout shell ─────────────────────────────────────── */
.app {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px 100px;
}

/* ─── Header ───────────────────────────────────────────── */
.header {
  text-align: center;
  padding: 32px 0 24px;
}

.header h1 {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 2rem;
  letter-spacing: -0.02em;
  color: var(--accent);
  line-height: 1.1;
}

.header p {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-top: 6px;
}

.header-nav {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}

.header-nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: all 0.2s;
}

.header-nav a:hover,
.header-nav a.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-glow);
}

/* ─── Search bar ───────────────────────────────────────── */
.search-wrap {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding: 12px 0;
}

.search-wrap::after {
  content: '';
  position: absolute;
  bottom: -16px;
  left: 0; right: 0;
  height: 16px;
  background: linear-gradient(var(--bg), transparent);
  pointer-events: none;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 16px;
  transition: border-color 0.2s;
}

.search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-bar svg {
  flex-shrink: 0;
  color: var(--text-dim);
}

.search-bar input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1rem;
  padding: 14px 0;
  outline: none;
  font-family: var(--font-body);
}

.search-bar input::placeholder {
  color: var(--text-dim);
}

/* ─── Sort toggle ──────────────────────────────────────── */
.sort-bar {
  display: flex;
  gap: 6px;
  margin: 8px 0 12px;
}

.sort-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  font-size: 0.8rem;
  font-family: var(--font-body);
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.sort-btn:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

.sort-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-glow);
}

/* ─── Song count ───────────────────────────────────────── */
.song-count {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 8px;
}

/* ─── Song list ────────────────────────────────────────── */
.song-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.song-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: all 0.15s;
}

.song-item:hover {
  border-color: var(--border);
  background: var(--bg-elevated);
}

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

.song-title {
  font-weight: 600;
  font-size: 1.15rem;
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-artist {
  font-size: 1.1rem;
  color: var(--text-dim);
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Request button ───────────────────────────────────── */
.btn-request {
  flex-shrink: 0;
  background: var(--accent);
  color: #0d0d12;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.00rem;
  padding: 9px 16px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-request:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-request:active {
  transform: translateY(0);
}

.btn-request:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-request.sent {
  background: var(--green);
  color: #0d0d12;
}

/* ─── Modal overlay ────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 28px 24px 36px;
  width: 100%;
  max-width: 480px;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(.22,.68,0,1.02);
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--accent);
  margin-bottom: 4px;
}

.modal .modal-song {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-bottom: 20px;
}

.modal label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.modal input[type="text"] {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1.1rem;
  font-family: var(--font-body);
  padding: 14px 16px;
  outline: none;
  transition: border-color 0.2s;
}

.modal input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.btn-submit {
  flex: 1;
  background: var(--accent);
  color: #0d0d12;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  padding: 14px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-submit:hover { background: var(--accent-hover); }
.btn-submit:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-cancel {
  background: var(--bg-card);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 14px 20px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-cancel:hover { color: var(--text); border-color: var(--text-dim); }

/* ─── Toast notification ───────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: var(--green);
  color: #0d0d12;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 14px 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 200;
  transition: transform 0.3s cubic-bezier(.22,.68,0,1.02);
  white-space: nowrap;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  background: var(--red);
  color: #fff;
}

/* ─── Queue page ───────────────────────────────────────── */
.queue-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.queue-item {
  background: var(--bg-card);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  transition: all 0.15s;
}

.queue-item:hover {
  border-color: var(--border);
}

.queue-item.now-playing {
  border-color: var(--green);
  background: var(--green-dim);
}

.queue-item.up-next {
  border-color: var(--blue);
  background: var(--blue-dim);
}

.queue-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.queue-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.queue-badge.now-playing {
  background: var(--green);
  color: #0d0d12;
}

.queue-badge.up-next {
  background: var(--blue);
  color: #0d0d12;
}

.queue-item .song-title {
  flex: 1;
}

.queue-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.queue-empty {
  text-align: center;
  color: var(--text-dim);
  padding: 60px 20px;
  font-size: 0.95rem;
}

.queue-empty span {
  display: block;
  font-size: 2.5rem;
  margin-bottom: 12px;
}

/* ─── Section divider ──────────────────────────────────── */
.section-divider {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 20px 0 8px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
}

.queue-item.played {
  opacity: 0.5;
}

/* ─── Admin controls ───────────────────────────────────── */
.admin-controls {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.admin-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: 0.75rem;
  padding: 5px 10px;
  cursor: pointer;
  transition: all 0.15s;
}

.admin-btn:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

.admin-btn.play { color: var(--green); border-color: var(--green-dim); }
.admin-btn.play:hover { background: var(--green-dim); }
.admin-btn.next { color: var(--blue); border-color: var(--blue-dim); }
.admin-btn.next:hover { background: var(--blue-dim); }
.admin-btn.done { color: var(--text-dim); }
.admin-btn.remove { color: var(--red); border-color: var(--red-dim); }
.admin-btn.remove:hover { background: var(--red-dim); }

/* ─── Login form ───────────────────────────────────────── */
.login-box {
  max-width: 360px;
  margin: 80px auto 0;
  text-align: center;
}

.login-box h2 {
  font-family: var(--font-display);
  color: var(--accent);
  margin-bottom: 8px;
}

.login-box p {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-bottom: 20px;
}

.login-box input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  padding: 14px 16px;
  outline: none;
  font-family: var(--font-body);
  margin-bottom: 12px;
}

.login-box input:focus {
  border-color: var(--accent);
}

.login-box button {
  width: 100%;
  background: var(--accent);
  color: #0d0d12;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  padding: 14px;
  cursor: pointer;
}

/* ─── Auto-refresh indicator ───────────────────────────── */
.refresh-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.refresh-dot {
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  animation: pulse 2s ease infinite;
}

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

/* ─── Utility ──────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

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