/* ==========================================================================
   Radiant Audio Studio - Design System & Modern Aesthetics
   ========================================================================== */

:root {
  --bg-dark: #07090e;
  --bg-card: rgba(16, 20, 31, 0.75);
  --bg-card-hover: rgba(24, 30, 48, 0.85);
  --bg-glass: rgba(255, 255, 255, 0.04);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-active: rgba(0, 242, 254, 0.4);

  --accent-cyan: #00f2fe;
  --accent-blue: #4facfe;
  --accent-purple: #7928ca;
  --accent-pink: #ff0080;
  --accent-glow: 0 0 25px rgba(0, 242, 254, 0.45);
  --accent-purple-glow: 0 0 30px rgba(121, 40, 202, 0.4);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;

  --transition-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  padding: 24px;
  position: relative;
  user-select: none;
}

/* Ambient Animated Glow in Background */
.ambient-glow {
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(120px);
  opacity: 0.22;
  z-index: 0;
  transition: all 1.2s ease;
}

.ambient-cyan {
  top: -100px;
  left: -100px;
  background: radial-gradient(circle, var(--accent-cyan), var(--accent-blue));
}

.ambient-purple {
  bottom: -100px;
  right: -100px;
  background: radial-gradient(circle, var(--accent-purple), var(--accent-pink));
}

/* Main Studio Container */
.player-container {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 980px;
  background: var(--bg-card);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65), 0 0 1px rgba(255, 255, 255, 0.1);
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  overflow: hidden;
  animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header & Brand Badge */
.header-bar {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border-glass);
  background: rgba(255, 255, 255, 0.02);
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.35);
}

.brand-logo-icon svg {
  width: 20px;
  height: 20px;
  fill: #fff;
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #ffffff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-version {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.12);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(0, 242, 254, 0.25);
  margin-left: 8px;
  letter-spacing: 0.02em;
}

.header-actions {
  display: flex;
  gap: 10px;
}

.btn-icon-subtle {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-icon-subtle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.btn-icon-subtle.active {
  background: rgba(0, 242, 254, 0.15);
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

/* Left Section: Active Player View */
.player-main-view {
  padding: 32px 36px 36px 36px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Vinyl Artwork Showcase */
.showcase-area {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 24px;
}

.vinyl-wrapper {
  position: relative;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7), 0 0 0 6px rgba(255, 255, 255, 0.03);
  margin-bottom: 20px;
}

.vinyl-disc {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-radial-gradient(
    circle at center,
    #11131a 0,
    #11131a 4px,
    #181a24 5px,
    #181a24 8px
  );
  border: 4px solid #202433;
  animation: spinVinyl 16s linear infinite;
  animation-play-state: paused;
  transition: transform 0.5s ease;
}

.player-playing .vinyl-disc {
  animation-play-state: running;
}

@keyframes spinVinyl {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.vinyl-cover {
  position: relative;
  z-index: 2;
  width: 95px;
  height: 95px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
  background: #1a1e2d;
}

.vinyl-center-pin {
  position: absolute;
  z-index: 3;
  width: 16px;
  height: 16px;
  background: var(--bg-dark);
  border: 2px solid var(--accent-cyan);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-cyan);
}

/* Visualizer Canvas */
.visualizer-container {
  width: 100%;
  height: 65px;
  position: relative;
  margin: 6px 0 18px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

#visualizerCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Track Metadata Display */
.track-info {
  text-align: center;
  margin-bottom: 20px;
}

.track-title {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 440px;
}

.track-artist {
  font-size: 0.92rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.track-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-blue);
  background: rgba(79, 172, 254, 0.12);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(79, 172, 254, 0.25);
}

/* Progress / Seekbar Area */
.progress-area {
  margin-bottom: 22px;
}

.time-bar-container {
  position: relative;
  width: 100%;
  height: 7px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  cursor: pointer;
  touch-action: none;
  transition: height 0.15s ease;
}

.time-bar-container:hover {
  height: 10px;
}

.buffer-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
}

.progress-bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue), var(--accent-purple));
  border-radius: var(--radius-full);
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.6);
}

.progress-thumb {
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%) scale(0);
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 8px rgba(0, 242, 254, 0.8);
  transition: transform 0.15s ease;
}

.time-bar-container:hover .progress-thumb {
  transform: translateY(-50%) scale(1);
}

.time-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* Controls Matrix */
.controls-matrix {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
}

.btn-ctrl {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition-fast);
}

.btn-ctrl:hover {
  color: var(--text-main);
  transform: scale(1.08);
}

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

.btn-step {
  width: 44px;
  height: 44px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
}

.btn-step:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-play-pause {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  color: #ffffff;
  box-shadow: 0 8px 25px rgba(0, 242, 254, 0.45);
  transition: var(--transition-fast);
}

.btn-play-pause:hover {
  transform: scale(1.06);
  box-shadow: 0 10px 32px rgba(0, 242, 254, 0.65);
}

.btn-play-pause:active {
  transform: scale(0.96);
}

.btn-sub-ctrl {
  width: 36px;
  height: 36px;
}

/* Bottom Aux Controls (Volume & Speed) */
.aux-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--border-glass);
}

.volume-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 170px;
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 6px var(--accent-cyan);
  cursor: pointer;
}

.speed-selector {
  display: flex;
  align-items: center;
  gap: 5px;
}

.speed-chip {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-dim);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 4px 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.speed-chip:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

.speed-chip.active {
  background: rgba(0, 242, 254, 0.15);
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

/* Right Section: Playlist & Track Management */
.playlist-section {
  border-left: 1px solid var(--border-glass);
  background: rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  height: 100%;
}

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

.playlist-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.playlist-count {
  font-size: 0.75rem;
  color: var(--text-dim);
  background: var(--bg-glass);
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.playlist-actions {
  display: flex;
  gap: 8px;
}

/* Dropzone Action Card */
.dropzone-action {
  margin: 14px 18px;
  border: 2px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
  background: rgba(255, 255, 255, 0.015);
  cursor: pointer;
  transition: var(--transition-fast);
}

.dropzone-action:hover, .dropzone-action.dragover {
  border-color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.05);
}

.dropzone-text {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.dropzone-text svg {
  width: 18px;
  height: 18px;
  color: var(--accent-cyan);
}

/* Playlist Items Scrollable */
.playlist-items {
  flex: 1;
  overflow-y: auto;
  padding: 6px 14px 18px 14px;
  max-height: 420px;
}

.playlist-items::-webkit-scrollbar {
  width: 5px;
}

.playlist-items::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
}

.track-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
  margin-bottom: 5px;
  border: 1px solid transparent;
}

.track-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glass);
}

.track-item.active {
  background: rgba(0, 242, 254, 0.08);
  border-color: var(--border-glass-active);
}

.track-item-index {
  font-size: 0.78rem;
  color: var(--text-dim);
  width: 18px;
  text-align: center;
  font-weight: 600;
}

.track-item.active .track-item-index {
  color: var(--accent-cyan);
}

.track-thumb {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  background: #1e2230;
}

.track-details {
  flex: 1;
  min-width: 0;
}

.track-item-title {
  font-size: 0.86rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main);
}

.track-item.active .track-item-title {
  color: var(--accent-cyan);
}

.track-item-artist {
  font-size: 0.74rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-duration {
  font-size: 0.74rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.track-item-remove {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  opacity: 0;
  transition: var(--transition-fast);
}

.track-item:hover .track-item-remove {
  opacity: 1;
}

.track-item-remove:hover {
  color: var(--accent-pink);
  background: rgba(255, 0, 128, 0.1);
}

/* Modal for Custom Stream URL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #111522;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 26px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  transform: translateY(20px);
  transition: transform 0.25s ease;
}

.modal-overlay.open .modal-card {
  transform: translateY(0);
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.modal-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.input-field {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
  margin-bottom: 12px;
  transition: border-color var(--transition-fast);
}

.input-field:focus {
  border-color: var(--accent-cyan);
}

.modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: #07090e;
  font-weight: 700;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.4);
}

.btn-secondary {
  background: var(--bg-glass);
  color: var(--text-muted);
  border: 1px solid var(--border-glass);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.btn-secondary:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

/* Invisible mount for RadiantMP audio engine */
#rmp-player-mount {
  width: 1px !important;
  height: 1px !important;
  opacity: 0.01 !important;
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  pointer-events: none !important;
  z-index: -10 !important;
}

/* Responsive Media Queries */
@media (max-width: 860px) {
  .player-container {
    grid-template-columns: 1fr;
    max-width: 500px;
  }
  .playlist-section {
    border-left: none;
    border-top: 1px solid var(--border-glass);
  }
}
