/* ═══════════════════════════════════════════════════════════════
   Scoobez Music — Dark-theme stylesheet
   ═══════════════════════════════════════════════════════════════ */

/* ── Custom properties ─────────────────────────────────────── */
:root {
  --bg:            #0d0d0d;
  --surface:       #181818;
  --surface-2:     #222222;
  --surface-3:     #2a2a2a;
  --border:        #333333;
  --accent:        #e8ff00;
  --accent-dim:    #b0c400;
  --text-primary:  #f0f0f0;
  --text-secondary:#a0a0a0;
  --text-muted:    #666666;
  --danger:        #ff4d4d;
  --radius-sm:     6px;
  --radius:        12px;
  --radius-lg:     20px;
  --shadow:        0 4px 24px rgba(0,0,0,0.6);
  --shadow-card:   0 2px 12px rgba(0,0,0,0.5);
  --transition:    0.2s ease;
  --font-sans:     system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono:     'SF Mono', 'Fira Code', monospace;
  --max-width:     1200px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { display: block; max-width: 100%; }
button { cursor: pointer; border: none; background: none; font: inherit; }
input, button { font-family: inherit; }
a { color: inherit; text-decoration: none; }

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

.hidden { display: none !important; }

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px;
}

/* ── Header ─────────────────────────────────────────────────── */
.site-header {
  background: linear-gradient(180deg, #111 0%, #0d0d0d 100%);
  border-bottom: 1px solid var(--border);
  padding: 24px 0 20px;
}

.header-inner {
  display: flex;
  align-items: baseline;
  gap: 24px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.logo-text {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: var(--accent);
  text-transform: uppercase;
}

.logo-sub {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.tagline {
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* ── Controls bar ───────────────────────────────────────────── */
.controls-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.search-wrap {
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}

#search-input {
  width: 100%;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 8px 14px;
  font-size: 0.9rem;
  transition: border-color var(--transition);
  outline: none;
}

#search-input:focus {
  border-color: var(--accent);
}

#search-input::placeholder {
  color: var(--text-muted);
}

.filter-wrap {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-btn {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-secondary);
  padding: 5px 14px;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: all var(--transition);
}

.filter-btn:hover {
  border-color: var(--accent-dim);
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 700;
}

/* ── Loading / Error / Empty states ────────────────────────── */
.loading-state,
.error-state,
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 80px 24px;
  color: var(--text-muted);
}

.error-icon {
  font-size: 2.5rem;
  color: var(--danger);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--surface-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner.small {
  width: 18px;
  height: 18px;
  border-width: 2px;
  display: inline-block;
}

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

/* ── Sets grid ──────────────────────────────────────────────── */
.sets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  padding: 32px 0 48px;
}

/* ── Set card ───────────────────────────────────────────────── */
.set-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  cursor: pointer;
}

.set-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: var(--accent-dim);
}

.set-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.card-cover-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--surface-3);
}

.card-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.set-card:hover .card-cover {
  transform: scale(1.04);
}

.card-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  color: var(--text-muted);
  background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
}

.card-play-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition);
}

.set-card:hover .card-play-overlay {
  opacity: 1;
}

.card-play-icon {
  width: 56px;
  height: 56px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: #000;
  padding-left: 4px;
}

.card-body {
  padding: 16px;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-family: var(--font-mono);
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-block;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  padding: 2px 8px;
}

.tag.genre {
  background: rgba(232, 255, 0, 0.08);
  border-color: rgba(232, 255, 0, 0.25);
  color: var(--accent-dim);
}

/* ── Modal ──────────────────────────────────────────────────── */
.set-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(6px);
}

.modal-content {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 760px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  width: 36px;
  height: 36px;
  background: var(--surface-3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: var(--text-secondary);
  transition: all var(--transition);
  line-height: 1;
}

.modal-close:hover {
  background: var(--danger);
  color: #fff;
}

.modal-hero {
  display: flex;
  gap: 24px;
  padding: 28px;
}

.modal-cover {
  width: 160px;
  height: 160px;
  min-width: 160px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--surface-3);
}

.modal-meta {
  flex: 1;
  min-width: 0;
}

.modal-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 6px;
  line-height: 1.2;
}

.modal-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 12px;
}

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.modal-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ── Audio player ───────────────────────────────────────────── */
.player-container {
  padding: 0 28px 20px;
  border-bottom: 1px solid var(--border);
}

.player-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.player-loading,
.player-error {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.player-error {
  color: var(--danger);
}

.audio-player {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

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

.player-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition), background var(--transition);
}

.player-btn:hover { transform: scale(1.08); }
.player-btn:active { transform: scale(0.96); }

.player-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.mute-btn {
  width: 32px;
  height: 32px;
  background: var(--surface-3);
  color: var(--text-secondary);
  border-radius: 50%;
}

.mute-btn svg {
  width: 16px;
  height: 16px;
}

.player-progress-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.time-display {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  min-width: 38px;
}

.progress-bar-wrap {
  flex: 1;
  cursor: pointer;
  padding: 8px 0;
}

.progress-bar-track {
  position: relative;
  height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s linear;
}

.progress-bar-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 50%;
  left: 0%;
  transition: left 0.1s linear;
  box-shadow: 0 0 6px rgba(232,255,0,0.5);
}

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

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 70px;
  height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  background: var(--text-secondary);
  border-radius: 50%;
  cursor: pointer;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #000;
}

.btn-primary:hover {
  background: var(--accent-dim);
}

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

.btn-secondary:hover {
  border-color: var(--accent-dim);
  color: var(--accent);
}

.btn-small {
  padding: 5px 12px;
  font-size: 0.78rem;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Tracklist ──────────────────────────────────────────────── */
.tracklist-section {
  padding: 24px 28px 28px;
}

.tracklist-heading {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.tracklist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  counter-reset: track;
}

.tracklist li {
  counter-increment: track;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.tracklist li:hover {
  background: var(--surface-2);
}

.tracklist li.track-active {
  background: var(--surface-3);
  box-shadow: inset 3px 0 0 var(--accent);
}

.tracklist li.track-active .track-title {
  color: var(--accent);
}

.tracklist li::before {
  content: counter(track);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: right;
}

.track-info {
  min-width: 0;
}

.track-title {
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-artist {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-time {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.track-time-seekable {
  cursor: pointer;
  border-radius: 3px;
  padding: 1px 3px;
  transition: color 0.15s, background 0.15s;
}

.track-time-seekable:hover {
  color: var(--accent, #e8ff00);
  background: rgba(232, 255, 0, 0.08);
}

/* ── Footer ─────────────────────────────────────────────────── */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 20px 0;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 600px) {
  .logo-text { font-size: 1.4rem; }
  .logo-sub { display: none; }

  .header-inner { gap: 12px; }

  .controls-inner {
    flex-direction: column;
    align-items: stretch;
  }
  .search-wrap { max-width: 100%; }

  .sets-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
  }

  .modal-hero {
    flex-direction: column;
    padding: 20px;
    gap: 16px;
  }

  .modal-cover {
    width: 120px;
    height: 120px;
    min-width: 120px;
  }

  .player-container { padding: 0 20px 20px; }
  .tracklist-section { padding: 20px 20px 24px; }

  .volume-wrap { display: none; }
}

@media (max-width: 380px) {
  .sets-grid {
    grid-template-columns: 1fr;
  }
}
