:root {
  --accent-color: #00aaff;
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.15);
  --text-light: #f0f0f0;
  --text-dark: #cccccc;
}

* {
  box-sizing: border-box;
}

html {
  background-color: #000000;
}

body {
  padding: 0;
  margin: 0;
  height: 100dvh;
  width: 100vw;
  background-color: #000000;
  background-image: url("images/bg-shinny.jpg");
  background-size: cover;
  background-position: center;
  font-family: "Inter", sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  color: var(--text-light);
}

.main-container {
  display: flex;
  flex-direction: row;
  width: 90vw;
  height: 90vh;
  max-width: 1400px;
  max-height: 800px;
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  position: relative;
}

/* --- HAMBURGER MENU & SIDE MENU STYLES --- */
#hamburger-menu-btn {
  position: absolute;
  top: 20px;
  left: 20px;
  width: 40px;
  height: 40px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  padding: 8px;
  cursor: pointer;
  z-index: 2000;
  transition: background-color 0.3s ease;
}

#hamburger-menu-btn:hover {
  background-color: rgba(255, 255, 255, 0.15);
}

#hamburger-menu-btn span {
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--text-light);
  border-radius: 1px;
}

#side-menu {
  position: absolute;
  top: 0;
  left: -350px;
  width: 300px;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  border-right: 1px solid var(--glass-border);
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
  z-index: 99;
  transition: left 0.3s ease-in-out;
  display: flex;
  flex-direction: column;
  padding: 20px;
  text-align: center;
}

#side-menu.is-open {
  left: 0;
}

#side-menu .menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--glass-border);
}

#side-menu .menu-header h2 {
  margin: 0;
  color: var(--text-light);
}

.menu-header h2 {
  text-align: right;
  width: 100%;
}

#side-menu .login-form {
  background: var(--glass-bg);
  padding: 20px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  margin-bottom: 20px;
}

#side-menu .login-form h3 {
  margin-top: 0;
  text-align: center;
  color: var(--text-light);
}

#side-menu input,
#side-menu button {
  display: block;
  width: 100%;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 6px;
  border: 1px solid var(--glass-border);
  background-color: rgba(0, 0, 0, 0.3);
  color: var(--text-light);
  font-size: 0.9rem;
}

#side-menu button#side-menu-login-button {
  background-color: var(--accent-color);
  cursor: pointer;
  font-weight: bold;
}

#side-menu p.login-message {
  color: #ff5555;
  min-height: 1.2em;
  font-size: 0.85rem;
  text-align: center;
}

#side-menu #side-menu-guest-button {
  text-align: center;
  color: var(--text-dark);
  font-size: 0.85rem;
  cursor: pointer;
  margin-top: 10px;
  padding: 5px;
  transition: color 0.2s ease;
}
#side-menu #side-menu-guest-button:hover {
  color: var(--text-light);
  text-decoration: underline;
}

/* --- OVERLAY FOR SIDE MENU (to dim content) --- */
#menu-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 98;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}

#menu-backdrop.is-visible {
  opacity: 1;
  visibility: visible;
}

/* --- PLAYSCEEN DIV (Flexbox Layout) --- */
#player-section {
  flex: 3; /* Desktop: Takes 3 parts width */
  margin-right: var(--spacing-s);

  /* The Container Layout */
  display: flex;
  flex-direction: column; /* Stack Image on top of Info */
  overflow: hidden; /* Keep children inside rounded corners */
  border-radius: var(--border-radius);
  position: relative; /* Context for absolute positioning */

  /* Remove old grid/padding/bg settings */
  padding: 0;
  background-color: transparent;
}

/* --- ZONE 1: VISUAL (The Hero Image) --- */
#player-visual-zone {
  flex: 1; /* Grow to fill ALL available space */
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  min-height: 0; /* Critical for Flexbox image scaling */
  width: 100%;

  /* Fallback BG if no image */
  background-image: var(--player-default-bg-image);
  background-size: cover;
  background-position: center;
}

#player-logo {
  width: 100%;
  height: 100%;
  object-fit: contain; /* Ensure 1:1 image is never cropped */

  /* Optional: Drop shadow to lift image off background */
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.5));
  transition: opacity 0.3s ease;
}

/* Center the spinner over the image */
.loading-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none; /* JS toggles this */
  z-index: 10;
}

/* --- ZONE 2: INFO DOCK (Glassmorphism) --- */
#player-info-zone {
  /* Dimensions */
  width: 100%;
  height: auto;
  min-height: auto; /* Force enough space for 3 lines of text */
  flex-shrink: 0; /* Don't shrink this area */

  /* Layout: Row with Text on Left, Button on Right */
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;

  /* The Glass Look */
  background: rgba(0, 0, 0, 0.6); /* Semi-transparent black */
  backdrop-filter: blur(15px); /* The Blur Effect */
  -webkit-backdrop-filter: blur(15px);

  padding: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 20;
}

/* --- METADATA TEXT STYLING --- */
#metadata-container {
  flex: 1; /* Take all space to the left of the button */
  min-width: 0; /* CRITICAL: Allows text truncation in flexbox */
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px; /* Space between lines */
  will-change: transform, height;
}

/* 1. Station Badge (Small Pill) */
.meta-badge {
  display: inline-block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  color: #ffd700; /* Gold color for station name */
  margin-bottom: 4px;
}

/* 2. Song Title (Big, White, Multiline) */
.meta-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: white;
  line-height: 1.2;

  /* Smart Multiline Truncation */
  display: -webkit-box; /* Required for line-clamp */
  width: 100%; /* Force full width */
  -webkit-line-clamp: 2; /* Limit to 2 lines */
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 3. Artist (Grey, Medium, Multiline) */
.meta-artist {
  font-size: 1rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.7); /* Silver */

  /* Smart Multiline Truncation */
  display: -webkit-box; /* Required for line-clamp */
  width: 100%; /* Force full width */
  -webkit-line-clamp: 2; /* Limit to 2 lines */
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- CONTROLS --- */
#controls-container {
  flex-shrink: 0; /* Don't shrink */
  margin-left: 15px;
  display: flex;
  align-items: center;
}

#stop-button {
  width: 60px;
  height: 60px;
  cursor: pointer;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
  transition: transform 0.1s;
  display: none; /* JS toggles this */
}

#stop-button:active {
  transform: scale(0.95);
}

/* --- CHANNELLIST DIV --- */
#channel-list {
  flex-shrink: 0;
  width: 400px;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  border-left: 1px solid var(--glass-border);
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  justify-content: center;
  gap: 20px;
  overflow-y: auto;
  padding: 20px 0px;
  box-shadow:
    inset 0 20px 0 0 rgba(0, 0, 0, 0.3),
    inset 0 -20px 0 0 rgba(0, 0, 0, 0.3);
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
  scrollbar-width: thin;
  box-sizing: border-box;
}
.channel-list__item {
  width: 110px;
  height: 110px;
  flex-shrink: 0;
  background: var(--glass-bg);
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}
.channel-list__item.is-playing {
  border: 1px solid var(--accent-color);
}
.channel-list__image {
  max-width: 120%;
  max-height: 120%;
  object-fit: cover;
}

#channel-list::-webkit-scrollbar {
  width: 8px;
}
#channel-list::-webkit-scrollbar-track {
  background: transparent;
}
#channel-list::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.25);
  border-radius: 10px;
}

#channel-list::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.4);
}

/* --- Style for UNAVAILABLE channels (for guests or specific browser/screen) --- */
.channel-list__item.is-hidden {
  display: none !important;
}

/* --- Style for premium channels (visible but indicates premium) --- */
.channel-list__item.is-premium::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  /* Lock icon SVG (white) */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 2C9.243 2 7 4.243 7 7v3H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8a2 2 0 0 0-2-2h-1V7c0-2.757-2.243-5-5-5zm0 2c1.654 0 3 1.346 3 3v3H9V7c0-1.654 1.346-3 3-3z'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-color: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  padding: 4px;
  box-sizing: border-box;
  z-index: 10;
}

/* --- NEW STYLES for Song Title --- */
#now-playing-song {
  position: absolute;
  top: 10px;
  left: 10%;
  width: 80%;
  color: var(--text-light);
  font-size: 1.3rem;
  font-weight: 600;
  text-align: center;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
}

/* --- NEW: ABOUT PANEL OVERLAY STYLES (Self-contained) --- */
#about-panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(5px);
  z-index: 1000;
  display: none;
  justify-content: center;
  align-items: center;
  overflow-y: auto;
  padding: 20px;
}

#about-panel-content {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 15px;
  padding: 30px;
  max-width: 700px;
  width: 90%;
  color: var(--text-light);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

#about-panel-content h3 {
  color: var(--accent-color);
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 10px;
}

#about-panel-content h4 {
  color: #ddd;
  margin-top: 20px;
}

#about-panel-content ul {
  list-style: disc;
  padding-left: 20px;
  margin-top: 10px;
  margin-bottom: 20px;
}
#about-panel-content li {
  margin-bottom: 5px;
  font-size: 0.95rem;
}
#about-panel-content hr {
  border-color: var(--glass-border);
}

#about-close-btn {
  background-color: var(--accent-color);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 20px;
  font-weight: 600;
  display: block;
  width: 100%;
}

/* About Panel Styling */
.about-section {
  text-align: left;
  margin-bottom: 20px;
}

.about-section h4 {
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  padding-bottom: 5px;
  margin-bottom: 10px;
  color: #ffd700; /* Gold */
  text-transform: uppercase;
  font-size: 0.9rem;
  letter-spacing: 1px;
}

.tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 5px;
}

.tech-badge {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  color: white;
}

.about-desc {
  font-size: 0.9rem;
  line-height: 1.5;
  color: #ddd;
}

.myHeading {
  color: var(--accent-color);
  font-weight: bold;
}

#toast-container {
  visibility: hidden;
  min-width: 250px;
  background-color: rgba(0, 0, 0, 0.9);
  color: #fff;
  text-align: center;
  border-radius: 50px;
  padding: 16px;
  position: fixed;
  z-index: 10000;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  font-size: 14px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition:
    opacity 0.3s,
    bottom 0.3s;
}

#toast-container.show {
  visibility: visible;
  opacity: 1;
  bottom: 50px; /* Slide up slightly */
}

/* --- Toggle Switch Styling --- */
.menu-toggle-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 90%; /* Match button width */
  color: white;
  font-weight: bold;
  font-size: 0.9rem;
  padding: 5px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.2);
  transition: 0.4s;
  border-radius: 34px;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

/* Checked State */
input:checked + .slider {
  background-color: #00ffcc; /* Your HUD Cyan Color */
  border-color: #00ffcc;
}

input:checked + .slider:before {
  transform: translateX(26px);
  background-color: black;
}

/* --- MOBILE LAYOUT (60% Player / 40% List) --- */
/* --- MOBILE LAYOUT (60% Player / 40% List) --- */
/* --- MOBILE LAYOUT (60% Player / 40% List) --- */
/* --- MOBILE LAYOUT (60% Player / 40% List) --- */
/* --- MOBILE LAYOUT (60% Player / 40% List) --- */
/* --- MOBILE LAYOUT (60% Player / 40% List) --- */
/* --- MOBILE LAYOUT (60% Player / 40% List) --- */
/* --- MOBILE LAYOUT (60% Player / 40% List) --- */
/* --- MOBILE LAYOUT (60% Player / 40% List) --- */
/* --- MOBILE LAYOUT (60% Player / 40% List) --- */

@media (max-width: 768px) {
  .main-container {
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-width: unset;
    max-height: unset;
    border-radius: 0;
  }

  /* 1. Player Section (Top 60% - Hero Mode) */
  #player-section {
    flex: 0 0 60%; /* Takes 60% of vertical height */
    width: 100%;
    margin: 0;
    border-radius: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  /* 2. Visual Zone (The Image) */
  #player-visual-zone {
    padding: 0; /* Remove padding to let image go edge-to-edge if needed */
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  /* Force Image to be as big as possible within the 60% zone */
  #player-logo {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Ensures the square fits inside the rectangle without cropping */
    padding: 10px; /* Slight internal padding so it doesn't touch screen edges */
  }

  /* 3. Info Zone (Glass Dock) */
  #player-info-zone {
    padding: 10px 15px;
    /* FIX: Lock the height so it never dances */
    height: 115px; /* Exact height needed for 3 lines + padding */
    min-height: 115px;
    background: rgba(0, 0, 0, 0.85);
    /* Ensure it sits at the bottom of the player section */
    flex-shrink: 0;
  }

  /* Typography Adjustments */
  .meta-title {
    font-size: 1.2rem;
  } /* Slightly larger title since we have space */
  .meta-artist {
    font-size: 1rem;
  }

  /* Stop Button */
  #stop-button {
    width: 55px;
    height: 55px;
  }

  /* 4. Channel List (Bottom ~40%) */
  #channel-list {
    flex: 1; /* Takes the remaining space automatically */
    width: 100%;
    border-left: none;

    /* SCROLLING ESSENTIALS */
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;

    /* GRID LAYOUT - FORCED 3 COLUMNS */
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: min-content;
    gap: 10px;
    align-content: start;

    /* Padding */
    padding: 15px;
    padding-bottom: 80px;

    background-color: rgba(0, 0, 0, 0.2);
  }

  /* Channel Items */
  .channel-list__item {
    width: 100%;
    height: auto !important;
    aspect-ratio: 1 / 1;
    margin-bottom: 0 !important;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
  }

  /* Adjust hamburger position */
  #hamburger-menu-btn {
    top: 15px; /* Moved down slightly to clear status bars */
    left: 15px;
    z-index: 2200;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8));
  }
}
