/* ============================================================
   Netease Cloud Music UI — Dark Theme
   Design: PC 4-column + Mobile H5 responsive
   ============================================================ */

:root {
  --bg-primary: #25252F;
  --bg-sidebar: #1E1E26;
  --bg-card: #2A2A33;
  --bg-hover: #33334D;
  --bg-elevated: #36364A;
  --primary: #EC4141;
  --primary-hover: #D93636;
  --primary-rgb: 236, 65, 65;
  --text-primary: #C0C0D1;
  --text-secondary: #7A7A8F;
  --text-muted: #535366;
  --border: #2E2E3A;
  --border-light: #38384A;
  --shadow: 0 4px 20px rgba(0,0,0,0.3);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --sidebar-width: 210px;
  --player-height: 110px;
  --mobile-topbar: 44px;
  --mobile-tabnav: 50px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "PingFang SC", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ============================================================
   Scrollbar — thin, dark
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ============================================================
   Animations
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes rotateCover {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}
@keyframes cardEnter {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   App Layout — 4-column grid
   ============================================================ */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: auto 1fr;
  height: calc(100vh - var(--player-height));
  overflow: hidden;
}

/* ============================================================
   Left Sidebar
   ============================================================ */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  grid-row: 1 / -1;
}

.sidebar .logo {
  padding: 20px 20px 16px;
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 1px;
  user-select: none;
  flex-shrink: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
  position: relative;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(var(--primary-rgb), 0.12);
  color: var(--primary);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}

.nav-item i {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

/* Nav items inside scrollable sidebar — no fixed flex */
.sidebar-nav-scroll {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0 8px;
}

/* Sidebar scrollable container — nav + playlists unified */
.sidebar-section {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 12px;
}

.sidebar-section-title {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 8px 12px 6px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}
.sidebar-section-title i {
  font-size: 10px;
  color: var(--text-muted);
}

/* Sidebar song items — compact mine-page style */
.sidebar-song-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
}
.sidebar-song-item:hover { background: var(--bg-hover); }
.sidebar-song-item.active { background: rgba(var(--primary-rgb), 0.12); }
.sidebar-song-item.active .ssi-name { color: var(--primary); }

.sidebar-song-item .ssi-cover {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--bg-card);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar-song-item .ssi-cover img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-song-item .ssi-cover .cover-fallback { color: var(--text-muted); opacity: 0.4; font-size: 14px; }

.sidebar-song-item .ssi-info { flex: 1; min-width: 0; }
.sidebar-song-item .ssi-name {
  font-size: 12px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-song-item .ssi-meta {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 1px;
}
}

.sidebar-playlist-item .sp-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================
   Top Search Bar (fixed between sidebar and content)
   ============================================================ */
.top-search-bar {
  grid-column: 2 / 3;
  grid-row: 1 / 2;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 14px 32px;
  min-height: 72px;
}

.top-search-bar .search-area {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 520px;
}

.top-search-bar .search-area input {
  flex: 0 1 360px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 14px;
  outline: none;
  background: var(--bg-card);
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.top-search-bar .search-area input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
}

.top-search-bar .search-area button {
  padding: 8px 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  transition: background var(--transition), transform 0.15s;
  flex-shrink: 0;
}

.top-search-bar .search-area button:hover { background: var(--primary-hover); }
.top-search-bar .search-area button:active { transform: scale(0.96); }

/* Hide the old search-area inside main-content (just in case) */
.search-area:not(.top-search-bar .search-area) {
  display: none;
}

/* ============================================================
   Main Content Area
   ============================================================ */
.main-content {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 32px 30px;
  grid-row: 2 / 3;
  background: var(--bg-primary);
}

/* ============================================================
   Banner Carousel
   ============================================================ */
.banner-wrap {
  position: relative;
  width: 100%;
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: 28px;
  aspect-ratio: 3 / 1;
  background: var(--bg-card);
  user-select: none;
}

.banner-track {
  display: flex;
  height: 100%;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.banner-slide {
  min-width: 100%;
  height: 100%;
  position: relative;
  flex-shrink: 0;
}

.banner-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.banner-slide .banner-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(37,37,47,0.85) 0%, transparent 50%, rgba(37,37,47,0.1) 100%);
  pointer-events: none;
}

.banner-slide .banner-title {
  position: absolute;
  bottom: 20px;
  left: 24px;
  right: 24px;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0,0,0,0.4);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Banner arrows */
.banner-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,0.4);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  opacity: 0;
  transition: opacity var(--transition), background var(--transition);
  z-index: 2;
}

.banner-wrap:hover .banner-arrow {
  opacity: 1;
}

.banner-arrow:hover {
  background: rgba(0,0,0,0.6);
}

.banner-arrow.prev { left: 12px; }
.banner-arrow.next { right: 12px; }

/* Banner dots */
.banner-dots {
  position: absolute;
  bottom: 12px;
  right: 24px;
  display: flex;
  gap: 6px;
  z-index: 2;
}

.banner-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  cursor: pointer;
  transition: all var(--transition);
}

.banner-dot.active {
  width: 20px;
  border-radius: 3px;
  background: rgba(255,255,255,0.85);
}

/* ============================================================
   Category Tabs
   ============================================================ */
.category-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar { display: none; }

.category-tab {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
  user-select: none;
  flex-shrink: 0;
  font-family: inherit;
}

.category-tab:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.category-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 600;
}

/* ============================================================
   Section Title
   ============================================================ */
.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title .more-link {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  margin-left: auto;
  cursor: pointer;
  transition: color 0.15s;
}

.section-title .more-link:hover {
  color: var(--primary);
}

.song-list-toolbar,
.playlist-queue-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 8px;
}

.jump-playing-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.jump-playing-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--bg-hover);
}

.jump-playing-target {
  animation: jumpPlayingTarget 0.9s ease;
}

@keyframes jumpPlayingTarget {
  0%, 100% { background: transparent; }
  35% { background: rgba(var(--primary-rgb), 0.16); }
}

/* ============================================================
   Card Grid
   ============================================================ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.card {
  cursor: pointer;
  transition: transform var(--transition);
  animation: cardEnter 0.4s ease both;
  border-radius: var(--radius);
  overflow: hidden;
}

.card:hover {
  transform: translateY(-4px);
}

.card-cover {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

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

.card:hover .card-cover img {
  transform: scale(1.06);
}

.card-play-count {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
  background: rgba(0,0,0,0.25);
  padding: 2px 8px;
  border-radius: 10px;
  backdrop-filter: blur(4px);
}

.card-play-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(236,65,65,0.4);
}

.card:hover .card-play-btn {
  opacity: 1;
  transform: translateY(0);
}

.card-play-btn:hover {
  background: var(--primary-hover);
  transform: translateY(0) scale(1.08);
}

.card-info {
  padding: 8px 4px 0;
}

.card-title {
  font-size: 13px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
}

.card-artist {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}

/* Player styles moved to style-player.css */
