:root {
  --ui-radius: 12px;
  --bg-black: #000000;
  --bg-base: #121212;
  --bg-highlight: #1a1a1a;
  --bg-press: #000000;
  --bg-elevated-base: #242424;
  --bg-elevated-highlight: #2a2a2a;
  --text-base: #ffffff;
  --text-subdued: #a7a7a7;
  --text-bright-accent: #1ed760;
  --accent-color: #1db954; /* Spotify Green */
  --header-h: 64px;
  --player-h: 72px;
  --glass-bg: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.1);
}

body {
  background-color: var(--bg-black);
  color: var(--text-base);
  font-family: "Circular Sp", "Circular Sp-Arabic", "Circular Sp-Hebr", "Circular Sp-Cyrl", "Circular Sp-Grek", "Circular Sp-Deva", sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  -webkit-font-smoothing: antialiased;
  margin: 0;
  overflow: hidden; /* Main scroll will be in the content area */
}

/* Spotify Layout Grid */
.spotify-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: 1fr var(--player-h);
  height: 100vh;
  height: 100dvh;
  gap: 8px;
  padding: 8px;
  box-sizing: border-box;
  background: #000;
  overflow: hidden;
}

@media (max-width: 1024px) {
  .spotify-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 64px;
    padding: 0;
    gap: 0;
  }
  .sidebar { display: none !important; }
  .main-view { border-radius: 0; }
  .player-bar { 
    border-radius: 0; 
    height: 64px;
    padding: 0 12px;
  }
}

.sidebar {
  grid-row: 1 / 2;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.main-view {
  grid-row: 1 / 2;
  background: linear-gradient(to bottom, #1e1e1e, var(--bg-base) 400px);
  border-radius: var(--ui-radius);
  overflow-y: auto;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
  width: 100%;
}

.main-view::-webkit-scrollbar {
  width: 12px;
}
.main-view::-webkit-scrollbar-thumb {
  background-color: rgba(255,255,255,0.1);
  border: 3px solid transparent;
  background-clip: padding-box;
  border-radius: 6px;
}

.player-bar {
  grid-column: 1 / -1;
  grid-row: 2 / 3;
  background: #000;
  display: flex;
  align-items: center;
  padding: 0 16px;
  z-index: 100;
  height: var(--player-h);
  overflow: hidden;
}

/* Sidebar Components */
.sidebar-box {
  background: var(--bg-base);
  border-radius: var(--ui-radius);
  padding: 8px 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 8px;
  color: var(--text-subdued);
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-item:hover, .nav-item.active {
  color: var(--text-base);
}
.nav-item i { font-size: 1.4rem; }

/* Library Section */
.library-box {
  flex-grow: 1;
  background: var(--bg-base);
  border-radius: var(--ui-radius);
  padding: 8px;
  display: flex;
  flex-direction: column;
}
.library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  color: var(--text-subdued);
  font-weight: 700;
  transition: color 0.2s;
}
.library-header:hover { color: var(--text-base); cursor: pointer; }

/* Main Content Styles */
.content-spacing {
  padding: 24px 32px;
}

@media (max-width: 768px) {
  .content-spacing {
    padding: 16px;
  }
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 24px;
  color: #fff;
  letter-spacing: -0.02em;
}

@media (max-width: 768px) {
  .section-title {
    font-size: 1.25rem;
    margin-bottom: 16px;
  }
}

/* Spotify Cards - Redesigned */
.spotify-card {
  background: #181818;
  border-radius: 10px;
  padding: 16px;
  transition: background-color 0.3s ease;
  cursor: pointer;
  position: relative;
  isolation: isolate;
}
.spotify-card:hover {
  background-color: #282828;
}

.card-image-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1/1;
  margin-bottom: 16px;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.card-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.spotify-card:hover .card-image-wrapper img {
  transform: scale(1.05);
}

.play-button-overlay {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 48px;
  height: 48px;
  background: var(--accent-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 16px rgba(0,0,0,0.3);
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2;
}
.spotify-card:hover .play-button-overlay {
  opacity: 1;
  transform: translateY(0);
}
.play-button-overlay:hover {
  transform: scale(1.06) !important;
  background: #1fdf64;
}
.play-button-overlay i {
  color: #000;
  font-size: 1.2rem;
  margin-left: 2px;
}

.card-title {
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-subtitle {
  font-size: 0.875rem;
  color: var(--text-subdued);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

/* Sticky Header - Redesigned */
.top-bar {
  height: 64px;
  background: rgba(18, 18, 18, 0.7);
  display: flex;
  align-items: center;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: background-color 0.3s;
}

@media (max-width: 768px) {
  .top-bar {
    padding: 0 16px;
    height: 56px;
  }
}

.nav-btn {
  background: rgba(0,0,0,0.7);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

@media (max-width: 480px) {
  .nav-btn {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }
}

/* Top Bar Layout Helpers */
.top-bar-left {
  display: flex;
  gap: 16px;
  margin-right: auto;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hide-mobile {
  display: inline-flex;
}

@media (max-width: 768px) {
  .hide-mobile {
    display: none !important;
  }
}

.auth-link {
  color: var(--text-subdued);
  text-decoration: none;
  font-weight: 700;
  transition: color 0.2s;
}

.auth-link:hover {
  color: #fff;
}

.upload-btn, .login-btn {
  white-space: nowrap;
}

@media (max-width: 480px) {
  .top-bar-right {
    gap: 8px;
  }
  .login-btn {
    padding: 6px 16px;
    font-size: 0.8rem;
  }
  .upload-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
  }
}

.btn-primary {
  background: var(--accent-color);
  color: #000;
  border: none;
  padding: 12px 32px;
  border-radius: 500px;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  transition: transform 0.2s, background-color 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 480px) {
  .btn-primary {
    padding: 8px 20px;
    font-size: 0.85rem;
  }
}
.btn-primary:hover {
  transform: scale(1.05);
  background: #1fdf64;
}

.user-pill {
  background: rgba(0,0,0,0.7);
  padding: 4px 12px 4px 4px;
  border-radius: 500px;
  text-decoration: none;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  transition: all 0.2s;
}

.user-pill:hover {
  background: rgba(0,0,0,0.9);
  transform: scale(1.05);
}

.user-pill i {
  background: #535353;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#recentlyUploadedSection {
  margin-top: 32px;
}

@media (max-width: 768px) {
  #recentlyUploadedSection {
    margin-top: 24px;
  }
}

/* Browse Page Styles */
.search-input-wrapper {
  position: relative;
  width: 100%;
}
.search-input-wrapper i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #000;
}
.search-input-wrapper input {
  width: 100%;
  padding: 12px 12px 12px 40px;
  border-radius: 500px;
  border: none;
  background: #fff;
  color: #000;
  font-weight: 500;
  font-size: 0.875rem;
}
.browse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 24px;
}
.browse-card {
  aspect-ratio: 1/1;
  border-radius: 8px;
  padding: 16px;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  color: #fff;
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.04em;
  transition: transform 0.3s ease;
}
.browse-card:hover {
  transform: scale(1.02);
}
.browse-card img {
  position: absolute;
  right: -20px;
  bottom: -10px;
  width: 100px;
  height: 100px;
  transform: rotate(25deg);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

@media (max-width: 480px) {
  .browse-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
  .browse-card {
    font-size: 1.2rem;
  }
}

/* Redesigned Hero Section */
.hero-banner {
  min-height: 280px;
  max-height: 400px;
  width: 100%;
  border-radius: 12px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #1e3a8a 0%, #1db954 100%);
  display: flex;
  align-items: flex-end;
  padding: 40px;
  isolation: isolate;
  box-sizing: border-box;
}

.hero-banner::after {
  content: '';
  position: absolute;
  top: -20%;
  right: -10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(29, 185, 84, 0.3) 0%, transparent 70%);
  z-index: 1;
  border-radius: 50%;
  pointer-events: none;
}

@media (max-width: 1024px) {
  .hero-banner {
    padding: 30px;
    min-height: 240px;
  }
}

@media (max-width: 768px) {
  .hero-banner {
    min-height: 200px;
    padding: 24px;
    margin-bottom: 24px;
    border-radius: 0;
  }
  .hero-banner::after {
    width: 250px;
    height: 250px;
    top: -10%;
    right: -10%;
  }
}

.hero-content {
  z-index: 2;
  color: #fff;
  width: 100%;
}

.hero-tag {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 8px;
  display: block;
}

.hero-title {
  font-size: clamp(2.5rem, 8vw, 6rem);
  font-weight: 900;
  margin: 0;
  letter-spacing: -0.04em;
  line-height: 1;
  word-break: break-word;
}

@media (max-width: 768px) {
  .hero-title {
    font-size: clamp(2rem, 10vw, 3.5rem);
  }
}

/* Spotify Grid Layout */
.spotify-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 24px;
  width: 100%;
}

/* Music List (Songs) */
.track-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
}

.track-item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  transition: background-color 0.18s ease;
  position: relative;
}
.track-item:last-child { border-bottom: none; }
.track-item:hover { background: rgba(255,255,255,0.06); }
.track-item.active { background: rgba(29,185,84,0.12); }

.track-img {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  background: rgba(0,0,0,0.25);
  box-shadow: 0 8px 18px rgba(0,0,0,0.35);
}

.track-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.track-name {
  color: #fff;
  font-weight: 700;
  font-size: 0.98rem;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-artist {
  color: rgba(255,255,255,0.65);
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.track-duration {
  color: rgba(255,255,255,0.65);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  min-width: 44px;
  text-align: right;
}

.track-play-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(0,0,0,0.35);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.18s ease, border-color 0.18s ease;
}
.track-play-btn:hover {
  transform: scale(1.06);
  background: rgba(29,185,84,0.18);
  border-color: rgba(29,185,84,0.45);
}

.track-more-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.75);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease;
}
.track-more-btn:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

@media (max-width: 480px) {
  .track-item {
    grid-template-columns: 52px 1fr auto;
    padding: 10px 12px;
    gap: 12px;
  }
  .track-img { width: 42px; height: 42px; border-radius: 10px; }
  .track-duration { display: none; }
}

@media (max-width: 1400px) {
  .spotify-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

@media (max-width: 1024px) {
  .spotify-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
  }
}

@media (max-width: 768px) {
  .spotify-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
  }
}

@media (max-width: 480px) {
  .spotify-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

/* Spotify Cards */
.spotify-card {
  background: #181818;
  border-radius: 8px;
  padding: 16px;
  transition: background-color 0.3s ease;
  cursor: pointer;
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
}
.spotify-card:hover {
  background-color: #282828;
}

.card-image-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1/1;
  margin-bottom: 16px;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.card-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.spotify-card:hover .card-image-wrapper img {
  transform: scale(1.05);
}

.play-button-overlay {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 48px;
  height: 48px;
  background: var(--accent-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 16px rgba(0,0,0,0.3);
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2;
}
.spotify-card:hover .play-button-overlay {
  opacity: 1;
  transform: translateY(0);
}
.play-button-overlay:hover {
  transform: scale(1.06) !important;
  background: #1fdf64;
}
.play-button-overlay i {
  color: #000;
  font-size: 1.2rem;
  margin-left: 2px;
}

.card-title {
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-subtitle {
  font-size: 0.875rem;
  color: var(--text-subdued);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

/* Floating Player Bar - Mobile Redesign */
@media (max-width: 768px) {
  .player-bar {
    padding: 0 12px 12px 12px;
    background: transparent;
  }

  #audioPlayerContainer {
    background: rgba(40, 40, 40, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 12px;
    height: 64px;
    padding: 0 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
    width: 100%;
    position: relative;
    overflow: hidden;
  }

  /* Progress bar at the bottom of the pill */
  #audioPlayerContainer::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: rgba(255,255,255,0.3);
    width: 100%;
  }

  .mobile-progress-indicator {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: #fff;
    z-index: 2;
    transition: width 0.1s linear;
  }

  .player-info {
    width: 100%;
    min-width: 0;
    gap: 12px;
  }
  .player-info img {
    width: 44px;
    height: 44px;
    border-radius: 4px;
  }
  .player-title { font-size: 0.9rem; }
  .player-artist { font-size: 0.75rem; }

  .player-controls {
    flex-direction: row;
    width: auto;
    gap: 12px;
  }
  .control-buttons { gap: 16px; }
  .control-buttons button:not(#playPauseBtn) { display: none; }
  
  .play-pause-btn {
    background: none !important;
    color: #fff !important;
    font-size: 1.4rem !important;
    width: auto;
    height: auto;
  }
}

/* Small Grid Mode (Jump Back In) */
.small-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.small-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
  transition: background-color 0.2s;
  cursor: pointer;
  height: 64px;
}

.small-item:hover {
  background: rgba(255, 255, 255, 0.15);
}

.small-item img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  box-shadow: 4px 0 10px rgba(0,0,0,0.3);
}

.small-item-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 12px;
}

.small-play-btn {
  width: 32px;
  height: 32px;
  background: var(--accent-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  margin-left: auto;
  margin-right: 12px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.small-item:hover .small-play-btn {
  opacity: 1;
  transform: scale(1);
}

@media (max-width: 1200px) {
  .small-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .small-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .small-item { height: 56px; }
  .small-item img { width: 56px; height: 56px; }
  .small-item-title { font-size: 0.8rem; }
  .small-play-btn { display: none; } /* Hide play btn on mobile small grid */
}

@media (max-width: 1400px) {
  .spotify-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

@media (max-width: 1024px) {
  .spotify-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
  }
}

@media (max-width: 768px) {
  .spotify-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
  }
}

@media (max-width: 480px) {
  .spotify-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}


.bb-navbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.bb-nav {
  display: none;
  align-items: center;
  gap: 30px;
}
.bb-nav a {
  text-decoration: none;
  color: var(--header-muted);
  font-weight: 600;
  font-size: 0.95rem;
  transition: color 0.2s;
}
.bb-nav a.active, .bb-nav a:hover {
  color: var(--accent-color);
}

.bb-mobile-menu {
  display: none;
  position: absolute;
  top: var(--header-h);
  right: 20px;
  left: 20px;
  background: var(--card-bg);
  border-radius: var(--ui-radius);
  border: 1px solid var(--header-border);
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
  padding: 10px;
  z-index: 1000;
}
.bb-mobile-menu a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  text-decoration: none;
  color: #fff;
  font-weight: 500;
}
.bb-mobile-menu a:hover { background: rgba(255,255,255,0.05); }

@media (min-width: 1024px) {
  .bb-nav { display: flex; }
  .bb-hamburger { display: none; }
}
