:root {
  --bg-color: #080a10;
  --panel-bg: rgba(15, 22, 36, 0.45);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(29, 185, 84, 0.4);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --primary-accent: #1db954;
  /* Spotify Green */
  --primary-hover: #1ed760;
  --secondary-accent: #00f2fe;
  /* Cyber Cyan */
  --vinyl-bg: #1e293b;
  --shadow-color: rgba(0, 0, 0, 0.5);
  --font-family-title: 'Outfit', sans-serif;
  --font-family-body: 'Inter', sans-serif;
  --transition-speed: 0.3s;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-family-body);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Background Glowing spheres */
.background-decor {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}

.glow-sphere {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.15;
}

.glow-1 {
  width: 45vw;
  height: 45vw;
  background: radial-gradient(circle, var(--primary-accent) 0%, transparent 80%);
  top: -10vw;
  right: -10vw;
  animation: floatGlow1 12s infinite alternate ease-in-out;
}

.glow-2 {
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, var(--secondary-accent) 0%, transparent 80%);
  bottom: -15vw;
  left: -15vw;
  animation: floatGlow2 15s infinite alternate ease-in-out;
}

@keyframes floatGlow1 {
  0% {
    transform: translate(0, 0) scale(1);
  }

  100% {
    transform: translate(-50px, 30px) scale(1.1);
  }
}

@keyframes floatGlow2 {
  0% {
    transform: translate(0, 0) scale(1);
  }

  100% {
    transform: translate(40px, -40px) scale(1.05);
  }
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Glassmorphism Styles */
.glass-container {
  background: var(--panel-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  box-shadow: 0 10px 30px 0 var(--shadow-color);
}

/* Layout App Container */
.app-container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Header styling */
.header-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  gap: 20px;
  flex-wrap: wrap;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-area h1 {
  font-family: var(--font-family-title);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff 0%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.disc-icon {
  font-size: 28px;
  color: var(--primary-accent);
  animation: spinSlow 4s infinite linear;
}

@keyframes spinSlow {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.drive-input-group {
  display: flex;
  align-items: center;
  flex-grow: 1;
  max-width: 750px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 4px;
  transition: border-color var(--transition-speed);
}

.drive-input-group:focus-within {
  border-color: var(--border-focus);
}

.drive-input-group input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  padding: 10px 16px;
  font-size: 14px;
  flex-grow: 1;
}

.drive-input-group input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.drive-input-group button {
  background: var(--primary-accent);
  color: #000;
  border: none;
  outline: none;
  border-radius: 9px;
  padding: 10px 20px;
  font-family: var(--font-family-title);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background var(--transition-speed), transform 0.1s;
}

.drive-input-group button:hover {
  background: var(--primary-hover);
}

.drive-input-group button:active {
  transform: scale(0.97);
}

/* Workspace Grid (Main Body) */
.workspace-grid {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 24px;
  align-items: start;
  flex-grow: 1;
}

/* --- Left: Player Card Panel --- */
.player-card {
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: sticky;
  top: 24px;
}

.player-visual {
  width: 230px;
  height: 230px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.vinyl-record {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle, #1e293b 0%, #0f172a 60%, #030712 100%);
  border: 4px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5), inset 0 0 25px rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: box-shadow 0.5s ease, transform var(--transition-speed);
}

/* Glowing shadow ring when playing */
.vinyl-record.playing {
  box-shadow: 0 0 30px rgba(29, 185, 84, 0.15), 0 15px 40px rgba(0, 0, 0, 0.6), inset 0 0 25px rgba(0, 0, 0, 0.9);
}

/* Vinyl concentric grooves */
.vinyl-record::after {
  content: '';
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  bottom: 12px;
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.04);
  box-shadow: 0 0 0 8px rgba(0, 0, 0, 0.2), inset 0 0 0 16px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

.vinyl-center {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-accent) 0%, var(--secondary-accent) 100%);
  border: 5px solid var(--bg-color);
  position: absolute;
  z-index: 2;
  box-shadow: 0 0 20px rgba(0, 242, 254, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.5s ease;
}

.music-note-icon {
  font-size: 24px;
  color: #000000;
  z-index: 3;
  transition: transform var(--transition-speed);
}

/* Animation on Vinyl rotation when audio plays */
.vinyl-record.playing {
  animation: spinSlow 12s infinite linear;
}

.vinyl-record.playing .music-note-icon {
  animation: pulseBeat 2s infinite alternate ease-in-out;
}

@keyframes pulseBeat {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }

  100% {
    transform: scale(1.15);
    opacity: 1;
    color: var(--secondary-accent);
  }
}

.track-details {
  text-align: center;
  margin-bottom: 24px;
  width: 100%;
}

.track-details h2 {
  font-family: var(--font-family-title);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 10px;
}

.track-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.meta-badge {
  background: rgba(29, 185, 84, 0.15);
  color: var(--primary-accent);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(29, 185, 84, 0.25);
  text-transform: uppercase;
}

.meta-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hidden {
  display: none !important;
}

/* Custom Timeline Progress slider */
.timeline-container {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.time-display {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-family-title);
  min-width: 32px;
}

.progress-bar-wrapper {
  flex-grow: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  position: relative;
  cursor: pointer;
  transition: height 0.1s;
}

.progress-bar-wrapper:hover {
  height: 6px;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary-accent) 0%, var(--secondary-accent) 100%);
  border-radius: 2px;
  position: absolute;
  top: 0;
  left: 0;
}

.progress-knob {
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%) scale(0);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: transform 0.1s;
  pointer-events: none;
}

.progress-bar-wrapper:hover .progress-knob {
  transform: translate(-50%, -50%) scale(1);
}

/* Playback Control Buttons */
.playback-controls {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
}

.playback-controls button {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  outline: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  transition: all var(--transition-speed), transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

.playback-controls button:hover:not(.play-btn) {
  color: var(--secondary-accent);
  border-color: rgba(0, 242, 254, 0.4);
  background: rgba(0, 242, 254, 0.05);
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.15);
  transform: scale(1.05);
}

.playback-controls button:active {
  transform: scale(0.95);
}

.playback-controls .play-btn {
  background: linear-gradient(135deg, var(--primary-accent) 0%, var(--secondary-accent) 100%);
  color: #000000;
  font-size: 20px;
  width: 60px;
  height: 60px;
  border: none;
  box-shadow: 0 8px 24px rgba(29, 185, 84, 0.3);
}

.playback-controls .play-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 10px 28px rgba(0, 242, 254, 0.45);
}

.playback-controls .play-btn:active {
  transform: scale(0.95);
}

/* Custom Skip 15s Button Styling */
.skip-btn {
  position: relative;
}

.skip-seconds {
  position: absolute;
  font-size: 8px;
  font-weight: 800;
  top: 54%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-main);
  pointer-events: none;
}

.playback-controls button:hover .skip-seconds {
  color: var(--secondary-accent);
}

/* Player Settings (Speed and Volume sliders) */
.player-settings {
  width: 100%;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
}

.settings-row .setting-item {
  flex: 1;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  height: 40px;
}

.setting-item {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
}

.setting-item i {
  font-size: 14px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.setting-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  flex-grow: 1;
  white-space: nowrap;
}

.custom-select {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  width: auto;
  text-align: right;
  padding-right: 4px;
}

.settings-row .setting-item i {
  color: var(--primary-accent);
}

.custom-select option {
  background: #0f172a;
  color: var(--text-main);
}

.volume-control input[type="range"] {
  flex-grow: 1;
  accent-color: var(--primary-accent);
  height: 4px;
  cursor: pointer;
}

/* Switch toggle styling */
.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.05);
  transition: .3s;
  border-radius: 22px;
  border: 1px solid var(--border-color);
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-muted);
  transition: .3s;
  border-radius: 50%;
}

.switch input:checked+.switch-slider {
  background-color: var(--primary-accent);
  border-color: var(--primary-accent);
}

.switch input:checked+.switch-slider:before {
  transform: translateX(16px);
  background-color: #000000;
}

/* --- Right: Playlist Card Panel --- */
.playlist-card {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 120px);
  max-height: 800px;
}

.playlist-header {
  padding: 24px 28px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.playlist-title-area {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.playlist-title-area h3 {
  font-family: var(--font-family-title);
  font-size: 18px;
  font-weight: 600;
}

.track-count-badge {
  font-size: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  padding: 2px 10px;
  border-radius: 12px;
  color: var(--text-muted);
}

.search-box {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0 14px;
  height: 42px;
}

.search-icon {
  font-size: 14px;
  color: var(--text-muted);
  margin-right: 12px;
}

.search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 14px;
  width: 100%;
}

.search-box input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

#history-filter-btn {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  margin-right: 12px;
  transition: color var(--transition-speed), transform 0.1s;
}

#history-filter-btn:hover {
  color: var(--text-main);
  transform: scale(1.15);
}

#history-filter-btn.active {
  color: var(--primary-accent);
}

#clear-search-btn {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
}

#clear-search-btn:hover {
  color: var(--text-main);
}

/* Playlist body */
.playlist-body {
  padding: 16px;
  overflow-y: auto;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

/* Fallback card content */
.playlist-fallback {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  margin: auto;
  max-width: 480px;
}

.fallback-icon {
  font-size: 64px;
  color: var(--border-color);
  margin-bottom: 20px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, transparent 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.playlist-fallback p {
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 24px;
}

.tip-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 18px;
  text-align: left;
}

.tip-box strong {
  display: block;
  font-size: 13px;
  color: var(--text-main);
  margin-bottom: 8px;
}

.tip-box ul {
  padding-left: 16px;
  font-size: 12px;
}

.tip-box li {
  margin-bottom: 6px;
  line-height: 1.5;
}

/* Loading Spinners */
.playlist-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 0;
  gap: 16px;
  color: var(--text-muted);
  font-size: 14px;
  margin: auto;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  border-top-color: var(--primary-accent);
  animation: spinnerRotate 1s infinite linear;
}

@keyframes spinnerRotate {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* Playlist Tracks List Grid items */
.tracks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 24px;
}

.track-item {
  display: flex;
  align-items: center;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: background var(--transition-speed), border var(--transition-speed), transform 0.15s;
  gap: 16px;
}

.track-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
  transform: translateX(4px);
}

.track-item-num {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  width: 24px;
  text-align: center;
}

.track-item-icon {
  font-size: 14px;
  color: var(--primary-accent);
  display: none;
  width: 24px;
  text-align: center;
}

.track-item-info {
  flex-grow: 1;
  min-width: 0;
  /* Ensures overflow text-overflow works */
}

.track-item-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.track-item-progress {
  font-size: 11px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  padding: 3px 8px;
  border-radius: 20px;
  font-family: var(--font-family-title);
  white-space: nowrap;
}

/* Active Highlight Playback state in Playlist */
.track-item.active {
  background: rgba(29, 185, 84, 0.08);
  border-color: var(--border-focus);
}

.track-item.active .track-item-title {
  color: var(--primary-accent);
  font-weight: 600;
}

.track-item.active .track-item-num {
  display: none;
}

.track-item.active .track-item-icon {
  display: block;
}

/* Active Equalizer animation when playing */
.equalizer-bar {
  display: inline-block;
  width: 3px;
  height: 12px;
  background-color: var(--primary-accent);
  margin: 0 1px;
  transform-origin: bottom;
  animation: bounceEq 1s ease-in-out infinite alternate;
}

.equalizer-bar:nth-child(2) {
  animation-delay: 0.2s;
  height: 16px;
}

.equalizer-bar:nth-child(3) {
  animation-delay: 0.4s;
  height: 10px;
}

@keyframes bounceEq {
  0% {
    transform: scaleY(0.2);
  }

  100% {
    transform: scaleY(1);
  }
}

/* Responsive queries */
@media (max-width: 950px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .player-card {
    position: relative;
    top: 0;
  }

  .playlist-card {
    min-height: auto;
  }
}

@media (max-width: 580px) {
  .header-section {
    padding: 16px;
    flex-direction: column;
    align-items: stretch;
  }

  .logo-area {
    justify-content: center;
  }

  .app-container {
    padding: 12px;
  }
}