/* SangeetSagar Pro Edition
  Optimized for Extreme Grid Density & Mobile Fluidity

*/
:root {
  --bg: #05050a;
  --bg-gradient: radial-gradient(circle at top left, #121225, #05050a);
  --card: rgba(255, 255, 255, 0.04);
  --accent: #1DB954;
  --accent-glow: rgba(29, 185, 84, 0.3);
  --text: #ffffff;
  --text-dim: #9ca3af;
  --hover: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.08);
  --glass: rgba(10, 10, 15, 0.85);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', system-ui, sans-serif; }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

body {
  background: var(--bg);
  background-image: var(--bg-gradient);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: 120px; /* Space for player */
}

/* Header & Search */
header {
  padding: 12px 24px;
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-top {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 1600px;
  margin: 0 auto;
}

.logo {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -1px;
  background: linear-gradient(90deg, #1DB954, #1ed760);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}


.search-wrapper {
  position: relative;
  flex: 1;
  max-width: 450px;
}

.search-container {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 4px 6px 4px 16px;
  transition: 0.3s;
}

.search-container:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 15px var(--accent-glow);
}

#search {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  outline: none;
  font-size: 0.9rem;
}

.search-btn {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 10px;
  padding: 8px 16px;
  font-weight: 700;
  cursor: pointer;
}


/* Sections */
.sections {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-bottom: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  touch-action: pan-x;
  -webkit-overflow-scrolling: touch;
}

.section-btn {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  cursor: pointer;
  white-space: nowrap;
  transition: 0.2s;
}

.section-btn.active { background: var(--accent); color: #000; border-color: var(--accent); }

/* --- PRO GRID: Target 10 Items per Row --- */
main { padding: 20px; max-width: 1600px; margin: 0 auto; }

.song-grid {
  display: grid;
  /* Calculated for ~10 per row on high res screens */
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 16px;
}

.song-card {
  background: var(--card);
  border-radius: 12px;
  padding: 10px;
  border: 1px solid transparent;
  transition: all 0.3s var(--ease);
  cursor: pointer;
  position: relative;
}

.song-card:hover {
  background: var(--hover);
  transform: translateY(-4px);
  border-color: var(--border);
}

.song-card.playing {
  border-color: var(--accent);
  background: rgba(29, 185, 84, 0.1);
}

.card-cover {
  width: 100%;
  aspect-ratio: 1;
  background: linear-gradient(135deg, #1f1f2b, #12121a);
  border-radius: 8px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem; /* Smaller icon for density */
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* Strict Character Limits */
.card-title, .card-artist {
  display: block;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0 auto;
}

.card-title {
  font-size: 0.75rem;
  font-weight: 600;
  max-width: 10ch; /* Limit to 10 characters */
}

.card-artist {
  font-size: 0.65rem;
  color: var(--text-dim);
  max-width: 10ch; /* Limit to 10 characters */
}

/* --- PRO PLAYER --- */
.player {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 95%;
  max-width: 1200px;
  background: rgba(15, 15, 20, 0.9);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 12px 24px;
  z-index: 1000;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
}

.player-inner {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  align-items: center;
  gap: 24px;
}

.ctrl-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  transition: 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ctrl-btn:hover { color: var(--accent); transform: scale(1.1); }

 /*.play-btn {
  width: 42px;
  height: 42px;
  background: var(--accent);
  color: #000;
  border-radius: 50%;
  font-size: 1rem;
} */

.ctrl-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 50%; /* Changed to circular */
  width: 40px;        /* Fixed width */
  height: 40px;       /* Fixed height */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: 0.2s;
}


/* Highlights the button with a green background when active */
.ctrl-btn.active {
    background-color: #1DB954 !important; /* Spotify Green */
    color: white !important;              /* White icon for contrast */
    box-shadow: 0 0 15px rgba(29, 185, 84, 0.4);
    border-radius: 50%;
    transform: scale(1.1);
    border: none;
}




/* Remove the min-width: 110px rule you had before */
#shuffleBtn, #repeatBtn {
  min-width: 40px; 
}

.progress-bar {
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
}

.progress {
  height: 100%;
  background: var(--accent);
  width: 0%;
  border-radius: 2px;
  position: relative;
}

/* Progress Handle on Hover */
.progress-bar:hover .progress::after {
  content: '';
  position: absolute;
  right: -4px;
  top: -4px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-glow);
}



/* --- MOBILE OPTIMIZATION --- */

@media (max-width: 768px) {
  body { padding-bottom: 180px; }
  
  .header-top { flex-wrap: wrap; }
  .logo { order: 1; }
  .about-btn { order: 2; }
  .search-wrapper { order: 3; width: 100%; max-width: 100%; }

  .song-grid {
    grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
    gap: 10px;
  }

  .player {
    width: 100%;
    bottom: 0;
    border-radius: 20px 20px 0 0;
    padding: 16px;
  }

  .player-inner {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .player-info { text-align: center; }
  .player-extras { display: none; }
 
 
 /* .player-extras {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
}  */
 
  
  .control-buttons { margin-bottom: 12px !important; }
}

@media (max-width: 480px) {
  .song-grid {
    grid-template-columns: repeat(3, 1fr); /* Force 3 columns on small phones */
  }
  
  .card-title, .card-artist {
    font-size: 0.65rem;
    max-width: 10ch;
  }
}

/* Sidebar Styling */
.about-sidebar {
  position: fixed; top: 0; right: -100%; width: 300px; height: 100%;
  background: #0a0a0f; border-left: 1px solid var(--border);
  padding: 40px 24px; z-index: 2000; transition: 0.4s var(--ease);
}
.about-sidebar.active { right: 0; }
.overlay { 
  position: fixed; inset: 0; background: rgba(0,0,0,0.8); 
  backdrop-filter: blur(4px); z-index: 1500; display: none; 
}
.overlay.active { display: block; }



.progress-bar {
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  /* Add a vertical margin to increase the invisible touchable area */
  margin: 15px 0; 
  touch-action: none; /* Prevents the browser from taking over the touch event */
}

/* Invisible hit-area for better finger accuracy */
.progress-bar::before {
  content: '';
  position: absolute;
  top: -15px;
  bottom: -15px;
  left: 0;
  right: 0;
}

.progress {
  height: 100%;
  background: var(--accent);
  width: 0%;
  border-radius: 2px;
  position: relative;
}

/* The Handle (Dot) - Always visible on mobile, visible on hover for desktop */
.progress::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-glow);
  opacity: 1; /* Keeping it visible for mobile users to see they can drag */
}

/* Make the dot pulse slightly when active/dragging */
.progress-bar:active .progress::after {
  transform: translateY(-50%) scale(1.3);
  background: var(--accent);
}




#volume {
  -webkit-appearance: none;
  width: 100px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  transition: 0.2s;
}

/* The "Thumb" (the draggable circle) for Chrome/Safari */
#volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-glow);
  cursor: pointer;
  transition: transform 0.2s;
}

#volume::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* The "Thumb" for Firefox */
#volume::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}






/* --- ENHANCED VOLUME SLIDER --- */
#volume {
  -webkit-appearance: none;
  width: 100px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

#volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 8px var(--accent-glow);
}

/* --- TOP 50 RANK BADGE --- */
.rank-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--accent);
    color: #000;
    font-size: 0.65rem;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 3px;
    z-index: 5;
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 768px) {
  /* Hide volume controls on mobile browsers */
  .player-extras {
    display: none !important;
  }
  
  /* Adjust player layout for mobile */
  .player-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }
}




/* Make the loading hourglass indicator look alive */
@keyframes pulseGlow {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

.play-btn {
  transition: all 0.2s ease;
}

/* Optional helper styling if you want to assign a class during buffering */
.buffering-active {
  animation: pulseGlow 1.5s infinite;
}

