:root {
  --bg-root: #0a0b0e;
  --bg-sidebar: #12141a;
  --bg-card: #1b1d24;
  --bg-card-hover: #252833;
  --bg-player: #13151c;
  --border-color: #272a36;
  --border-subtle: #1f222b;
  --text-primary: #ffffff;
  --text-muted: #8e95a3;
  --text-dim: #606775;
  --accent: #0a84ff;
  --accent-hover: #0070df;
  --accent-soft: rgba(10, 132, 255, 0.15);
  --accent-glow: rgba(10, 132, 255, 0.35);
  --green: #30d158;
  --red: #ff453a;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --sidebar-width: 250px;
  --player-height: 84px;
  --header-height: 70px;
}

[data-theme="light"] {
  --bg-root: #f3f5f8;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #ebf0f7;
  --bg-player: #ffffff;
  --border-color: #d7dce4;
  --border-subtle: #e5e9f0;
  --text-primary: #11141a;
  --text-muted: #687282;
  --text-dim: #9aa2b0;
  --accent: #0078d4;
  --accent-hover: #0066b4;
  --accent-soft: rgba(0, 120, 212, 0.12);
  --accent-glow: rgba(0, 120, 212, 0.25);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-main);
  user-select: none;
  -webkit-user-select: none;
}

body {
  background-color: var(--bg-root);
  color: var(--text-primary);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* App Layout */
.app-container {
  display: flex;
  flex: 1;
  height: calc(100vh - var(--player-height));
  position: relative;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  flex-shrink: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 18px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.brand-name {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, var(--text-primary) 40%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

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

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

.nav-item.active {
  background-color: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.nav-icon {
  width: 18px;
  height: 18px;
  filter: brightness(0.8);
}

.nav-item.active .nav-icon {
  filter: invert(42%) sepia(93%) saturate(1352%) hue-rotate(190deg) brightness(101%) contrast(106%);
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--green);
}

.status-dot.offline {
  background-color: #f5a623;
}

.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
}

/* Main Content */
.main-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--bg-root);
}

.top-bar {
  height: var(--header-height);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 8px 18px;
  width: 420px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
  width: 100%;
}

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

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

.chip {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.chip:hover {
  background-color: var(--bg-card-hover);
  color: var(--text-primary);
}

.chip.active {
  background-color: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.content-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
}

/* Custom Scrollbar */
.content-scroll::-webkit-scrollbar {
  width: 8px;
}
.content-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.content-scroll::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
.content-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Section Styling */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

/* Track Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
  margin-bottom: 36px;
}

.music-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.2s;
  position: relative;
  display: flex;
  flex-direction: column;
}

.music-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
  background-color: var(--bg-card-hover);
}

.card-img-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 12px;
  background-color: var(--border-subtle);
}

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

.music-card:hover .card-img {
  transform: scale(1.04);
}

.card-play-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

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

.card-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Track Rows List (Search / Library) */
.tracks-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.track-row {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-card);
  border: 1px solid transparent;
  gap: 14px;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}

.track-row:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--border-color);
}

.track-row.playing {
  border-color: var(--accent);
  background-color: var(--accent-soft);
}

.track-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

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

.track-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.track-duration {
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

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

.action-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.action-btn:hover {
  background-color: var(--bg-card-hover);
  color: var(--text-primary);
}

.action-btn.active {
  color: var(--red);
}

/* Bottom Player Bar */
.player-bar {
  height: var(--player-height);
  background-color: var(--bg-player);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: relative;
  z-index: 50;
}

.player-left {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 280px;
}

.now-playing-thumb {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.now-playing-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.now-playing-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.now-playing-artist {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  max-width: 620px;
}

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

.control-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.15s;
  width: 32px;
  height: 32px;
}

.control-btn:hover {
  color: var(--text-primary);
  transform: scale(1.08);
}

.control-btn.active {
  color: var(--accent);
}

.play-pause-btn {
  width: 42px;
  height: 42px;
  background-color: var(--text-primary);
  color: var(--bg-root);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  transition: transform 0.15s cubic-bezier(0.2, 0, 0, 1);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.play-pause-btn:hover {
  transform: scale(1.06);
}

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

.time-label {
  font-size: 11px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  width: 36px;
  text-align: center;
}

.progress-bar-wrap {
  flex: 1;
  height: 14px;
  display: flex;
  align-items: center;
  cursor: pointer;
  position: relative;
}

.progress-track {
  width: 100%;
  height: 4px;
  background-color: var(--border-color);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}

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

.progress-bar-wrap:hover .progress-fill {
  background-color: var(--accent);
}

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

.volume-container {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 120px;
}

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

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

/* Offline Badge */
.offline-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  background-color: rgba(48, 209, 88, 0.15);
  color: var(--green);
  border: 1px solid rgba(48, 209, 88, 0.3);
}

/* Lyrics Drawer / Overlay */
.lyrics-overlay {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 440px;
  background-color: rgba(18, 20, 26, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 40;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.2, 0, 0, 1);
}

.lyrics-overlay.open {
  transform: translateX(0);
}

.lyrics-header {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.lyrics-body {
  flex: 1;
  overflow-y: auto;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.lyric-line {
  font-size: 19px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.25s ease;
  line-height: 1.4;
  padding: 6px 12px;
  border-radius: 8px;
}

.lyric-line:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.05);
}

.lyric-line.active {
  color: var(--accent);
  font-size: 23px;
  font-weight: 700;
  transform: scale(1.02);
  text-shadow: 0 0 20px var(--accent-glow);
}

/* Queue Drawer */
.queue-overlay {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  background-color: var(--bg-sidebar);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 40;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.2, 0, 0, 1);
}

.queue-overlay.open {
  transform: translateX(0);
}

.queue-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 100px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.25s cubic-bezier(0.2, 0, 0, 1);
}

@keyframes slideIn {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Responsive */
@media (max-width: 860px) {
  .sidebar {
    display: none;
  }
  .top-bar {
    padding: 0 16px;
  }
  .search-box {
    width: 100%;
  }
  .content-scroll {
    padding: 16px;
  }
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .player-right {
    display: none;
  }
  .player-left {
    width: auto;
  }
}
