* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #000;
  --bg-elev: #121212;
  --bg-elev-2: #1a1a1a;
  --bg-hover: #1f1f1f;
  --text: #fff;
  --text-dim: #b3b3b3;
  --accent: #1db954;
  --accent-hover: #1ed760;
  --border: #282828;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  height: 100vh;
  overflow: hidden;
  font-size: 14px;
}

.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: calc(100vh - 90px);
  gap: 8px;
  padding: 8px;
}

/* ===== SIDEBAR ===== */
.sidebar {
  background: var(--bg-elev);
  border-radius: 8px;
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 24px;
  padding: 0 8px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 24px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 10px 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 6px;
  text-align: left;
  font-family: inherit;
}

.nav-btn:hover,
.nav-btn.active {
  color: var(--text);
}

.nav-btn.active {
  background: var(--bg-hover);
}

.playlists {
  flex: 1;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  overflow-y: auto;
}

.playlists h3 {
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
  padding: 0 8px;
}

#playlist-list {
  list-style: none;
}

#playlist-list li {
  padding: 8px 12px;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 4px;
  font-size: 14px;
}

#playlist-list li:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.new-playlist-btn {
  margin-top: 12px;
  width: 100%;
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-dim);
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}

.new-playlist-btn:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

/* ===== MAIN ===== */
.main {
  background: linear-gradient(180deg, #1f1f1f 0%, var(--bg-elev) 280px);
  border-radius: 8px;
  overflow-y: auto;
  position: relative;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
}

.nav-arrows {
  display: flex;
  gap: 8px;
}

.round-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
}

.search-wrap {
  flex: 1;
  max-width: 360px;
  margin: 0 24px;
}

#search-input {
  width: 100%;
  background: var(--bg-elev);
  border: none;
  color: var(--text);
  padding: 12px 16px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 14px;
}

#search-input:focus {
  outline: 2px solid var(--text);
}

.user-chip {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #000;
  font-size: 12px;
}

.content {
  padding: 16px 24px 32px;
}

.content h1 {
  font-size: 32px;
  margin-bottom: 24px;
}

.content h2 {
  font-size: 22px;
  margin: 24px 0 16px;
}

/* ===== CARDS GRID ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
}

.card {
  background: var(--bg-elev-2);
  padding: 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  position: relative;
}

.card:hover {
  background: var(--bg-hover);
}

.card .cover {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 800;
}

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

.card .subtitle {
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.4;
}

.card .card-play {
  position: absolute;
  right: 24px;
  bottom: 78px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  border: none;
  font-size: 20px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.2s;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}

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

.card-play:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

/* ===== TRACK LIST ===== */
.track-header {
  display: flex;
  align-items: flex-end;
  gap: 24px;
  padding: 24px 0 32px;
}

.track-header .cover-lg {
  width: 200px;
  height: 200px;
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  font-weight: 800;
}

.track-header-meta .label {
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 8px;
}

.track-header-meta h1 {
  font-size: 64px;
  font-weight: 900;
  margin-bottom: 12px;
  line-height: 1;
}

.track-header-meta .meta {
  color: var(--text-dim);
  font-size: 14px;
}

.playlist-actions {
  padding: 8px 0 24px;
}

.big-play {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  border: none;
  font-size: 24px;
  cursor: pointer;
}

.big-play:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

.track-list {
  width: 100%;
  border-collapse: collapse;
}

.track-list th,
.track-list td {
  text-align: left;
  padding: 10px 16px;
  color: var(--text-dim);
  font-weight: 400;
}

.track-list th {
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.track-list tbody tr {
  cursor: pointer;
  border-radius: 4px;
}

.track-list tbody tr:hover {
  background: var(--bg-hover);
}

.track-list tbody tr.playing {
  color: var(--accent);
}

.track-list tbody tr.playing td {
  color: var(--accent);
}

.track-list .col-num {
  width: 40px;
  text-align: center;
}

.track-list .col-title {
  color: var(--text);
}

.track-list .track-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.track-list .track-cover {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
}

.track-list .track-name {
  color: var(--text);
  font-weight: 500;
}

.track-list tbody tr.playing .track-name {
  color: var(--accent);
}

.track-list .col-actions {
  width: 48px;
  text-align: right;
  padding-right: 12px;
}

.row-action {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 15px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
}

.track-list tbody tr:hover .row-action {
  opacity: 1;
}

.row-action.delete-btn:hover {
  color: #ff5252;
  background: rgba(255, 82, 82, 0.12);
}

/* ===== PLAYER ===== */
.player {
  height: 90px;
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
}

.now-playing {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.cover-thumb {
  width: 56px;
  height: 56px;
  border-radius: 4px;
  background: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
}

.np-text {
  min-width: 0;
}

.np-title {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.icon-btn:hover {
  color: var(--text);
}

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

.player-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

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

.play-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--text);
  color: #000;
  border: none;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.play-btn:hover {
  transform: scale(1.06);
  background: #fff;
}

.progress {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 520px;
}

.progress span {
  font-size: 11px;
  color: var(--text-dim);
  min-width: 36px;
  text-align: center;
}

input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: #4d4d4d;
  border-radius: 2px;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}

input[type="range"]:hover::-webkit-slider-thumb {
  opacity: 1;
}

input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text);
  cursor: pointer;
  border: none;
}

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

.vol-icon {
  color: var(--text-dim);
}

#volume {
  width: 100px;
}

/* ===== YouTube button ===== */
.yt-btn {
  margin-top: 8px;
  border-style: solid;
  border-color: #ff0000;
  color: #ff5252;
}

.yt-btn:hover {
  background: rgba(255, 0, 0, 0.1);
  color: #ff7575;
  border-color: #ff5252;
}

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background: #282828;
  border-radius: 12px;
  padding: 28px;
  width: 460px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.modal h3 {
  font-size: 22px;
  margin-bottom: 8px;
}

.modal-sub {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 18px;
}

.modal input {
  width: 100%;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
}

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

.modal-status {
  min-height: 20px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-dim);
}

.modal-status.error {
  color: #ff5252;
}

.modal-status.success {
  color: var(--accent);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}

.btn-primary,
.btn-secondary {
  padding: 10px 22px;
  border-radius: 999px;
  border: none;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
}

.btn-primary {
  background: var(--accent);
  color: #000;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: scale(1.04);
}

.btn-primary:disabled {
  background: #4d4d4d;
  cursor: not-allowed;
  transform: none;
}

.btn-primary.btn-danger {
  background: #ff5252;
  color: #fff;
}

.btn-primary.btn-danger:hover {
  background: #ff7575;
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--text);
}

/* Track badge for YouTube source */
.src-badge {
  display: inline-block;
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 6px;
  vertical-align: middle;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.src-badge.yt {
  background: #ff0000;
  color: #fff;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #4d4d4d;
  border-radius: 6px;
  border: 3px solid var(--bg-elev);
}

::-webkit-scrollbar-thumb:hover {
  background: #6d6d6d;
}
