/* ===========================================
   GLOBAL STYLES - BeatByte Website
   This file contains site-wide styling rules
   =========================================== */

/* CSS Custom Properties (Variables)
   These are reusable values used throughout the site.
   Change a variable here and it updates everywhere. */
:root {
  --bg: #000000; /* Main background color (black) */
  --panel: #000000; /* Panel/card background color */
  --muted: #9a9a9a; /* Gray color for secondary text */
  --accent1: #7b2ff7; /* Primary accent - purple */
  --accent2: #ff6b6b; /* Secondary accent - coral/red */
  --glow: 0 0 12px rgba(123, 47, 247, 0.6); /* Purple glow effect for hover states */
  --sidebar-width: 80px; /* Width of the left sidebar - changes on mobile */
}

/* CSS Reset
   Removes default browser styling so all browsers look the same.
   box-sizing: border-box makes width/height include padding and border. */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Base body styling */
html,
body {
  height: 100%;
  background: var(--bg);
  font-family: "Josefin Sans", sans-serif; /* User requested font + fallback */
  color: #eee; /* Light text for dark theme */
  font-size: 1.125rem; /* Increased base font size (18px) */
}

/* Main Grid Layout
   The page is divided into a CSS Grid with:
   - 2 columns: sidebar (80px) + main content (rest of space)
   - 3 rows: topbar (80px) + content (flexible) + player (80px)
   This creates the app-like layout with fixed header/footer. */
.grid-container {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr; /* Sidebar + remaining space */
  grid-template-rows: auto 1fr 80px; /* Header wrapper + content + player */
  height: 100vh; /* Full viewport height */
  transition: grid-template-columns 0.3s ease; /* Smooth sidebar expand/collapse */
}

/* Hidden checkbox used for sidebar toggle (hamburger menu)
   The actual toggle logic is in sidebar.css using :checked selector */
#menuToggle {
  display: none;
}

/* Main content area (right side of sidebar) */
.body-right {
  padding: 30px;
  overflow-y: auto; /* Scroll if content is too tall */
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: rgba(123, 47, 247, 0.4) transparent; /* Firefox: thumb track */
}

/* Custom Scrollbar Styling - WebKit (Chrome, Safari, Edge) */
.body-right::-webkit-scrollbar {
  width: 8px;
}

.body-right::-webkit-scrollbar-track {
  background: transparent;
}

.body-right::-webkit-scrollbar-thumb {
  background: rgba(123, 47, 247, 0.4);
  border-radius: 4px;
}

.body-right::-webkit-scrollbar-thumb:hover {
  background: rgba(123, 47, 247, 0.6);
}

/* Global scrollbar styling for all scrollable elements */
*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: rgba(123, 47, 247, 0.3);
  border-radius: 3px;
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(123, 47, 247, 0.5);
}

/* Hide scrollbar but keep functionality (optional - uncomment if preferred)
*::-webkit-scrollbar {
  display: none;
}
* {
  scrollbar-width: none;
}
*/

/* Section headers (e.g., "New Releases", "Popular") */
.section-title {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

/* ===========================================
   HEADER & ANNOUNCEMENT STRIP
   =========================================== */

/* Wrapper for Topbar + Announcement
   Spans full width of the first row */
.header-wrapper {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  z-index: 100;
}

.announcement-strip {
  background: var(--accent1);
  color: white;
  font-size: 1.2rem;
  padding: 6px 0;
  text-align: center;
  font-weight: 400;
  letter-spacing: 0.5px;
  width: 100%;
}

.announcement-strip a {
  color: white;
  text-decoration: underline;
  font-weight: 400;
}

.announcement-strip a:hover {
  opacity: 0.9;
}

/* ===========================================
   REUSABLE COMPONENTS - Buttons & Utilities
   =========================================== */

/* Base Button Styles */
.btn {
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

/* Primary Button */
.btn-primary {
  background: linear-gradient(90deg, var(--accent1), var(--accent2));
  color: white;
  box-shadow: var(--glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(123, 47, 247, 0.8);
}

/* Secondary Button */
.btn-secondary {
  background: rgba(123, 47, 247, 0.2);
  color: var(--accent1);
  border: 1px solid var(--accent1);
}

.btn-secondary:hover {
  background: rgba(123, 47, 247, 0.3);
  transform: translateY(-2px);
}

/* Ghost Button (transparent) */
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #eee;
  border-color: rgba(255, 255, 255, 0.2);
}

/* Icon Button (circular) */
.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.btn-icon.active {
  color: var(--accent1);
}

.btn-icon svg {
  width: 20px;
  height: 20px;
}

/* Button Sizes */
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}

/* Common Utilities */
.text-ellipsis {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.text-muted {
  color: var(--muted);
}

.rounded {
  border-radius: 8px;
}

.rounded-full {
  border-radius: 50%;
}

.shadow-sm {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.shadow-md {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.shadow-lg {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.transition-all {
  transition: all 0.2s ease;
}

/* Reusable Progress Bar */
.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent1), var(--accent2));
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 0%;
}

/* Icon Toggle Pattern (e.g., play/pause) */
.icon-toggle .secondary-icon {
  display: none;
}

.icon-toggle.active .primary-icon {
  display: none;
}

.icon-toggle.active .secondary-icon {
  display: block;
}

/* ===========================================
   RESPONSIVE BREAKPOINTS - Global Layout
   
   Breakpoints:
   - Desktop: 769px+ (full layout)
   - Tablet: 481px - 768px (compact)
   - Mobile: ≤480px (single column)
   =========================================== */

/* TABLET STYLES (screens ≤768px wide)
   Slightly smaller sidebar, reduced padding */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 60px; /* Narrower sidebar on tablets */
  }

  .body-right {
    padding: 20px 15px; /* Less padding to save space */
  }

  .section-title {
    font-size: 1.2rem; /* Smaller headings */
  }
}

/* MOBILE STYLES (screens ≤480px wide)
   On phones, we show a compact icon-only sidebar.
   The sidebar width is narrower to maximize content space. */
@media (max-width: 480px) {
  :root {
    --sidebar-width: 50px; /* Compact icon-only sidebar on mobile */
  }

  /* Two-column layout with narrow sidebar */
  .grid-container {
    grid-template-columns: var(--sidebar-width) 1fr; /* Sidebar + content */
    grid-template-rows: 60px 1fr 80px; /* Shorter topbar on mobile */
  }

  .body-right {
    padding: 15px 10px;
    padding-bottom: 100px; /* Extra space at bottom so content isn't hidden by player */
  }

  .section-title {
    font-size: 1.1rem;
  }
}

/* Bottom left corner of grid (below sidebar)
   Usually empty or shows minimal info */
.bottom-left {
  background: #0b0b0b;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Musician modal backdrop */
#musician-modal .modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--bg, #070707);
  backdrop-filter: blur(4px);
  z-index: 600;
}

/* ===========================================
   PLAYER RESPONSIVE STYLES
   =========================================== */

/* Tablet - Player adjustments */
@media (max-width: 900px) {
  .music-player {
    padding: 10px 16px;
  }

  .now-playing {
    gap: 16px;
  }

  .now-playing-info {
    min-width: 140px;
    max-width: 180px;
  }

  .progress-section {
    min-width: 150px;
  }

  .volume-control:hover .volume-slider-container {
    width: 60px;
  }
}

/* Mobile - Player adjustments */
@media (max-width: 600px) {
  .music-player {
    padding: 8px 12px;
  }

  .now-playing {
    gap: 10px;
    flex-wrap: wrap;
  }

  .now-playing-art {
    width: 48px;
    height: 48px;
  }

  .now-playing-info {
    min-width: 100px;
    max-width: 140px;
  }

  .song-title {
    font-size: 13px;
  }

  .song-artist {
    font-size: 11px;
  }

  .progress-section {
    order: 3;
    width: 100%;
    min-width: 100%;
    margin-top: 8px;
  }

  .player-controls {
    gap: 4px;
  }

  .control-btn {
    width: 36px;
    height: 36px;
  }

  .control-btn svg {
    width: 18px;
    height: 18px;
  }

  .control-btn.play-btn {
    width: 42px;
    height: 42px;
  }

  /* Mobile volume slider - always visible, compact */
  .volume-slider-container {
    width: 60px !important;
    overflow: visible;
  }

  .volume-slider-track {
    width: 60px;
  }

  .volume-slider {
    width: 60px;
  }
}

/* Extra Small - Player adjustments */
@media (max-width: 380px) {
  .now-playing-info {
    min-width: 80px;
    max-width: 120px;
    flex: 1;
  }

  .song-title {
    font-size: 12px;
  }

  .song-artist {
    font-size: 10px;
  }

  .player-controls {
    gap: 2px;
  }

  .control-btn {
    width: 32px;
    height: 32px;
  }

  .control-btn svg {
    width: 16px;
    height: 16px;
  }

  .control-btn.play-btn {
    width: 38px;
    height: 38px;
  }

  .control-btn.play-btn svg {
    width: 20px;
    height: 20px;
  }
}
