:root {
  --bg-color: #0b0c0e;
  --panel-bg: #141619;
  --text-main: #f0f0f0;
  --text-muted: #8a8d93;
  --accent: #ffdf2a;
  --border: #22252a;
  --card-bg: #1a1d21;
}

[data-theme="light"] {
  --bg-color: #f2f3f5;
  --panel-bg: #ffffff;
  --text-main: #111215;
  --text-muted: #666a73;
  --accent: #272727;
  --border: #e0e2e6;
  --card-bg: #ffffff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
}

/* App Layout Structure */
.app-container {
  display: grid;
  grid-template-rows: 60px 1fr 80px;
  grid-template-columns: 240px 1fr;
  grid-template-areas:
    "header header"
    "sidebar playlist"
    "player player";
  height: 100vh;
}

.header {
  grid-area: header;
  background-color: var(--panel-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  font-weight: bold;
  letter-spacing: 1px;
}

.sidebar {
  grid-area: sidebar;
  background-color: var(--panel-bg);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
}

.sidebar h3 {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 16px;
}

.category-list {
  list-style: none;
}

.category-list li {
  padding: 10px 12px;
  cursor: pointer;
  border-left: 2px solid transparent;
  color: var(--text-muted);
}

.category-list li.active, 
.category-list li:hover {
  color: var(--text-main);
  border-left-color: var(--accent);
  background-color: var(--bg-color);
}

.playlist-view {
  grid-area: playlist;
  padding: 24px;
  overflow-y: auto;
}
/* Centered Grid Layout for both .playlist-grid and .grid-container */
.playlist-grid,
.grid-container {
  display: grid;
  /* Fixed column tracks so extra room exists for horizontal centering */
  grid-template-columns: repeat(auto-fit, clamp(250px, 28vw, 320px));
  justify-content: center; /* Centers cards in the main area */
  gap: 3rem 2.5rem;        /* 3rem vertical space, 2.5rem horizontal space */
  padding: 2rem 0;         /* Vertical spacing top and bottom of the grid */
  align-items: start;
}

/* Card layout sizing */
.playlist-card {
  display: flex;
  flex-direction: column;
  background-color: var(--card-bg);
  border: 1px solid var(--border);
  width: 100%;
  border-radius: clamp(8px, 1.2vw, 18px);
  overflow: hidden;
  text-decoration: none;
  box-shadow: 0 clamp(4px, 0.8vw, 10px) clamp(10px, 1.5vw, 24px) rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}


/* Playlist Card with Responsive Width Cap & Scaling Bevel */
.playlist-card {
  display: flex;
  flex-direction: column;
  background-color: var(--card-bg);
  border: 1px solid var(--border);
  
  /* Hard cap: card never exceeds 1/3 of total screen width */
  max-width: 45vw;
  
  /* Scalable bevel radius: scales smoothly between 8px and 18px based on screen size */
  border-radius: clamp(8px, 1.2vw, 18px);
  
  overflow: hidden;
  text-decoration: none;
  
  /* Scalable depth shadow (bevel effect) */
  box-shadow: 0 clamp(4px, 0.8vw, 10px) clamp(10px, 1.5vw, 24px) rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.playlist-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 clamp(6px, 1vw, 14px) clamp(14px, 2vw, 30px) rgba(0, 0, 0, 0.35);
}

/* Square Thumbnail Aspect Ratio */
.playlist-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

/* Responsive Card Title Padding */
.playlist-card .card-title,
.playlist-card h3 {
  padding: clamp(10px, 1.2vw, 16px);
  font-weight: bold;
  font-size: clamp(0.9rem, 1.1vw, 1.1rem);
  color: var(--text-main);
}
/* Player Bar & Controls */
.player-bar {
  grid-area: player;
  background-color: var(--panel-bg);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.track-details .artist {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 8px 16px;
  cursor: pointer;
}

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

.volume-control {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
}

/* ==========================================================================
   Media Queries
   ========================================================================== */

/* Media Query 1: Tablet Breakpoint */
@media (max-width: 900px) {
  .app-container {
    grid-template-columns: 180px 1fr;
  }
}

/* Media Query 2: Mobile Breakpoint (Vertical Stack) */
@media (max-width: 768px) {
  body {
    overflow: auto;
  }

  .app-container {
    display: flex;
    flex-direction: column;
    height: auto;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  /* Single Column Layout for Mobile */
  .playlist-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}