/* =====================================================================
   Pacto – Dark Theme Stylesheet
   ===================================================================== */

/* ── CSS Custom Properties ─────────────────────────────────────────── */
:root {
  --clr-bg:         #0f1117;
  --clr-surface:    #1a1d27;
  --clr-surface-2:  #242736;
  --clr-border:     #2e3147;
  --clr-text:       #e2e4f0;
  --clr-text-muted: #8b8fa8;
  --clr-accent:     #6c63ff;
  --clr-accent-dim: #3d3880;
  --clr-success:    #4caf7d;
  --clr-danger:     #e05252;
  --clr-warning:    #f0a040;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 40px;

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Fira Code', 'Cascadia Code', Consolas, monospace;

  --transition: 150ms ease;
  --header-height: 60px;
  --sidebar-w: 260px;
}

/* ── Reset ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background-color: var(--clr-bg);
  color: var(--clr-text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--clr-accent);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover, a:focus-visible { color: var(--clr-text); }
ul { list-style: none; }

code {
  font-family: var(--font-mono);
  background: var(--clr-surface-2);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: .875em;
}

/* ── Accessibility ─────────────────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border-width: 0;
}
:focus-visible {
  outline: 2px solid var(--clr-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ── Header ────────────────────────────────────────────────────────── */
.site-header {
  height: var(--header-height);
  background: var(--clr-surface);
  border-bottom: 1px solid var(--clr-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--clr-text);
  font-weight: 700;
  font-size: 1.25rem;
}
.logo-icon { width: 28px; height: 28px; fill: var(--clr-accent); flex-shrink: 0; }
.logo-text  { letter-spacing: -.02em; }

.site-nav  { display: flex; gap: var(--space-md); }
.nav-link  { color: var(--clr-text-muted); font-size: .9rem; transition: color var(--transition); }
.nav-link:hover { color: var(--clr-text); }

/* ── Site main & Footer ─────────────────────────────────────────────── */
.site-main {
  flex: 1;
  padding: var(--space-xl) var(--space-lg);
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

/* Viewer page expands to full viewport width with no outer padding */
.viewer-page .site-main {
  max-width: none;
  padding: 0;
}

.site-footer {
  background: var(--clr-surface);
  border-top: 1px solid var(--clr-border);
  padding: var(--space-md) var(--space-lg);
  text-align: center;
  color: var(--clr-text-muted);
  font-size: .85rem;
  flex-shrink: 0;
}

/* ── Hero / Search ─────────────────────────────────────────────────── */
.hero { text-align: center; margin-bottom: var(--space-xl); }

.hero-title {
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -.03em;
  background: linear-gradient(135deg, var(--clr-text) 40%, var(--clr-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-sm);
}

.hero-subtitle {
  color: var(--clr-text-muted);
  font-size: 1.1rem;
  margin-bottom: var(--space-lg);
}

.search-wrapper {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
}

.search-input {
  width: 100%;
  padding: 14px 20px;
  background: var(--clr-surface);
  border: 2px solid var(--clr-border);
  border-radius: var(--radius-lg);
  color: var(--clr-text);
  font-size: 1rem;
  font-family: var(--font-sans);
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
}
.search-input::placeholder { color: var(--clr-text-muted); }
.search-input:focus {
  outline: none;
  border-color: var(--clr-accent);
  box-shadow: 0 0 0 3px rgba(108,99,255,.18);
}

/* ── Autocomplete ──────────────────────────────────────────────────── */
.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  max-height: 340px;
  overflow-y: auto;
  z-index: 200;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
}

.autocomplete-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 12px var(--space-md);
  cursor: pointer;
  border-bottom: 1px solid var(--clr-border);
  transition: background var(--transition);
  text-decoration: none;
  color: var(--clr-text);
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover,
.autocomplete-item[aria-selected="true"] { background: var(--clr-surface-2); }

.autocomplete-title  { font-weight: 600; flex: 1; }
.autocomplete-artist { color: var(--clr-text-muted); font-size: .875rem; }
.autocomplete-empty {
  padding: var(--space-md);
  color: var(--clr-text-muted);
  text-align: center;
  font-size: .9rem;
}

/* ── Badges ────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .03em;
  background: var(--clr-surface-2);
  color: var(--clr-text-muted);
}
.badge--format { background: var(--clr-accent-dim); color: var(--clr-accent); }

/* ── Section Titles ────────────────────────────────────────────────── */
.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--clr-text);
}

/* ── Tab Grid ──────────────────────────────────────────────────────── */
.tabs-section { margin-bottom: var(--space-xl); }

.tab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-md);
}

.tab-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--transition), transform var(--transition),
              box-shadow var(--transition);
}
.tab-card:hover {
  border-color: var(--clr-accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(108,99,255,.15);
}

.tab-card-link {
  display: block;
  padding: var(--space-md);
  color: var(--clr-text);
}
.tab-card-link:hover { color: var(--clr-text); }

.tab-card-title {
  font-size: 1rem;
  font-weight: 600;
  margin: var(--space-xs) 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tab-card-artist {
  color: var(--clr-text-muted);
  font-size: .875rem;
  margin-bottom: var(--space-xs);
}
.tab-card-meta { font-size: .8rem; color: var(--clr-text-muted); }

/* ── Building notice ───────────────────────────────────────────────── */
.building-notice {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg) var(--space-md);
  color: var(--clr-text-muted);
  font-size: .95rem;
}

.building-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--clr-border);
  border-top-color: var(--clr-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

/* ── Load More ─────────────────────────────────────────────────────── */
.load-more-wrapper {
  display: flex;
  justify-content: center;
  padding: var(--space-md) 0 var(--space-lg);
}

/* ── Empty State ───────────────────────────────────────────────────── */
.empty-state {
  background: var(--clr-surface);
  border: 1px dashed var(--clr-border);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  text-align: center;
  color: var(--clr-text-muted);
  line-height: 2;
}

/* ── Scraper Section ───────────────────────────────────────────────── */
.scraper-section {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
}
.scraper-note {
  color: var(--clr-text-muted);
  font-size: .9rem;
  margin-bottom: var(--space-md);
}
.scraper-row {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}
.scraper-input {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px;
  background: var(--clr-surface-2);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  color: var(--clr-text);
  font-size: .9rem;
  font-family: var(--font-sans);
}
.scraper-input:focus {
  outline: 2px solid var(--clr-accent);
  outline-offset: 2px;
}
.scraper-links {
  margin-top: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.scraper-link-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: .875rem;
  overflow: hidden;
}
.scraper-link-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  color: var(--clr-text-muted);
}
.scraper-status {
  margin-top: var(--space-sm);
  font-size: .875rem;
  color: var(--clr-text-muted);
}
.scraper-status.ok  { color: var(--clr-success); }
.scraper-status.err { color: var(--clr-danger); }

/* ── Buttons ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), opacity var(--transition);
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--clr-accent); color: #fff; }
.btn--primary:hover:not(:disabled) { background: #5549e0; }
.btn--secondary {
  background: var(--clr-surface-2);
  color: var(--clr-text);
  border: 1px solid var(--clr-border);
}
.btn--secondary:hover:not(:disabled) { background: var(--clr-surface); }

/* ═══════════════════════════════════════════════════════════════════════
   VIEWER LAYOUT
   ═══════════════════════════════════════════════════════════════════════ */

/* Two-column grid: sidebar | main – fills the viewport below the header */
.viewer-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100dvh - var(--header-height));
  align-items: start;
  gap: 0;
}

/* ── Sidebar ─────────────────────────────────────────────────────────── */
.viewer-sidebar {
  position: sticky;
  top: var(--header-height);
  height: calc(100dvh - var(--header-height));
  overflow-y: auto;
  background: var(--clr-surface);
  border-right: 1px solid var(--clr-border);
  padding: var(--space-md);
  /* Custom slim scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--clr-border) transparent;
}
.viewer-sidebar::-webkit-scrollbar        { width: 5px; }
.viewer-sidebar::-webkit-scrollbar-track  { background: transparent; }
.viewer-sidebar::-webkit-scrollbar-thumb  { background: var(--clr-border); border-radius: 3px; }

/* ── Main content column ─────────────────────────────────────────────── */
.viewer-main {
  min-width: 0;            /* prevent grid blowout when score is wide */
  padding: var(--space-md) var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* ── Sidebar info blocks ─────────────────────────────────────────────── */
.tab-info-title  { font-size: 1.1rem; font-weight: 700; margin-bottom: 2px; }
.tab-info-artist { color: var(--clr-text-muted); font-size: .9rem; }
.tab-info-album  { color: var(--clr-text-muted); font-size: .85rem; margin-top: 2px; }

.tab-info-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px var(--space-sm);
  margin-top: var(--space-md);
  font-size: .85rem;
}
.tab-info-meta dt { color: var(--clr-text-muted); }
.tab-info-meta dd { font-weight: 600; }

.sidebar-section-title {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--clr-text-muted);
  margin: var(--space-md) 0 var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.track-hint {
  font-size: .68rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  opacity: .7;
}

/* ── Track list ────────────────────────────────────────────────────── */
.track-list { display: flex; flex-direction: column; gap: 2px; }

.track-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  cursor: pointer;
  transition: background var(--transition);
  user-select: none;
}
.track-item:hover { background: var(--clr-surface-2); }
.track-item--active { background: var(--clr-accent-dim); color: var(--clr-accent); }
.track-item--all {
  border-bottom: 1px solid var(--clr-border);
  margin-bottom: 4px;
  padding-bottom: 8px;
}

.track-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}
.track-item--audio-off .track-name { opacity: .38; }

/* ── Mute / Solo buttons ───────────────────────────────────────────── */
.track-btns  { display: flex; gap: 3px; flex-shrink: 0; }
.track-btn {
  width: 22px; height: 22px;
  border-radius: 4px;
  border: 1px solid var(--clr-border);
  background: transparent;
  color: var(--clr-text-muted);
  font-size: .7rem;
  font-weight: 800;
  cursor: pointer;
  padding: 0; line-height: 1;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.track-btn:hover { border-color: var(--clr-text); color: var(--clr-text); }
.track-btn--mute.active {
  background: var(--clr-danger);
  border-color: var(--clr-danger);
  color: #fff;
}
.track-btn--solo.active {
  background: var(--clr-warning);
  border-color: var(--clr-warning);
  color: #111;
}

/* ── Player Controls bar ───────────────────────────────────────────── */
.player-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs) var(--space-md);
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  position: sticky;
  top: calc(var(--header-height) + var(--space-sm));
  z-index: 10;
}

.ctrl-btn {
  width: 40px; height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--clr-surface-2);
  border: 1px solid var(--clr-border);
  border-radius: 50%;
  cursor: pointer;
  transition: background var(--transition);
  flex-shrink: 0;
}
.ctrl-btn svg { width: 20px; height: 20px; fill: var(--clr-text); }
.ctrl-btn:hover { background: var(--clr-accent-dim); }
.ctrl-btn--play.playing { background: var(--clr-accent); }
.ctrl-btn--play.playing svg { fill: #fff; }
.ctrl-btn--zoom {
  width: 28px; height: 28px;
  font-size: 1.1rem; font-weight: 700;
  line-height: 1;
  border-radius: var(--radius-sm);
}

.tempo-control,
.zoom-control {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-wrap: nowrap;
}
.ctrl-label {
  font-size: .8rem;
  color: var(--clr-text-muted);
  min-width: 36px;
  text-align: right;
  white-space: nowrap;
}

.tempo-slider,
.zoom-slider {
  -webkit-appearance: none;
  width: 90px; height: 4px;
  background: var(--clr-border);
  border-radius: 2px;
  cursor: pointer;
  flex-shrink: 0;
}
.tempo-slider::-webkit-slider-thumb,
.zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--clr-accent);
  cursor: pointer;
}
.tempo-slider::-moz-range-thumb,
.zoom-slider::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--clr-accent);
  border: none;
  cursor: pointer;
}

.playback-state {
  margin-left: auto;
  font-size: .8rem;
  color: var(--clr-text-muted);
  letter-spacing: .03em;
}

/* ── Sidebar toggle (mobile only – visible via @media below) ─────────── */
.sidebar-toggle {
  display: none;
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  background: var(--clr-surface-2);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition);
}
.sidebar-toggle:hover { background: var(--clr-accent-dim); }
.sidebar-toggle svg { width: 18px; height: 18px; fill: var(--clr-text); }

/* ── Sidebar backdrop overlay (mobile) ──────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: var(--header-height) 0 0 0;
  background: rgba(0,0,0,.55);
  z-index: 49;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.sidebar-overlay.visible { display: block; }

/* ── alphaTab score container ────────────────────────────────────────── */
.alphatab-container {
  background: #111318;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 400px;
  /* Dynamic height: fills viewport minus header + sticky controls + fretboard */
  max-height: calc(100dvh - var(--header-height) - 200px);
  padding: var(--space-sm) 0;
}

.at-main {
  overflow: visible;
  width: 100%;
}

/* Force alphaTab SVG background to match container */
.at-surface,
.at-main svg { background-color: #111318 !important; }

/* Thicker staff/bar lines for dark-theme legibility.
   Only <line> elements (staff lines, stems, barlines) get the stroke boost.
   Paths (note heads, rests) and rects must NOT receive extra stroke — they
   are filled shapes with no stroke by design, and adding one distorts them. */
.at-main svg line { stroke-width: 1.5 !important; }

/* ── alphaTab playback cursors ─────────────────────────────────────── */
.at-cursor-bar {
  background: rgba(108, 99, 255, 0.20) !important;
  border-left: 3px solid rgba(108, 99, 255, 0.70) !important;
}

/* Beat cursor: alphaTab controls size via CSS transform, so do NOT
   set width/height here — only color and glow filter. */
.at-cursor-beat {
  background: #a89fff !important;
  filter: drop-shadow(0 0 6px rgba(108,99,255,0.95))
          drop-shadow(0 0 16px rgba(108,99,255,0.6)) !important;
  opacity: 1 !important;
}

/* ── Fretboard ────────────────────────────────────────────────────── */
.fretboard-wrapper {
  background: #0d0f14;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.fretboard-header {
  display: flex;
  align-items: center;
  padding: var(--space-xs) var(--space-md);
  border-bottom: 1px solid var(--clr-border);
  gap: var(--space-sm);
}

.fretboard-label {
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--clr-text-muted);
}

.fretboard-svg {
  display: block;
  width: 100%;
  height: auto;
}

/* ── Download button ──────────────────────────────────────────────── */
.download-btn { align-self: flex-start; }

/* ── Error Page ────────────────────────────────────────────────────── */
.error-page { text-align: center; padding: var(--space-xl); }
.error-code {
  font-size: 6rem;
  font-weight: 900;
  color: var(--clr-accent);
  line-height: 1;
}
.error-message {
  color: var(--clr-text-muted);
  margin: var(--space-md) 0 var(--space-lg);
  font-size: 1.1rem;
}

/* ═══════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════ */

/* Narrow sidebar on medium screens */
@media (max-width: 1100px) {
  :root { --sidebar-w: 220px; }
}

/* Tablet / mobile: sidebar becomes a slide-in drawer */
@media (max-width: 768px) {
  /* Collapse to single column */
  .viewer-layout {
    grid-template-columns: 1fr;
  }

  /* Sidebar: fixed drawer, slides in from the left */
  .viewer-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: min(280px, 85vw);
    height: calc(100dvh - var(--header-height));
    transform: translateX(-100%);
    transition: transform 240ms cubic-bezier(.4, 0, .2, 1);
    z-index: 50;
    border-right: 1px solid var(--clr-accent-dim);
    border-radius: 0;
    box-shadow: 6px 0 32px rgba(0,0,0,.7);
  }
  .viewer-sidebar.open { transform: translateX(0); }

  /* Show sidebar toggle button inside the controls bar */
  .sidebar-toggle { display: flex; }

  /* Tighter main content on mobile */
  .viewer-main {
    padding: var(--space-sm) var(--space-md);
    gap: var(--space-sm);
  }

  /* Compact controls */
  .player-controls {
    padding: var(--space-xs) var(--space-sm);
    gap: var(--space-xs) var(--space-sm);
    top: calc(var(--header-height) + 4px);
    border-radius: var(--radius-sm);
  }

  .tempo-slider, .zoom-slider { width: 70px; }
  .ctrl-label { min-width: 30px; }

  .alphatab-container {
    max-height: calc(100dvh - var(--header-height) - 220px);
    min-height: 320px;
  }
}

/* Small mobile: index page tweaks */
@media (max-width: 500px) {
  .site-main { padding: var(--space-md); }
  .tab-grid  { grid-template-columns: 1fr; }
  .scraper-row { flex-direction: column; }
  .scraper-input { width: 100%; }

  /* Hide zoom on very small screens to save space */
  .zoom-control { display: none; }
}

/* ── Legal pages (Terms / Privacy) ─────────────────────────────────── */
.legal-page {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
}

.legal-page h1 {
  font-size: 2rem;
  margin-bottom: var(--space-sm);
}

.legal-date {
  color: var(--clr-text-muted);
  font-size: 0.875rem;
  margin-bottom: var(--space-xl);
}

.legal-page section {
  margin-bottom: var(--space-xl);
}

.legal-page h2 {
  font-size: 1.2rem;
  color: var(--clr-accent);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--clr-border);
}

.legal-page h3 {
  font-size: 1rem;
  color: var(--clr-text);
  margin: var(--space-md) 0 var(--space-sm);
}

.legal-page p {
  margin-bottom: var(--space-md);
  color: var(--clr-text);
  line-height: 1.75;
}

.legal-page ul {
  margin: var(--space-sm) 0 var(--space-md) var(--space-lg);
  line-height: 1.75;
}

.legal-page ul li {
  margin-bottom: var(--space-xs);
}

.legal-page a {
  color: var(--clr-accent);
  text-decoration: underline;
}

.legal-page a:hover {
  color: var(--clr-text);
}

.legal-table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-md) 0;
  font-size: 0.875rem;
}

.legal-table th,
.legal-table td {
  text-align: left;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--clr-border);
}

.legal-table th {
  background: var(--clr-surface-2);
  color: var(--clr-text-muted);
  font-weight: 600;
}

.legal-table tr:nth-child(even) td {
  background: var(--clr-surface);
}

/* ── Footer legal links ─────────────────────────────────────────────── */
.footer-legal {
  margin-top: var(--space-sm);
  font-size: 0.8rem;
}

.footer-legal a {
  color: var(--clr-text-muted);
  text-decoration: none;
}

.footer-legal a:hover {
  color: var(--clr-text);
}

/* ── Cookie Consent Banner ──────────────────────────────────────────── */
#cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: var(--clr-surface-2);
  border-top: 1px solid var(--clr-border);
  padding: var(--space-md) var(--space-lg);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.4);
}

.cb-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  gap: var(--space-lg);
  align-items: center;
}

.cb-text {
  flex: 1;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--clr-text);
}

.cb-text strong {
  display: block;
  font-size: 1rem;
  margin-bottom: var(--space-xs);
}

.cb-text p {
  margin: var(--space-xs) 0 0;
  color: var(--clr-text-muted);
}

.cb-links a {
  color: var(--clr-accent);
  text-decoration: underline;
}

.cb-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.cb-btn {
  padding: var(--space-sm) var(--space-lg);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity var(--transition);
}

.cb-btn:hover { opacity: 0.85; }

.cb-btn--accept {
  background: var(--clr-accent);
  color: #fff;
}

.cb-btn--decline {
  background: var(--clr-surface);
  color: var(--clr-text-muted);
  border: 1px solid var(--clr-border);
}

/* Footer cookie preferences re-opener */
.footer-cookie-btn {
  background: none;
  border: none;
  color: var(--clr-text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  font-family: inherit;
}

.footer-cookie-btn:hover { color: var(--clr-text); }

@media (max-width: 640px) {
  .cb-inner {
    flex-direction: column;
    align-items: stretch;
  }
  .cb-actions {
    flex-direction: row;
  }
  .cb-btn {
    flex: 1;
    text-align: center;
  }
}

/* ── Contact Page ───────────────────────────────────────────────────── */
.contact-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
}

.contact-hero {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.contact-hero-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.contact-hero-accent {
  color: var(--clr-accent);
}

.contact-hero-sub {
  color: var(--clr-text-muted);
  font-size: 1.05rem;
}

.contact-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: var(--space-xl);
  align-items: start;
}

/* Form */
.contact-form-wrap {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.cf-row { display: flex; gap: var(--space-md); }
.cf-row--2 > * { flex: 1; }

.cf-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.cf-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--clr-text-muted);
}

.cf-required { color: var(--clr-danger); }

.cf-input {
  background: var(--clr-surface-2);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  color: var(--clr-text);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  padding: var(--space-sm) var(--space-md);
  transition: border-color var(--transition);
  width: 100%;
}

.cf-input:focus {
  outline: none;
  border-color: var(--clr-accent);
}

.cf-input::placeholder { color: var(--clr-text-muted); opacity: 0.6; }

.cf-textarea {
  resize: vertical;
  min-height: 140px;
}

.cf-submit {
  align-self: flex-start;
  padding: var(--space-sm) var(--space-xl);
  font-size: 1rem;
}

/* Alerts */
.contact-success,
.contact-error {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-md);
  font-size: 0.9rem;
}

.contact-success {
  background: rgba(76,175,125,0.12);
  border: 1px solid var(--clr-success);
  color: var(--clr-success);
}

.contact-error {
  background: rgba(224,82,82,0.12);
  border: 1px solid var(--clr-danger);
  color: var(--clr-danger);
}

.contact-success svg,
.contact-error svg {
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  max-width: 22px;
  max-height: 22px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.contact-success strong,
.contact-error strong { display: block; margin-bottom: 2px; }
.contact-success p,
.contact-error p { margin: 0; opacity: 0.85; }

/* Info panel */
.contact-info {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
}

.contact-info-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.contact-info-sub {
  color: var(--clr-text-muted);
  font-size: 0.9rem;
  line-height: 1.7;
  margin-bottom: var(--space-lg);
}

.contact-info-sub a { color: var(--clr-accent); }

.contact-details {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.contact-detail-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
}

.contact-detail-icon {
  width: 40px;
  height: 40px;
  background: var(--clr-surface-2);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.contact-detail-icon svg {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  max-width: 18px;
  max-height: 18px;
  fill: none;
  stroke: var(--clr-accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.contact-detail-label {
  display: block;
  font-size: 0.75rem;
  color: var(--clr-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.contact-detail-value {
  font-size: 0.9rem;
  color: var(--clr-text);
  word-break: break-all;
}

a.contact-detail-value {
  color: var(--clr-accent);
  text-decoration: none;
}

a.contact-detail-value:hover { text-decoration: underline; }

@media (max-width: 768px) {
  .contact-layout {
    grid-template-columns: 1fr;
  }
  .cf-row--2 {
    flex-direction: column;
  }
  .contact-hero-title { font-size: 1.8rem; }
}

/* ══════════════════════════════════════════════════════════════════
   Auth & Account pages
   ══════════════════════════════════════════════════════════════════ */

/* ── Flash messages ─────────────────────────────────────────────── */
.flash {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: var(--space-md);
  font-size: 0.9rem;
}
.flash--success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.flash--error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.flash--warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.flash--info    { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ── Auth card ──────────────────────────────────────────────────── */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 60vh;
  padding: var(--space-xl) var(--space-md);
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: var(--space-xl);
  width: 100%;
  max-width: 420px;
}
.auth-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0 0 var(--space-lg);
  color: var(--text-primary);
}
.auth-subtitle {
  color: var(--text-muted);
  margin: -var(--space-md) 0 var(--space-lg);
  font-size: 0.9rem;
}
.auth-alt {
  margin-top: var(--space-lg);
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.auth-alt a { color: var(--accent); }
.auth-link-small { font-size: 0.85rem; color: var(--accent); }

/* ── Forms ──────────────────────────────────────────────────────── */
.auth-form { display: flex; flex-direction: column; gap: var(--space-md); }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group--inline {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}
.form-label { font-size: 0.875rem; font-weight: 500; color: var(--text-primary); }
.form-required { color: #e53e3e; }
.form-hint { font-size: 0.8rem; color: var(--text-muted); }
.form-input {
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color 0.15s;
}
.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108,99,255,0.15);
}
.form-input--file { padding: 0.4rem 0.8rem; cursor: pointer; }
.form-textarea { resize: vertical; min-height: 100px; }
.form-input--inline { padding: 0.35rem 0.6rem; font-size: 0.85rem; max-width: 220px; }
.form-checkbox { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 0.875rem; }

.btn--full { width: 100%; justify-content: center; }
.btn--sm { padding: 0.35rem 0.75rem; font-size: 0.85rem; }
.btn--ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn--ghost:hover { background: var(--surface); color: var(--text-primary); }
.btn--danger {
  background: #e53e3e;
  color: #fff;
  border: none;
}
.btn--danger:hover { background: #c53030; }
.btn--outline {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
}
.btn--outline:hover { background: var(--accent); color: #fff; }

/* ── Nav user menu ──────────────────────────────────────────────── */
.nav-user-menu { position: relative; }
.nav-user-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px 4px 8px;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: background 0.15s;
}
.nav-user-btn:hover { background: var(--surface); }
.nav-user-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.nav-chevron { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.nav-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  list-style: none;
  margin: 0;
  padding: 6px 0;
  min-width: 180px;
  z-index: 1000;
}
.nav-dropdown.open { display: block; }
.nav-dropdown-link {
  display: block;
  padding: 8px 16px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.1s;
}
.nav-dropdown-link:hover { background: var(--bg); }
.nav-dropdown-link--admin { color: var(--accent); font-weight: 500; }
.nav-dropdown-btn {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.nav-dropdown-sep { height: 1px; background: var(--border); margin: 4px 0; }
.nav-link--login { margin-right: 4px; }
.nav-register-btn { padding: 6px 14px; font-size: 0.875rem; }

/* ── Account pages ──────────────────────────────────────────────── */
.account-container {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-md);
}
.account-header { margin-bottom: var(--space-xl); }
.account-header h1 { font-size: 2rem; margin: 0 0 6px; }
.account-subtitle { color: var(--text-muted); margin: 0; }

/* Tab cards grid */
.tab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-md);
}
.tab-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.tab-card-body { flex: 1; }
.tab-card-title { font-size: 1rem; margin: 0 0 4px; }
.tab-card-title a { color: var(--text-primary); text-decoration: none; }
.tab-card-title a:hover { color: var(--accent); }
.tab-card-artist { font-size: 0.85rem; color: var(--text-muted); margin: 0; }
.tab-card-meta { font-size: 0.78rem; color: var(--text-muted); margin: 4px 0 0; }
.tab-card-action { display: flex; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--space-xl) var(--space-lg);
  color: var(--text-muted);
}
.empty-state a { margin-top: var(--space-md); display: inline-block; }

/* Settings sections */
.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}
.settings-section--danger { border-color: #e53e3e33; }
.settings-section-title { font-size: 1.1rem; margin: 0 0 var(--space-md); }
.settings-desc { color: var(--text-muted); font-size: 0.9rem; margin-bottom: var(--space-md); }

/* Danger details/summary */
.danger-details > summary { cursor: pointer; }
.danger-details > summary::-webkit-details-marker { display: none; }

/* Submissions table */
.submissions-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.submissions-table th {
  text-align: left;
  padding: 8px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
}
.submissions-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.sub-filename { font-family: monospace; font-size: 0.8rem; word-break: break-all; }
.sub-date { white-space: nowrap; color: var(--text-muted); }
.sub-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: capitalize;
}
.sub-badge--pending  { background: #fff3cd; color: #856404; }
.sub-badge--approved { background: #d4edda; color: #155724; }
.sub-badge--rejected { background: #f8d7da; color: #721c24; }
.sub-reason-row td { padding: 4px 10px 10px; }
.sub-reason { color: #721c24; font-size: 0.82rem; font-style: italic; }

/* Admin moderation */
.mod-tabs { display: flex; gap: var(--space-sm); margin-top: var(--space-md); }
.mod-tab {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.875rem;
  text-decoration: none;
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: background 0.15s;
}
.mod-tab--active { background: var(--accent); color: #fff; border-color: var(--accent); }
.mod-tab:hover:not(.mod-tab--active) { background: var(--surface); }
.mod-list { display: flex; flex-direction: column; gap: var(--space-md); }
.mod-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: var(--space-md);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
}
.mod-card-info { flex: 1; }
.mod-card-title { font-size: 1rem; font-weight: 600; margin-bottom: 4px; }
.mod-card-meta { font-size: 0.82rem; color: var(--text-muted); }
.mod-card-notes { font-size: 0.82rem; color: var(--text-muted); margin-top: 6px; }
.mod-card-notes--reason { color: #721c24; }
.mod-card-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; flex-shrink: 0; }
.mod-reject-form { display: flex !important; flex-direction: column; gap: 4px; }

/* Library button in viewer */
.library-btn { font-size: 0.9rem; }

@media (max-width: 600px) {
  .auth-card { padding: var(--space-lg); }
  .mod-card { flex-direction: column; }
  .mod-card-actions { width: 100%; align-items: flex-start; }
  .tab-grid { grid-template-columns: 1fr; }
  .nav-register-btn { display: none; }
}
