:root {
  --bg-main: #0f1014;
  --bg-elevated: #181920;
  --accent: #ff6f3c;
  --accent-soft: rgba(255, 111, 60, 0.2);
  --text-main: #f5f5f5;
  --text-muted: #a0a0b3;
  --border-subtle: #262735;
  --radius-lg: 16px;
  --radius-xl: 22px;
}

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

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #191b23, #05060a 55%);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
}

.app {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas:
    "sidebar main"
    "player player";
  height: 100vh;
}

/* SIDEBAR */
.sidebar {
  grid-area: sidebar;
  background: linear-gradient(180deg, #11121a, #090912);
  border-right: 1px solid var(--border-subtle);
  padding: 18px 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 14px;
}

.logo-badge {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 20%, #ffe29f, #ff6f3c 45%, #ff417d 85%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #111;
  box-shadow: 0 0 18px rgba(255, 111, 60, 0.7);
  overflow: hidden;
}

.logo-badge img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 999px;
}

.sidebar-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  padding: 7px 9px;
  border-radius: 999px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.16s, color 0.16s, transform 0.1s;
}

.nav-item span.icon {
  width: 20px;
  display: inline-flex;
  justify-content: center;
}

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

.nav-item:hover {
  background: #202231;
  color: var(--text-main);
  transform: translateY(-1px);
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

.playlist-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #14151f;
  border: 1px solid #232436;
  font-size: 12px;
  color: var(--text-muted);
  margin: 2px 4px 2px 0;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.playlist-pill:hover {
  background: #1b1c29;
  border-color: var(--accent);
  color: var(--text-main);
}

.sidebar-footer {
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.8;
}

/* MAIN */
.main {
  grid-area: main;
  padding: 14px 18px 80px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: hidden;
}

.topbar {
  display: flex;
  gap: 14px;
  align-items: center;
}

.search {
  flex: 1;
  background: rgba(17, 18, 26, 0.9);
  border-radius: 999px;
  display: flex;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid #252637;
  gap: 8px;
}

.search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 14px;
}

.search-icon {
  font-size: 14px;
  color: var(--text-muted);
}

.chip-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid #262739;
  color: var(--text-muted);
  cursor: pointer;
  background: rgba(15, 16, 22, 0.9);
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}

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

.chip:hover {
  background: #202231;
  color: var(--text-main);
}

.main-scroll {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.section-header h2 {
  font-size: 18px;
}

.section-header small {
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}

.section-header small:hover {
  text-decoration: underline;
}

/* TRACK GRID */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.track-card {
  background: rgba(18, 19, 26, 0.96);
  border-radius: var(--radius-lg);
  padding: 9px;
  border: 1px solid transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.16s, box-shadow 0.16s, border-color 0.16s, background 0.16s;
  position: relative;
  overflow: hidden;
}

.track-thumb {
  border-radius: 12px;
  aspect-ratio: 1;
  background-size: cover;
  background-position: center;
  background-color: #111;
  position: relative;
  overflow: hidden;
}

.track-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 120%, rgba(0, 0, 0, 0.45), transparent);
}

.track-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 10px;
  text-transform: uppercase;
  background: rgba(0,0,0,0.7);
  color: #fff;
  z-index: 1;
}

.track-play {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transform: translateY(8px);
  opacity: 0;
  transition: opacity 0.16s, transform 0.16s;
  z-index: 1;
}

.track-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-soft);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.6);
  background: rgba(22, 23, 33, 0.98);
}

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

.track-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.track-artist {
  font-size: 12px;
  color: var(--text-muted);
}

.track-extra {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* PLAYER */
.player {
  grid-area: player;
  background: rgba(6,7,12,0.96);
  border-top: 1px solid var(--border-subtle);
  padding: 8px 16px;
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 2fr) minmax(0, 1.2fr);
  gap: 16px;
  align-items: center;
  min-height: 72px;
}

.player-track-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-thumb {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #111;
  background-size: cover;
  background-position: center;
}

.player-title {
  font-size: 14px;
  font-weight: 600;
}

.player-artist {
  font-size: 12px;
  color: var(--text-muted);
}

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

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

.player-btn {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.14s, color 0.14s, transform 0.1s;
  border: none;
  background: transparent;
}

.player-btn:hover {
  background: #222438;
  color: var(--text-main);
  transform: translateY(-1px);
}

.player-btn.main {
  width: 34px;
  height: 34px;
  background: var(--accent);
  color: #111;
}

.player-btn.main:hover {
  background: #ff915e;
}

.player-timeline {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  font-size: 11px;
}

.player-progress {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: #232436;
  cursor: pointer;
  position: relative;
}

.player-progress-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: linear-gradient(90deg, #ff6f3c, #ff417d);
}

.player-right {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.player-toggle {
  cursor: pointer;
  transition: color 0.14s;
}

.player-toggle:hover {
  color: var(--text-main);
}

.player-toggle.active {
  color: var(--accent);
}

.volume-bar {
  width: 80px;
  height: 4px;
  border-radius: 999px;
  background: #232436;
  position: relative;
  cursor: pointer;
}

.volume-bar-fill {
  position: absolute;
  inset: 0;
  width: 70%;
  background: linear-gradient(90deg, #ff6f3c, #ff417d);
}

/* SCROLLBAR */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-thumb {
  background: #242535;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #303246;
}

/* NOWE STYLE — Playlista SoundCloud */
#scPlaylistGrid {
  margin-top: 10px;
}

/* "Zmień playlistę SoundCloud" hover */
#changeScBtn:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* RESPONSYWNOŚĆ */
@media (max-width: 900px) {
  .app {
    grid-template-columns: 70px minmax(0, 1fr);
  }
  .sidebar {
    padding-inline: 10px;
  }
  .sidebar-section-title,
  .playlist-pill,
  .sidebar-footer {
    display: none;
  }
  .nav-item span.label {
    display: none;
  }
}

@media (max-width: 720px) {
  body { overflow: auto; height: auto; }
  .app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    grid-template-areas: "sidebar" "main" "player";
    height: auto;
  }
  .sidebar {
    flex-direction: row;
    justify-content: space-between;
    padding-block: 10px;
  }
  .sidebar-scroll { display:none; }
  .main { padding-bottom: 90px; }
  .player {
    grid-template-columns: minmax(0,1fr);
    grid-auto-rows: auto;
    gap: 6px;
  }
  .player-right { justify-content:center; }
}

/* ================================
   DODATKOWE STYLE — ADD PLAYLIST BUTTON
================================ */

.playlist-add-btn {
  width: 100%;
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--accent);
  color: #111;
  font-weight: 600;
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: background 0.18s, transform 0.18s, box-shadow 0.18s;
  text-align: center;
  display: block;
}

.playlist-add-btn:hover {
  background: #ff8b5b;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(255, 111, 60, 0.35);
}

.playlist-add-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

/* responsywność */
@media (max-width: 720px) {
  .playlist-add-btn {
    font-size: 13px;
    padding: 10px 12px;
  }
}
