/* ============================================================
   ZingMusic — Main Stylesheet
   Dark music streaming theme  v1.0
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@400;600;700&display=swap');

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

:root {
  --bg-base:     #09090f;
  --bg-surface:  #111118;
  --bg-card:     #16161f;
  --bg-card2:    #1c1c28;
  --bg-hover:    #22222f;
  --border:      rgba(255,255,255,.06);
  --border2:     rgba(255,255,255,.1);

  --purple:      #a78bfa;
  --purple-dark: #7c3aed;
  --pink:        #f472b6;
  --pink-dark:   #db2777;
  --grad:        linear-gradient(135deg, #7c3aed 0%, #db2777 100%);
  --grad-soft:   linear-gradient(135deg, rgba(124,58,237,.15), rgba(219,39,119,.15));

  --text-1: #f1f0ff;
  --text-2: #a09cb8;
  --text-3: #635f7e;

  --player-h: 80px;
  --sidebar-w: 240px;
  --font: 'Be Vietnam Pro', sans-serif;
  --font-display: 'Space Grotesk', sans-serif;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --transition: .2s ease;
}

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-1);
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; border: none; background: none; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }
ul { list-style: none; }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #33334a; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #55556a; }

/* ── Layout ──────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 1fr var(--player-h);
  min-height: 100vh;
}

.main-content {
  grid-column: 2;
  grid-row: 1;
  overflow-y: auto;
  max-height: calc(100vh - var(--player-h));
  padding-bottom: 40px;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  grid-column: 1;
  grid-row: 1 / 3;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 50;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: var(--grad);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

.sidebar-logo .logo-text {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-nav { padding: 16px 12px; flex: 1; }

.sidebar-nav .section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--text-3);
  text-transform: uppercase;
  padding: 8px 8px 6px;
  margin-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
}

.nav-item:hover { background: var(--bg-hover); color: var(--text-1); }
.nav-item.active { background: var(--grad-soft); color: var(--purple); }
.nav-item.active svg { color: var(--purple); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-genres { padding: 0 12px 16px; }
.genre-tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--bg-card2);
  border: 1px solid var(--border);
  margin: 3px 2px;
  cursor: pointer;
  transition: var(--transition);
}
.genre-tag:hover { background: var(--bg-hover); color: var(--text-1); border-color: var(--border2); }

/* ── Top bar (header inside main) ───────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(9,9,15,.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.search-wrap {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.search-wrap input {
  width: 100%;
  height: 40px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 0 16px 0 40px;
  font-size: 14px;
  color: var(--text-1);
  outline: none;
  transition: var(--transition);
}

.search-wrap input::placeholder { color: var(--text-3); }
.search-wrap input:focus { border-color: var(--purple); background: var(--bg-hover); }

.search-wrap .search-icon {
  position: absolute;
  left: 13px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  width: 16px; height: 16px;
}

.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.btn-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  background: transparent;
  transition: var(--transition);
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-1); }
.btn-icon svg { width: 18px; height: 18px; }

/* ── Page sections ───────────────────────────────────────── */
.page-section { padding: 28px 28px 0; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.section-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-1);
}
.section-link {
  font-size: 13px;
  color: var(--purple);
  font-weight: 600;
  opacity: .8;
  transition: var(--transition);
}
.section-link:hover { opacity: 1; }

/* ── Horizontal scroll row ───────────────────────────────── */
.scroll-row {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.scroll-row::-webkit-scrollbar { height: 0; }

/* ── Song Card (vertical) ───────────────────────────────── */
.song-card {
  flex-shrink: 0;
  width: 156px;
  scroll-snap-align: start;
  cursor: pointer;
  border-radius: var(--radius);
  padding: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.song-card:hover { background: var(--bg-card2); border-color: var(--border2); transform: translateY(-2px); }

.song-card .cover-wrap {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  margin-bottom: 10px;
  background: var(--bg-card2);
}

.song-card .cover-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.song-card:hover .cover-wrap img { transform: scale(1.05); }

.song-card .play-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.45);
  opacity: 0;
  transition: var(--transition);
  border-radius: 8px;
}
.song-card:hover .play-overlay { opacity: 1; }

.play-btn-sm {
  width: 42px; height: 42px;
  background: var(--grad);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 4px 20px rgba(124,58,237,.5);
  transform: scale(.9);
  transition: transform .2s;
}
.song-card:hover .play-btn-sm { transform: scale(1); }
.play-btn-sm svg { width: 18px; height: 18px; margin-left: 2px; }

.song-card .song-title {
  font-size: 13px; font-weight: 600;
  color: var(--text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 3px;
}
.song-card .song-artist {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.song-card .song-plays {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 4px;
  display: flex; align-items: center; gap: 3px;
}
.song-card .song-plays svg { width: 11px; height: 11px; }

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

.trending-item {
  display: grid;
  grid-template-columns: 30px 52px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.trending-item:hover { background: var(--bg-hover); }

.trending-num {
  font-size: 15px;
  font-weight: 800;
  font-family: var(--font-display);
  text-align: center;
}
.trending-num.top-1 { background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.trending-num.top-2 { color: #a0aec0; }
.trending-num.top-3 { color: #b7791f; }
.trending-num.rest  { color: var(--text-3); font-size: 13px; }

.trending-cover {
  width: 52px; height: 52px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-card2);
}

.trending-info { min-width: 0; }
.trending-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trending-artist { font-size: 12px; color: var(--text-2); margin-top: 2px; }

.trending-meta {
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
  font-size: 12px; color: var(--text-3);
}
.duration { letter-spacing: .03em; }

/* ── Artist cards ────────────────────────────────────────── */
.artist-card {
  flex-shrink: 0;
  width: 130px;
  text-align: center;
  cursor: pointer;
  padding: 12px 8px;
  border-radius: var(--radius);
  transition: var(--transition);
}
.artist-card:hover { background: var(--bg-card); }

.artist-avatar {
  width: 88px; height: 88px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 10px;
  border: 2px solid var(--border);
  background: var(--bg-card2);
  transition: var(--transition);
}
.artist-card:hover .artist-avatar { border-color: var(--purple); }
.artist-name { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.artist-count { font-size: 11px; color: var(--text-3); }

/* ── Playlist cards ──────────────────────────────────────── */
.playlist-card {
  flex-shrink: 0;
  width: 170px;
  scroll-snap-align: start;
  cursor: pointer;
  position: relative;
}

.playlist-card .cover-wrap {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 10px;
  background: linear-gradient(135deg, #1e1033, #2d1053);
  position: relative;
}

.playlist-card .cover-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.playlist-card:hover .cover-wrap img { transform: scale(1.05); }

.playlist-cover-default {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 42px;
}

.playlist-card .overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.4);
  opacity: 0;
  transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
}
.playlist-card:hover .overlay { opacity: 1; }

.playlist-name { font-size: 14px; font-weight: 600; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.playlist-desc { font-size: 12px; color: var(--text-2); }

/* ── Banner / Hero ───────────────────────────────────────── */
.hero-banner {
  margin: 28px 28px 0;
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  background: linear-gradient(135deg, #1a0a3a 0%, #2d0a3e 40%, #3d1020 100%);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 32px;
  border: 1px solid rgba(167,139,250,.15);
}

.hero-banner::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(124,58,237,.3), transparent 70%);
}
.hero-banner::after {
  content: '';
  position: absolute;
  bottom: -60px; left: 30%;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(219,39,119,.2), transparent 70%);
}

.hero-text { position: relative; z-index: 1; }
.hero-label { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--pink); margin-bottom: 8px; }
.hero-title { font-family: var(--font-display); font-size: 28px; font-weight: 700; line-height: 1.2; margin-bottom: 12px; }
.hero-sub { font-size: 14px; color: var(--text-2); margin-bottom: 20px; }

.btn-play-hero {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px;
  background: var(--grad);
  border-radius: 99px;
  font-size: 14px; font-weight: 700;
  color: #fff;
  transition: var(--transition);
  box-shadow: 0 4px 24px rgba(124,58,237,.4);
}
.btn-play-hero:hover { transform: scale(1.04); box-shadow: 0 6px 30px rgba(124,58,237,.55); }
.btn-play-hero svg { width: 18px; height: 18px; }

.hero-covers {
  position: relative; z-index: 1;
  display: flex; gap: -16px;
  margin-left: auto;
  flex-shrink: 0;
}
.hero-cover {
  width: 90px; height: 90px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,.15);
  margin-left: -16px;
  background: var(--bg-card2);
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.hero-cover:first-child { margin-left: 0; }

/* ── Player bar ──────────────────────────────────────────── */
#player-bar {
  grid-column: 2;
  grid-row: 2;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 20px;
  height: var(--player-h);
  position: sticky;
  bottom: 0;
  z-index: 100;
}

.player-song {
  display: flex; align-items: center; gap: 12px;
  width: 230px; min-width: 0;
}

.player-thumb {
  width: 48px; height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-card2);
  flex-shrink: 0;
}

.player-info { min-width: 0; }
.player-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-artist { font-size: 12px; color: var(--text-2); margin-top: 2px; }

.player-like {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
  transition: var(--transition);
  flex-shrink: 0;
}
.player-like:hover { color: var(--pink); }
.player-like.liked { color: var(--pink); }
.player-like svg { width: 16px; height: 16px; }

.player-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 560px;
}

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

.ctrl-btn {
  color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  padding: 0;
}
.ctrl-btn:hover { color: var(--text-1); }
.ctrl-btn svg { width: 18px; height: 18px; }

.ctrl-btn.active { color: var(--purple); }

#play-pause-btn {
  width: 40px; height: 40px;
  background: var(--grad);
  border-radius: 50%;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s;
  box-shadow: 0 0 20px rgba(124,58,237,.35);
}
#play-pause-btn:hover { transform: scale(1.08); }
#play-pause-btn svg { width: 18px; height: 18px; }
#play-pause-btn .icon-play { margin-left: 2px; }

.player-progress {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
}

.time-label { font-size: 11px; color: var(--text-3); letter-spacing: .03em; min-width: 32px; }
.time-label.right { text-align: right; }

#progress-bar {
  flex: 1;
  height: 4px;
  background: var(--bg-card2);
  border-radius: 99px;
  cursor: pointer;
  position: relative;
  overflow: visible;
}

#progress-fill {
  height: 100%;
  background: var(--grad);
  border-radius: 99px;
  width: 0;
  pointer-events: none;
  position: relative;
}
#progress-fill::after {
  content: '';
  position: absolute;
  right: -5px; top: 50%;
  transform: translateY(-50%);
  width: 10px; height: 10px;
  background: #fff;
  border-radius: 50%;
  opacity: 0;
  transition: opacity .15s;
  box-shadow: 0 0 6px rgba(0,0,0,.4);
}
#progress-bar:hover #progress-fill::after { opacity: 1; }

.player-right {
  display: flex; align-items: center; gap: 10px;
  width: 200px;
  justify-content: flex-end;
}

.volume-wrap { display: flex; align-items: center; gap: 8px; }
#volume-bar {
  width: 80px;
  -webkit-appearance: none;
  height: 4px;
  background: var(--bg-card2);
  border-radius: 99px;
  outline: none;
  cursor: pointer;
}
#volume-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--purple);
  cursor: pointer;
}

/* ── Song page ───────────────────────────────────────────── */
.song-hero {
  padding: 36px 28px;
  display: flex;
  gap: 32px;
  align-items: flex-start;
}

.song-hero-cover {
  width: 220px; height: 220px;
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--bg-card2);
  flex-shrink: 0;
  box-shadow: 0 16px 48px rgba(0,0,0,.5);
}

.song-hero-info { min-width: 0; padding-top: 8px; }
.song-hero-genre { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--purple); margin-bottom: 10px; }
.song-hero-title { font-family: var(--font-display); font-size: 32px; font-weight: 700; line-height: 1.2; margin-bottom: 8px; }
.song-hero-artist { font-size: 16px; color: var(--text-2); margin-bottom: 16px; }
.song-hero-meta { display: flex; gap: 20px; font-size: 13px; color: var(--text-3); margin-bottom: 24px; }
.meta-item { display: flex; align-items: center; gap: 5px; }
.meta-item svg { width: 14px; height: 14px; }

.song-actions { display: flex; gap: 10px; align-items: center; }
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 24px;
  background: var(--grad);
  border-radius: 99px;
  font-size: 14px; font-weight: 700; color: #fff;
  transition: var(--transition);
  box-shadow: 0 4px 20px rgba(124,58,237,.35);
}
.btn-primary:hover { transform: scale(1.03); }
.btn-primary svg { width: 18px; height: 18px; }
.btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  border: 1px solid var(--border2);
  border-radius: 99px;
  font-size: 14px; font-weight: 600; color: var(--text-1);
  background: transparent;
  transition: var(--transition);
}
.btn-secondary:hover { background: var(--bg-hover); }

.lyrics-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  font-size: 14px; line-height: 1.9; color: var(--text-2);
  white-space: pre-line;
  max-height: 320px;
  overflow-y: auto;
}

/* ── Search results ──────────────────────────────────────── */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; --player-h: 70px; }
  .sidebar { display: none; }
  .layout { grid-template-columns: 1fr; }
  .main-content, #player-bar { grid-column: 1; }
  .hero-covers { display: none; }
  .hero-banner { padding: 24px 20px; }
}

@media (max-width: 600px) {
  .page-section { padding: 20px 16px 0; }
  .song-hero { flex-direction: column; padding: 20px 16px; }
  .song-hero-cover { width: 100%; height: auto; aspect-ratio: 1; }
  .topbar { padding: 10px 16px; }
}

/* ── Utility ─────────────────────────────────────────────── */
.currently-playing .trending-title { color: var(--purple); }
.currently-playing .trending-cover { box-shadow: 0 0 0 2px var(--purple); }

.playing-indicator {
  display: flex; gap: 2px; align-items: flex-end; height: 14px;
}
.playing-indicator span {
  width: 3px; background: var(--purple); border-radius: 2px;
  animation: bounce 0.6s ease-in-out infinite alternate;
}
.playing-indicator span:nth-child(2) { animation-delay: .1s; height: 60%; }
.playing-indicator span:nth-child(3) { animation-delay: .2s; }

@keyframes bounce { from { height: 30%; } to { height: 100%; } }

.badge {
  display: inline-flex; align-items: center;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 11px; font-weight: 700;
  background: var(--grad-soft);
  color: var(--purple);
  border: 1px solid rgba(167,139,250,.2);
}

/* Admin styles */
.admin-header { padding: 20px 28px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 16px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th { text-align: left; padding: 10px 12px; color: var(--text-3); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--border); }
.admin-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tr:hover td { background: var(--bg-hover); }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.form-input { width: 100%; padding: 10px 14px; background: var(--bg-card2); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-1); font-size: 14px; outline: none; transition: var(--transition); }
.form-input:focus { border-color: var(--purple); }
.form-input select { background: var(--bg-card2); }
.btn-submit { padding: 10px 28px; background: var(--grad); border-radius: 99px; color: #fff; font-size: 14px; font-weight: 700; cursor: pointer; transition: var(--transition); }
.btn-submit:hover { transform: scale(1.03); }
