/* ==========================================================================
   NØTUNE Desktop Web Platform Design System & CSS Stylesheet
   ========================================================================== */

:root {
  --bg-primary: #090A0F;
  --bg-secondary: #121520;
  --bg-card: rgba(18, 21, 32, 0.75);
  --bg-glass: rgba(255, 255, 255, 0.04);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.18);
  
  --accent-red: #FF0031;
  --accent-gradient: linear-gradient(135deg, #FF0031 0%, #E0002B 50%, #99001D 100%);
  --accent-glow: rgba(255, 0, 49, 0.35);
  
  --text-main: #F9FAFB;
  --text-muted: #9CA3AF;
  --text-subtle: #6B7280;

  --sidebar-width: 240px;
  --player-bar-height: 80px;
  --topbar-height: 64px;

  --font-family: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  overflow: hidden;
  user-select: none;
}

/* Background Ambient Glow */
.glow-bg {
  position: fixed;
  top: -20%;
  left: -10%;
  width: 60vw;
  height: 60vh;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}

/* Layout Grid Structure */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: 1fr var(--player-bar-height);
  height: 100vh;
  width: 100vw;
  position: relative;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   SIDEBAR NAVIGATION
   -------------------------------------------------------------------------- */
.sidebar {
  grid-column: 1;
  grid-row: 1;
  background: rgba(12, 14, 22, 0.95);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  z-index: 10;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding-bottom: 24px;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-main);
}

.logo-dot {
  color: var(--accent-red);
  font-size: 20px;
  animation: pulse-glow 2s infinite ease-in-out;
}

.logo-text {
  font-weight: 900;
  font-size: 22px;
  letter-spacing: -0.5px;
}

.badge {
  font-size: 10px;
  font-weight: 800;
  background: rgba(255, 0, 49, 0.15);
  color: var(--accent-red);
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 0, 49, 0.3);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 24px;
  flex: 1;
  overflow-y: auto;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-subtle);
  letter-spacing: 1px;
  padding: 0 12px 8px 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s ease;
}

.nav-item:hover {
  color: var(--text-main);
  background: var(--bg-glass);
}

.nav-item.active {
  color: var(--text-main);
  background: rgba(255, 0, 49, 0.12);
  border-left: 3px solid var(--accent-red);
}

.nav-icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.nav-badge {
  margin-left: auto;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 8px;
}

.nav-badge.live {
  background: #10B981;
  color: #042F2C;
}

.sidebar-user-box {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: 16px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
}

.user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-name {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-status {
  font-size: 11px;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   MAIN VIEWPORT & TOPBAR
   -------------------------------------------------------------------------- */
.main-content {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: radial-gradient(ellipse at top right, rgba(18,21,32,0.6) 0%, rgba(9,10,15,0.95) 100%);
}

.topbar {
  height: var(--topbar-height);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mobile-menu-toggle {
  display: none;
}

.nav-history-btns {
  display: flex;
  gap: 8px;
}

.icon-btn {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.icon-btn-sm {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.icon-btn-sm:hover {
  color: var(--text-main);
  background: var(--bg-glass);
}

.search-input-wrapper {
  position: relative;
  width: 320px;
}

.search-input-wrapper input {
  width: 100%;
  padding: 10px 16px 10px 38px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: all 0.2s ease;
}

.search-input-wrapper input:focus {
  border-color: var(--accent-red);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 12px var(--accent-glow);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-topbar-action {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10B981;
  padding: 8px 14px;
  border-radius: 20px;
  text-decoration: none;
  font-weight: 700;
  font-size: 12px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10B981;
  animation: pulse-glow 1.5s infinite;
}

.btn-primary-sm {
  background: var(--accent-gradient);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.view-viewport {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
}

/* --------------------------------------------------------------------------
   SHARED UI COMPONENTS & CARDS
   -------------------------------------------------------------------------- */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 24px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-header h2 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.btn-text {
  background: none;
  border: none;
  color: var(--accent-red);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 20px;
  margin-bottom: 36px;
}

.media-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: all 0.25 ease;
  position: relative;
}

.media-card:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-4px);
  border-color: var(--border-hover);
}

.media-art-wrap {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
  position: relative;
  background: #1A1D2A;
}

.media-art-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-play-btn {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent-red);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 8px 16px var(--accent-glow);
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.25s ease;
}

.media-card:hover .card-play-btn {
  opacity: 1;
  transform: translateY(0);
}

.media-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --------------------------------------------------------------------------
   RIGHT OVERLAY PANELS (Queue, Lyrics, Rooms)
   -------------------------------------------------------------------------- */
.right-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 360px;
  height: calc(100vh - var(--player-bar-height));
  background: rgba(12, 15, 23, 0.95);
  backdrop-filter: blur(25px);
  border-left: 1px solid var(--border-color);
  z-index: 50;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.right-panel.hidden {
  transform: translateX(100%);
  pointer-events: none;
}

.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-tabs {
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px;
  border-radius: 14px;
}

.panel-tab {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}

.panel-tab.active {
  background: var(--accent-red);
  color: #fff;
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.panel-view {
  display: none;
}

.panel-view.active {
  display: block;
}

/* Queue Item List */
.queue-current-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 0, 49, 0.1);
  border: 1px solid rgba(255, 0, 49, 0.3);
  padding: 12px;
  border-radius: 14px;
  margin-bottom: 20px;
}

.qp-art {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
}

.qp-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.qp-title {
  font-weight: 700;
  font-size: 14px;
}

.qp-artist {
  font-size: 12px;
  color: var(--text-muted);
}

.queue-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-muted);
}

.queue-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 10px;
  background: var(--bg-glass);
  cursor: pointer;
}

.queue-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.qi-art {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  object-fit: cover;
}

.qi-info {
  flex: 1;
  overflow: hidden;
}

.qi-title {
  font-weight: 600;
  font-size: 13px;
}

.qi-artist {
  font-size: 11px;
  color: var(--text-muted);
}

/* Synchronized Lyrics Timeline */
.lyrics-scroll-area {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 0;
}

.lyric-line {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-subtle);
  transition: all 0.3s ease;
  cursor: pointer;
  line-height: 1.4;
}

.lyric-line:hover {
  color: var(--text-muted);
}

.lyric-line.active {
  font-size: 24px;
  font-weight: 900;
  color: var(--text-main);
  text-shadow: 0 0 20px var(--accent-glow);
  transform: scale(1.02);
}

/* --------------------------------------------------------------------------
   PERSISTENT BOTTOM PLAYER BAR
   -------------------------------------------------------------------------- */
.player-bar {
  grid-column: 1 / -1;
  grid-row: 2;
  background: rgba(10, 12, 18, 0.98);
  backdrop-filter: blur(25px);
  border-top: 1px solid var(--border-color);
  display: grid;
  grid-template-columns: 280px 1fr 280px;
  align-items: center;
  padding: 0 24px;
  z-index: 100;
}

.player-left-group {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

.now-playing-art-wrap {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  background: #1A1D2A;
  flex-shrink: 0;
}

.player-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.now-playing-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.now-playing-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.now-playing-artist {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-center-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ctrl-icon-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ctrl-icon-btn:hover {
  color: var(--text-main);

}

.ctrl-icon-btn.active {
  color: var(--accent-red);
}

.main-play-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--text-main);
  color: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: transform 0.2s ease;
}

.main-play-btn:hover {
  transform: scale(1.08);
}

.player-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.time-stamp {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-subtle);
  width: 32px;
}

.seek-bar-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.seek-bar-wrapper input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.1);
  height: 4px;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.seek-bar-wrapper input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-main);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.seek-bar-wrapper:hover input[type="range"]::-webkit-slider-thumb {
  opacity: 1;
}

.player-right-group {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.utility-btn {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.utility-btn:hover, .utility-btn.active {
  color: var(--text-main);
  border-color: var(--accent-red);
}

.volume-control-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 110px;
}

.volume-control-wrap input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.1);
  height: 4px;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

/* Equalizer mini animation */
.equalizer-mini {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  padding-bottom: 6px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.equalizer-mini.playing {
  opacity: 1;
}

.equalizer-mini span {
  width: 3px;
  height: 14px;
  background: var(--accent-red);
  border-radius: 1px;
  animation: eq-bounce 1.2s infinite ease-in-out alternate;
}

.equalizer-mini span:nth-child(2) { animation-delay: 0.2s; }
.equalizer-mini span:nth-child(3) { animation-delay: 0.4s; }
.equalizer-mini span:nth-child(4) { animation-delay: 0.1s; }

@keyframes eq-bounce {
  0% { height: 4px; }
  100% { height: 18px; }
}

@keyframes pulse-glow {
  0% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 0.8; }
}

/* --------------------------------------------------------------------------
   FULLSCREEN OVERLAY STYLING
   -------------------------------------------------------------------------- */
.fullscreen-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 10, 15, 0.98);
  backdrop-filter: blur(40px);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  padding: 32px 48px;
}

.fullscreen-overlay.hidden {
  display: none;
}

.overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.overlay-brand {
  font-weight: 900;
  font-size: 20px;
  letter-spacing: 2px;
  color: var(--accent-red);
}

.overlay-content {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 64px;
  flex: 1;
  overflow: hidden;
}

.overlay-track-card img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 24px;
  object-fit: cover;
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
  margin-bottom: 24px;
}

/* --------------------------------------------------------------------------
   RESPONSIVE DESIGN BREAKPOINTS
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-menu-toggle {
    display: flex;
  }

  .main-content {
    grid-column: 1;
  }

  .player-bar {
    grid-template-columns: 1fr 120px;
    padding: 0 16px;
  }

  .player-right-group {
    display: none;
  }
}
