/* ==========================================================================
   Wedding Songs by Vinniz — Shared Stylesheet
   Direction: Midnight Lime, rebuilt as neo-brutalist blocks (hard borders,
   offset shadows, flat fills, sharp corners) fused with Spotify's circular
   transport controls and pill tags. No blur, no transparency — every
   surface is a flat, confident block.
   ========================================================================== */

:root {
  --bg: #0A0E12;
  --surface: #151B21;
  --surface-2: #1B232B;
  --lime: #C6FF3D;
  --lime-dim: #9FD62F;
  --ink: #000000;
  --text: #EAEDEF;
  --text-2: #8B949B;
  --border: #2A333C;
  --danger: #FF5C5C;
  --radius: 6px;
  --radius-sm: 4px;
  --shadow: 4px 4px 0 var(--ink);
  --shadow-lime: 5px 5px 0 var(--lime);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
}

a { color: var(--lime); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: 'Syne', 'Inter', sans-serif;
  margin: 0 0 0.4em 0;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}
h1 { font-size: 32px; letter-spacing: -0.02em; }

p { color: var(--text-2); line-height: 1.5; }

::selection { background: var(--lime); color: var(--ink); }

/* ---------- Layout shell ---------- */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: 104px; /* room for persistent player bar */
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 3px solid var(--ink);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 50;
}

.brand {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.brand .accent { color: var(--lime); }

.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.container { padding: 24px; max-width: 1200px; margin: 0 auto; width: 100%; }

/* ---------- Buttons — flat neo-brutalist blocks ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius);
  border: 2px solid var(--ink);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  cursor: pointer;
  position: relative;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  text-decoration: none;
  box-shadow: 3px 3px 0 var(--ink);
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--ink); text-decoration: none; }
.btn:active { transform: translate(0, 0); box-shadow: 1px 1px 0 var(--ink); }

.btn-primary {
  background: var(--lime);
  color: var(--ink);
  border-color: var(--ink);
}
.btn-primary:hover { background: var(--lime-dim); box-shadow: 5px 5px 0 var(--ink); }

.btn-ghost {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: none;
}
.btn-ghost:hover { border-color: var(--lime); box-shadow: 3px 3px 0 var(--lime); transform: translate(-2px, -2px); }

.btn-danger { border-color: var(--danger); color: var(--danger); background: var(--surface); }
.btn-danger:hover { box-shadow: 3px 3px 0 var(--danger); }

.btn-sm { padding: 6px 12px; font-size: 11px; }

/* ---------- Cards — flat blocks, hard borders ---------- */
.card {
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  padding: 20px;
}

.glass-panel {
  background: var(--surface);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lime);
}

/* ---------- Forms ---------- */
input, select, textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--lime);
  box-shadow: 3px 3px 0 var(--lime);
}
label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 6px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; }
.field { margin-bottom: 16px; }

/* ---------- Category tree ---------- */
.tree { list-style: none; padding: 0; margin: 0; }
.tree-node { margin-bottom: 4px; }
.tree-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--surface);
  border: 2px solid var(--border);
  transition: border-color 0.12s ease, transform 0.12s ease;
  font-weight: 600;
}
.tree-toggle:hover { border-color: var(--lime); transform: translateX(2px); }
.tree-toggle.is-custom { border-color: var(--lime-dim); border-style: dashed; }
.tree-toggle .chevron { transition: transform 0.2s ease; color: var(--text-2); font-weight: 800; }
.tree-toggle.open .chevron { transform: rotate(90deg); color: var(--lime); }
.tree-children { margin-left: 20px; margin-top: 6px; display: none; border-left: 2px solid var(--border); padding-left: 12px; }
.tree-children.open { display: block; }

/* ---------- Song list / rows ---------- */
.song-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  margin-bottom: 8px;
  background: var(--surface);
  transition: border-color 0.12s ease, background 0.12s ease;
}
.song-row:hover { border-color: var(--lime); background: var(--surface-2); }
.song-row.locked { opacity: 0.5; }
.song-thumb { width: 46px; height: 46px; border-radius: var(--radius-sm); object-fit: cover; background: var(--surface-2); border: 2px solid var(--ink); flex-shrink: 0; }
.song-meta { flex: 1; min-width: 0; }
.song-title { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-artist { font-size: 12px; color: var(--text-2); }

.badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px; /* pill — the Spotify tag reference */
  background: var(--lime);
  color: var(--ink);
  border: 2px solid var(--ink);
}
.badge-locked { background: var(--surface-2); color: var(--text-2); border-color: var(--border); }

/* ---------- Persistent player bar — the signature element ---------- */
.player-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 92px;
  background: var(--surface);
  border-top: 3px solid var(--ink);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 18px;
  z-index: 100;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}
.player-bar.active { transform: translateY(0); }
.player-thumb {
  width: 56px; height: 56px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 2px solid var(--ink);
  flex-shrink: 0;
}
.player-info { min-width: 0; width: 180px; }
.player-info .t { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-info .a { font-size: 11px; color: var(--text-2); }
.player-controls { display: flex; align-items: center; gap: 14px; flex: 1; flex-direction: column; justify-content: center; }
.player-buttons { display: flex; align-items: center; gap: 18px; }
.player-buttons button {
  background: none; border: none; color: var(--text); cursor: pointer;
  width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  transition: transform 0.12s ease, background 0.12s ease;
}
.player-buttons button:hover { background: var(--surface-2); transform: scale(1.08); }
.player-buttons .play-pause {
  background: var(--lime); color: var(--ink); width: 44px; height: 44px;
  border: 2px solid var(--ink);
}
.player-buttons .play-pause:hover { background: var(--lime-dim); transform: scale(1.06); }
.player-scrub { width: 100%; display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-2); }
.player-scrub input[type=range] {
  flex: 1; height: 6px; padding: 0; accent-color: var(--lime);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 3px;
}
#youtube-player-mount { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* ---------- Tables (admin/curator) ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 2px solid var(--border); }
th { color: var(--lime); font-weight: 800; text-transform: uppercase; font-size: 11px; letter-spacing: 0.5px; border-bottom: 2px solid var(--ink); }
tr:hover td { background: var(--surface-2); }

/* ---------- Stat blocks ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 16px; }
.stat-block { background: var(--surface); border: 2px solid var(--ink); border-radius: var(--radius); padding: 18px; box-shadow: 3px 3px 0 var(--border); }
.stat-block .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--lime); font-weight: 800; }
.stat-block .value { font-family: 'Syne', sans-serif; font-size: 30px; font-weight: 800; margin-top: 6px; }

/* ---------- Sidebar (admin/curator) ---------- */
.dash-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 3px solid var(--ink);
  padding: 20px 14px;
}
.sidebar a {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
  border: 2px solid transparent;
}
.sidebar a:hover, .sidebar a.active { background: var(--surface-2); color: var(--lime); border-color: var(--lime); text-decoration: none; }
.dash-main { flex: 1; padding: 28px; max-width: 1100px; }

/* ---------- Misc ---------- */
.muted { color: var(--text-2); font-size: 13px; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mb-16 { margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } .sidebar { display: none; } }

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
  border: 2px solid var(--ink);
  font-weight: 600;
}
.alert-error { border-color: var(--danger); color: var(--danger); background: var(--surface); box-shadow: 3px 3px 0 var(--danger); }
.alert-success { border-color: var(--ink); color: var(--lime); background: var(--surface); box-shadow: 3px 3px 0 var(--lime); }

/* subtle fade-in for page content */
.fade-in { animation: fadeIn 0.3s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* the one animated flourish — reserved for the single most important CTA per page */
.pulse-glow { animation: pulseGlow 2.2s ease-in-out infinite; }
@keyframes pulseGlow {
  0%, 100% { box-shadow: 3px 3px 0 var(--ink); }
  50% { box-shadow: 6px 6px 0 var(--lime); }
}

/* ==========================================================================
   Home hero banner + category grid (post-login landing)
   ========================================================================== */
.hero-banner {
  background: var(--lime);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 6px 6px 0 var(--ink);
  padding: 32px 28px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}
.hero-banner h1 { color: var(--ink); font-size: 40px; margin-bottom: 6px; }
.hero-banner p { color: var(--ink); opacity: 0.75; font-weight: 600; font-size: 14px; }
.hero-banner .hero-tag {
  position: absolute; top: 20px; right: 24px;
  background: var(--ink); color: var(--lime);
  padding: 6px 14px; border-radius: 999px;
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.category-tile {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  border: 3px solid var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
  overflow: hidden;
  cursor: pointer;
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
  background-size: cover;
  background-position: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: block;
  text-decoration: none;
}
.category-tile:hover { transform: translate(-3px, -3px); box-shadow: 8px 8px 0 var(--lime); text-decoration: none; }
.category-tile .tile-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.15) 55%, transparent 100%);
}
.category-tile .tile-label {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 16px;
  color: #fff;
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  line-height: 1.15;
}
.category-tile .tile-count {
  position: absolute; top: 12px; right: 12px;
  background: var(--lime); color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 10px; font-weight: 800; text-transform: uppercase;
}
.category-tile.no-image {
  background: repeating-linear-gradient(135deg, var(--surface-2), var(--surface-2) 12px, var(--surface) 12px, var(--surface) 24px);
}
.category-tile.is-custom { border-color: var(--lime); border-style: dashed; }

/* ==========================================================================
   Category detail page — hero header + independently-scrolling split pane
   ========================================================================== */
.category-hero {
  position: relative;
  min-height: 260px;
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 6px 6px 0 var(--ink);
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: flex-end;
  padding: 28px;
  margin-bottom: 24px;
  overflow: hidden;
}
.category-hero::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.35) 60%, rgba(0,0,0,0.1) 100%);
}
.category-hero .hero-content { position: relative; z-index: 1; }
.category-hero h1 {
  color: #fff;
  font-size: 44px;
  margin-bottom: 4px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.5);
}
.category-hero .back-link {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,0.5); border: 2px solid #fff;
  color: #fff; padding: 6px 14px; border-radius: 999px;
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  margin-bottom: 16px; text-decoration: none;
}
.category-hero .back-link:hover { background: var(--lime); color: var(--ink); border-color: var(--ink); text-decoration: none; }

.split-pane {
  display: flex;
  align-items: flex-start;
  gap: 0;
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
  height: calc(100vh - 340px);
  min-height: 420px;
}
.split-pane-left {
  width: 280px;
  flex-shrink: 0;
  height: 100%;
  overflow-y: auto;
  background: var(--surface);
  border-right: 3px solid var(--ink);
  padding: 10px;
}
.split-pane-right {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  background: var(--bg);
  padding: 16px;
}

.subcat-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px; margin-bottom: 6px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.subcat-item:hover { border-color: var(--lime); }
.subcat-item.active { background: var(--lime); color: var(--ink); border-color: var(--ink); }
.subcat-thumb {
  width: 32px; height: 32px; border-radius: 4px; flex-shrink: 0;
  background-size: cover; background-position: center; background-color: var(--surface-2);
  border: 1px solid var(--ink);
}

/* ==========================================================================
   Mobile nav — compact topbar, slide-down "more" sheet, Spotify-style
   bottom tab bar with the player bar stacked directly above it.
   ========================================================================== */
.topbar-more-btn {
  display: none;
  background: var(--surface-2);
  border: 2px solid var(--ink);
  color: var(--text);
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  font-size: 18px;
  cursor: pointer;
}

.mobile-menu-sheet {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  background: var(--surface);
  border-bottom: 3px solid var(--ink);
  padding: 16px;
  z-index: 90;
  transform: translateY(-110%);
  transition: transform 0.25s ease;
}
.mobile-menu-sheet.open { transform: translateY(0); }
.mobile-menu-link {
  display: block;
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
}
.mobile-menu-link:last-child { border-bottom: none; }
.mobile-menu-link:hover { text-decoration: none; color: var(--lime); }

.mobile-tabbar {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 60px;
  background: var(--surface);
  border-top: 3px solid var(--ink);
  z-index: 110;
  align-items: stretch;
}
.mobile-tab {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  color: var(--text-2);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  background: none; border: none; cursor: pointer;
  text-decoration: none;
}
.mobile-tab:hover { text-decoration: none; }
.mobile-tab.active { color: var(--lime); }
.mobile-tab-icon { font-size: 19px; }

/* ==========================================================================
   Mobile breakpoint — the actual fixes for the layout problems: nav taking
   two rows, oversized hero type, cramped nested split-pane boxes, and
   song-row action buttons overflowing off the edge of the screen.
   ========================================================================== */
@media (max-width: 720px) {
  .topbar { padding: 12px 16px; }
  .topbar-actions-desktop { display: none; }
  .topbar-more-btn { display: block; }
  .brand { font-size: 14px; line-height: 1.2; max-width: 60vw; }

  .mobile-tabbar { display: flex; }
  .app-shell { padding-bottom: 156px; } /* player bar + tab bar stacked */
  .player-bar { bottom: 60px; height: 76px; padding: 0 12px; gap: 10px; }
  .player-info { width: 100px; }
  .player-buttons { gap: 10px; }
  .player-scrub { display: none; } /* not enough width for a scrub bar at this size; play/pause/skip still work */

  .container { padding: 14px; }

  .hero-banner { padding: 22px 18px; }
  .hero-banner h1 { font-size: 28px; }

  .category-hero { min-height: 170px; padding: 18px; }
  .category-hero h1 { font-size: clamp(24px, 9vw, 34px); }
  .category-hero .back-link { padding: 5px 12px; font-size: 11px; margin-bottom: 10px; }

  .category-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .category-tile .tile-label { font-size: 13px; padding: 10px; }

  /* Split-pane: the cramped "boxes inside boxes" problem — flatten it into a
     horizontal scrolling chip row for subcategories, full-width song list
     below. Matches how Spotify's own mobile category/genre pages work. */
  .split-pane {
    flex-direction: column;
    height: auto;
    border: none;
    border-radius: 0;
    overflow: visible;
  }
  .split-pane-left {
    width: 100%;
    height: auto;
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: visible;
    gap: 8px;
    padding: 4px 2px 12px;
    border-right: none;
    border-bottom: none;
    background: transparent;
    -webkit-overflow-scrolling: touch;
  }
  .split-pane-right {
    width: 100%;
    height: auto;
    padding: 0;
    background: transparent;
  }
  .subcat-item {
    flex-shrink: 0;
    width: auto;
    white-space: nowrap;
    margin-bottom: 0;
    padding: 9px 14px;
    border-radius: 999px; /* pill chips, not stacked boxes */
  }
  .subcat-thumb { display: none; } /* no room in a horizontal chip */

  /* Song rows: stop the play/add buttons from overflowing off-screen —
     let the row wrap onto two lines instead of clipping. */
  .song-row {
    flex-wrap: wrap;
    padding: 12px;
  }
  .song-meta { min-width: 140px; }
  .song-row .btn-sm { padding: 6px 10px; font-size: 11px; }

  .grid-2 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }

  /* Curator/admin dashboard sidebar already hides on mobile (existing rule);
     give the main content full width and tighter padding to match. */
  .dash-main { padding: 16px; }
}

@media (max-width: 420px) {
  .category-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}
