/* ── Reset & base ──────────────────────────────────────────────────────────── */

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

:root {
  --bg:          #080400;
  --surface:     #130800;
  --surface-2:   #1e0d00;
  --border:      #3a1800;
  --border-soft: #2a1000;
  --orange:      #ff6b1a;
  --orange-dim:  #cc4f0f;
  --yellow:      #ffd166;
  --text:        #fff0e0;
  --text-muted:  #8a5e48;
  --text-dim:    #4a2e1e;
  --live-red:    #ff3d3d;
  --live-glow:   rgba(255, 61, 61, 0.5);
  --radius:      14px;
  --radius-sm:   8px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  padding: 24px 16px 48px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.container {
  width: 100%;
  max-width: 480px;
}

.admin-page .container {
  max-width: 560px;
}

/* ── Header ────────────────────────────────────────────────────────────────── */

header {
  text-align: center;
  margin-bottom: 28px;
}

header h1 {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}

header .tagline {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.admin-badge {
  display: inline-block;
  font-size: 0.45em;
  background: var(--orange);
  color: #000;
  padding: 3px 8px;
  border-radius: 5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: middle;
  margin-left: 6px;
  position: relative;
  top: -2px;
}

/* ── Live badge ────────────────────────────────────────────────────────────── */

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color 0.4s;
}

.live-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
  transition: background 0.4s, box-shadow 0.4s;
}

.live-badge.live {
  color: var(--live-red);
}

.live-badge.live .dot {
  background: var(--live-red);
  animation: livepulse 1.6s ease-in-out infinite;
}

@keyframes livepulse {
  0%   { box-shadow: 0 0 0 0 var(--live-glow); }
  60%  { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */

.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px 22px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
  line-height: 1;
}

.btn:active:not(:disabled) { transform: scale(0.96); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-primary {
  background: var(--orange);
  color: #000;
}
.btn-primary:hover:not(:disabled) { background: #ff8038; }

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

.btn-danger {
  background: #2a0000;
  color: #ff7070;
  border: 1px solid #4a0000;
}
.btn-danger:hover:not(:disabled) { background: #3d0000; }

/* ── Listener page ─────────────────────────────────────────────────────────── */

.radio-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  box-shadow: 0 0 60px rgba(255, 107, 26, 0.04);
}

.radio-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.now-playing-section {
  text-align: center;
}

.now-playing-label {
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 7px;
}

.now-playing-track {
  font-family: 'Courier New', Courier, monospace;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#visualizer {
  width: 100%;
  height: 72px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  display: block;
}

.listener-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.listener-controls .btn {
  min-width: 130px;
}

.volume-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.volume-icon {
  color: var(--text-muted);
  font-size: 0.85rem;
  flex-shrink: 0;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--orange);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--orange);
  border: none;
  cursor: pointer;
}

.radio-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.connection-status {
  margin-top: 10px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-dim);
  min-height: 18px;
}

/* ── Auth form ─────────────────────────────────────────────────────────────── */

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 28px;
  max-width: 340px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-card h2 {
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
}

.auth-card input[type="password"] {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s;
}

.auth-card input[type="password"]:focus {
  border-color: var(--orange);
}

.auth-error {
  color: #ff7070;
  font-size: 0.82rem;
  text-align: center;
  min-height: 18px;
}

/* ── Admin panel ───────────────────────────────────────────────────────────── */

.admin-status-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.admin-now-playing {
  flex: 1;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.admin-listener-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.admin-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.admin-controls .btn {
  flex: 1;
  text-align: center;
}

/* ── Upload zone ───────────────────────────────────────────────────────────── */

.upload-zone {
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 10px;
  user-select: none;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--orange);
  background: rgba(255, 107, 26, 0.04);
}

.upload-zone-icon {
  font-size: 1.8rem;
  margin-bottom: 8px;
}

.upload-zone p {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.upload-zone small {
  display: block;
  margin-top: 4px;
  color: var(--text-dim);
  font-size: 0.76rem;
}

#upload-progress {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.upload-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.upload-item span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-item progress {
  width: 80px;
  height: 3px;
  accent-color: var(--orange);
  flex-shrink: 0;
}

/* ── Queue ─────────────────────────────────────────────────────────────────── */

.queue-header {
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.queue-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  transition: background 0.15s, border-color 0.2s;
  font-size: 0.88rem;
}

.queue-item.current {
  border-color: var(--orange);
  background: rgba(255, 107, 26, 0.07);
}

.queue-item.dragging {
  opacity: 0.4;
}

.queue-item.drag-target {
  border-color: var(--orange);
}

.drag-handle {
  color: var(--text-dim);
  cursor: grab;
  font-size: 1.05rem;
  line-height: 1;
  user-select: none;
  flex-shrink: 0;
  padding: 2px 4px;
}

.drag-handle:active { cursor: grabbing; }

.queue-track-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.queue-item-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.queue-item-actions button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 7px;
  border-radius: 5px;
  font-size: 0.8rem;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}

.queue-item-actions .btn-play-track:hover { color: var(--orange); background: rgba(255,107,26,0.1); }
.queue-item-actions .btn-remove:hover     { color: #ff7070;        background: rgba(255,61,61,0.1); }

.queue-empty-msg {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  padding: 24px 0;
}
