@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;700&family=Amiri:ital,wght@0,400;0,700;1,400&display=swap');

/* ─── Reset & Root ──────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --gold:        #D5AD6D;
  --gold-dim:    #A38048; /* Darker variant of gold */
  --gold-glow:   rgba(213, 173, 109, 0.35);
  --bg-deep:     #050C14;
  --bg-mid:      #0B1C2E;
  --glass-bg:    rgba(11, 28, 46, 0.65);
  --glass-border:rgba(0, 240, 255, 0.15);
  --text-primary: #F0F4F8;
  --text-secondary: #9BA4B5;
  --accent-rose: hsl(340, 70%, 60%);
  --accent-teal: #00aacb;
  --orb1: #0B1C2E;
  --orb2: #00aacb;
  --orb3: #D5AD6D;
  --lyric-active-color: var(--gold);
  --progress-fill: linear-gradient(90deg, var(--gold-dim), var(--gold));

  --radius-lg: 24px;
  --radius-md: 14px;
  --radius-sm: 8px;
  --transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Vazirmatn', 'Amiri', sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  overflow: hidden;
}

/* ─── Background Orbs ───────────────────────────────────── */
.bg-orbs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  will-change: transform;
}

.orb-1 {
  width: 500px; height: 500px;
  background: var(--orb1);
  top: -150px; left: -100px;
  animation: drift1 18s ease-in-out infinite alternate;
}

.orb-2 {
  width: 400px; height: 400px;
  background: var(--orb2);
  bottom: -100px; right: -80px;
  animation: drift2 22s ease-in-out infinite alternate;
}

.orb-3 {
  width: 300px; height: 300px;
  background: var(--orb3);
  top: 40%; left: 50%;
  transform: translate(-50%, -50%);
  animation: drift3 15s ease-in-out infinite alternate;
}

@keyframes drift1 { to { transform: translate(80px, 120px); } }
@keyframes drift2 { to { transform: translate(-70px, -90px); } }
@keyframes drift3 { to { transform: translate(-50%, -60%) scale(1.3); } }

/* ─── Main Player Card ──────────────────────────────────── */
.player-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(760px, 96vw);
  height: min(900px, 94dvh);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(28px) saturate(1.5);
  -webkit-backdrop-filter: blur(28px) saturate(1.5);
  box-shadow:
    0 0 0 1px hsla(255, 30%, 60%, 0.08),
    0 32px 80px hsla(240, 40%, 5%, 0.7),
    inset 0 1px 0 hsla(255, 50%, 80%, 0.07);
  overflow: hidden;
}

/* ─── Album Art Area ────────────────────────────────────── */
.album-section {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: max(20px, env(safe-area-inset-top)) 
           max(24px, env(safe-area-inset-right)) 
           16px 
           max(24px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--glass-border);
  background: hsla(240, 20%, 10%, 0.4);
}

.album-art {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 20px var(--gold-glow);
  position: relative;
  overflow: hidden;
  background-color: var(--bg-deep);
}

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

.album-art::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, hsla(255,60%,70%,0.15), transparent);
  border-radius: inherit;
}

.album-art.playing {
  animation: artPulse 2.5s ease-in-out infinite;
  box-shadow: 0 0 0 3px var(--gold-glow), 0 4px 30px var(--gold-glow);
}

@keyframes artPulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--gold-glow), 0 4px 30px var(--gold-glow); }
  50%       { box-shadow: 0 0 0 8px hsla(43,80%,65%,0.12), 0 4px 40px var(--gold-glow); }
}

.track-info {
  flex: 1;
  min-width: 0;
  direction: rtl;
}

.track-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
  line-height: 1.4;
}

.track-artist {
  font-size: 0.8rem;
  color: var(--gold);
  font-weight: 400;
}

.track-album {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ─── Lyrics Panel ────────────────────────────────────────  */
.lyrics-panel {
  flex: 1;
  overflow-y: auto;
  padding: 20px 28px;
  direction: rtl;
  scroll-behavior: smooth;
  position: relative;

  /* Fade-off top and bottom */
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    black 12%,
    black 85%,
    transparent 100%
  );
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    black 12%,
    black 85%,
    transparent 100%
  );
}

.lyrics-panel::-webkit-scrollbar { width: 4px; }
.lyrics-panel::-webkit-scrollbar-track { background: transparent; }
.lyrics-panel::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 4px;
}

.lyric-line {
  padding: 10px 8px;
  margin: 2px 0;
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    color var(--transition),
    transform var(--transition),
    opacity var(--transition);
  text-align: right;
  opacity: 0.6;
  transform: scale(0.98);
}

.lyric-line:hover {
  color: var(--text-primary);
  opacity: 0.9;
}

.lyric-line.active {
  color: var(--lyric-active-color);
  font-size: 1.25rem;
  font-weight: 700;
  opacity: 1;
  transform: scale(1);
  text-shadow: 0 0 20px var(--gold-glow);
}

.lyric-line.arabic {
  font-family: 'Vazirmatn', 'Amiri', serif;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

.lyric-line.arabic.active {
  font-size: 1.25rem;
}

/* English lines — LTR */
.lyric-line.english {
  direction: ltr;
  text-align: left;
  font-size: 1.05rem;
  font-style: italic;
  color: hsl(200, 30%, 60%);
}

.lyric-line.english.active {
  color: hsl(200, 60%, 75%);
  font-size: 1rem;
  text-shadow: 0 0 15px hsl(200, 60%, 40%, 0.5);
}

.lyric-line .translation {
  display: block;
  font-family: 'Vazirmatn', 'Amiri', sans-serif;
  font-size: 0.75em;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 400;
  opacity: 0.8;
  line-height: 1.6;
}

.lyric-line.active .translation {
  color: var(--gold-dim);
  font-size: 0.75em;
  opacity: 1;
}

.lyric-line.interlude {
  text-align: center;
  font-size: 1.4rem;
  opacity: 0.3;
  transform: scale(0.95);
  letter-spacing: 0.3em;
}

/* ─── Controls Area ─────────────────────────────────────── */
.controls-area {
  flex-shrink: 0;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--glass-border);
  background: hsla(240, 20%, 8%, 0.5);
  direction: ltr;
}

/* Progress Bar */
.progress-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.time-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  min-width: 38px;
  user-select: none;
}

.time-label.end { text-align: right; }

.progress-track {
  flex: 1;
  height: 4px;
  background: hsla(255, 30%, 60%, 0.15);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: height 0.2s;
}

.progress-track:hover { height: 6px; }

.progress-fill {
  height: 100%;
  background: var(--progress-fill);
  border-radius: 4px;
  position: relative;
  pointer-events: none;
  transition: width 0.15s linear;
}

.progress-fill::after {
  content: '';
  position: absolute;
  right: -5px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  background: var(--gold);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s;
  box-shadow: 0 0 8px var(--gold-glow);
}

.progress-track:hover .progress-fill::after { opacity: 1; }

/* Buttons Row */
.buttons-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
}

.center-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.ctrl-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  transition: color var(--transition), background var(--transition), transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.ctrl-btn:hover {
  color: var(--text-primary);
  background: hsla(255, 30%, 60%, 0.1);
}

.ctrl-btn:active { transform: scale(0.88); }

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

/* Labeled control button (icon + text) */
.ctrl-btn.ctrl-btn-labeled {
  width: auto;
  border-radius: 20px;
  padding: 6px 14px;
  gap: 6px;
}

.ctrl-label {
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
  font-family: 'Vazirmatn', sans-serif;
}

/* Play/Pause */
.play-btn {
  width: 58px;
  height: 58px;
  background: linear-gradient(135deg, var(--gold-dim), var(--gold));
  color: var(--bg-deep) !important;
  box-shadow: 0 4px 20px var(--gold-glow);
  transition: box-shadow var(--transition), transform 0.15s;
}

.play-btn:hover {
  background: linear-gradient(135deg, var(--gold), hsl(43, 90%, 72%)) !important;
  box-shadow: 0 6px 28px var(--gold-glow) !important;
}

/* Volume slider row */
.volume-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.vol-icon {
  font-size: 1rem;
  color: var(--text-secondary);
  user-select: none;
}

.volume-container {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  max-width: 120px;
  margin-left: 8px;
}

input[type="range"].volume-slider {
  flex: 1;
  appearance: none;
  -webkit-appearance: none;
  height: 3px;
  background: hsla(255, 30%, 60%, 0.2);
  border-radius: 3px;
  cursor: pointer;
  accent-color: var(--gold);
}

input[type="range"].volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 6px var(--gold-glow);
  cursor: pointer;
}

/* ─── Loading Overlay ────────────────────────────────────── */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: hsla(240, 25%, 7%, 0.8);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 10;
  border-radius: var(--radius-lg);
  transition: opacity 0.4s, visibility 0.4s;
}

.loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.spinner {
  width: 44px; height: 44px;
  border: 3px solid hsla(43, 80%, 65%, 0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ─── File Input Hint (no file) ─────────────────────────── */
.no-audio-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex: 1;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.no-audio-hint svg {
  opacity: 0.3;
}

/* ─── Drop Zone ─────────────────────────────────────────── */
.drop-zone {
  position: fixed;
  inset: 0;
  background: hsla(43, 80%, 65%, 0.08);
  border: 2px dashed var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  font-size: 1.3rem;
  color: var(--gold);
  border-radius: var(--radius-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.drop-zone.visible {
  opacity: 1;
  pointer-events: all;
}

/* ─── Scrollbar ─────────────────────────────────────────── */
html { scrollbar-width: thin; scrollbar-color: var(--glass-border) transparent; }

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 500px) {
  html, body {
    background-color: #0A1722;
  }
  
  .player-shell { width: 100vw; height: 100dvh; border-radius: 0; }
  .lyric-line { font-size: 0.95rem; }
  .lyric-line.active { font-size: 1.15rem; }
  .album-section { 
    padding: calc(14px + env(safe-area-inset-top)) 16px 12px 16px;
    background: #0A1722;
  }
  .lyrics-panel { padding: 16px 18px; }
  .controls-area { 
    padding: 12px 16px calc(16px + env(safe-area-inset-bottom)) 16px; 
    background: #0A1722;
  }
  
  .volume-container { display: none; }
}

/* ─── Autoplay Bar ───────────────────────────────────────── */
.autoplay-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  background: rgba(0, 240, 255, 0.04);
  border-bottom: 1px solid rgba(0, 240, 255, 0.1);
  direction: rtl;
}

.autoplay-bar-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-primary);
  font-weight: 600;
}

.autoplay-bar-icon {
  font-size: 1rem;
}

.autoplay-bar-status {
  flex: 1;
  text-align: left;
  font-size: 0.72rem;
  color: var(--accent-teal);
  opacity: 0.9;
  direction: ltr;
}

/* Small Toggle Switch (for player page) */
.toggle-switch-sm {
  position: relative;
  width: 38px;
  height: 20px;
  flex-shrink: 0;
}

.toggle-switch-sm input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider-sm {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  transition: background 0.3s;
}

.toggle-slider-sm::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s;
}

.toggle-switch-sm input:checked + .toggle-slider-sm {
  background: var(--accent-teal);
}

.toggle-switch-sm input:checked + .toggle-slider-sm::before {
  transform: translateX(18px);
}

/* ══════════════════════════════════════════════════════════
   Playlist Panel (bottom sheet)
   ══════════════════════════════════════════════════════════ */

.playlist-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80vh;
  max-height: 700px;
  background: rgba(5, 12, 20, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px 20px 0 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.playlist-panel.open {
  transform: translateY(0);
}

/* Scrim */
.panel-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 190;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.panel-scrim.open {
  opacity: 1;
  pointer-events: auto;
}

/* Handle bar */
.playlist-panel-handle {
  width: 40px; height: 4px;
  background: rgba(255,255,255,0.18);
  border-radius: 4px;
  margin: 12px auto 0;
  flex-shrink: 0;
}

/* Panel header */
.playlist-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 10px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  direction: rtl;
}

.playlist-panel-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.playlist-panel-close {
  background: rgba(255,255,255,0.08);
  border: none;
  color: var(--text-secondary);
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.playlist-panel-close:hover {
  background: rgba(255,255,255,0.14);
  color: var(--text-primary);
}

/* Track list */
.playlist-panel-list {
  list-style: none;
  margin: 0; padding: 8px 0;
  overflow-y: auto;
  flex: 1;
  direction: rtl;
}

.panel-empty {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
  padding: 30px 20px;
  opacity: 0.5;
}

.panel-track-row {
  padding: 10px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: background 0.15s;
}
.panel-track-row:hover {
  background: rgba(255,255,255,0.03);
}

.panel-track-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-play-track-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(213,173,109,0.15);
  color: var(--accent-gold, #D5AD6D);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}
.panel-play-track-btn:hover { background: rgba(213,173,109,0.28); }
.panel-play-track-btn:active { transform: scale(0.9); }

.panel-track-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.panel-track-title {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel-track-artist {
  font-size: 0.73rem;
  color: var(--text-secondary);
}

.panel-delete-btn {
  background: none;
  border: none;
  color: rgba(255,80,80,0.5);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.2s, background 0.2s;
  flex-shrink: 0;
}
.panel-delete-btn:hover {
  color: rgba(255,80,80,0.9);
  background: rgba(255,80,80,0.1);
}

.panel-track-settings {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  direction: rtl;
}

.panel-dep-selects {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Add-track form */
.playlist-panel-add-form {
  flex-shrink: 0;
  padding: 14px 20px 24px;
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex;
  flex-direction: column;
  gap: 8px;
  direction: rtl;
}

.playlist-panel-add-title {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.playlist-panel-add-fields {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.playlist-panel-add-fields input {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-family: 'Vazirmatn', sans-serif;
  font-size: 0.8rem;
  direction: rtl;
  transition: border-color 0.2s;
}
.playlist-panel-add-fields input:focus {
  outline: none;
  border-color: var(--accent-teal);
}
.playlist-panel-add-fields input::placeholder {
  color: var(--text-secondary);
  opacity: 0.5;
}

.add-track-submit {
  background: rgba(0,170,203,0.15);
  border: 1px solid rgba(0,170,203,0.3);
  color: var(--accent-teal);
  border-radius: 10px;
  padding: 9px 16px;
  font-family: 'Vazirmatn', sans-serif;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.add-track-submit:hover {
  background: rgba(0,170,203,0.25);
  border-color: rgba(0,170,203,0.5);
}

/* Playlist btn highlight when panel open */
#playlist-btn.active {
  color: var(--accent-teal);
}

/* ══════════════════════════════════════════════════════════
   cp-drop-down-menu — cplayer DNA × webapp dark glass skin
   ══════════════════════════════════════════════════════════ */

/* Container — slides down from 0 height (cplayer pattern) */
.cp-dropdown {
  flex-shrink: 0;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  direction: rtl;
  background: linear-gradient(
    180deg,
    hsla(218, 35%, 6%, 0.97) 0%,
    hsla(218, 30%, 5%, 0.99) 100%
  );
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  border-bottom: 1px solid rgba(0, 240, 255, 0.08);
  transition:
    max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.25s ease;
}

.cp-dropdown.open {
  max-height: 480px;
  opacity: 1;
  pointer-events: auto;
}

/* ── Header: "info" row — title · artist (cplayer cp-audio-info style) */
.cp-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 16px 7px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  gap: 10px;
}

.cp-dropdown-info {
  display: flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

/* Title (bold, primary — like cplayer span.cp-audio-title) */
.cp-dd-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
  letter-spacing: 0.01em;
}

/* Separator dot */
.cp-dd-sep {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.18);
  flex-shrink: 0;
}

/* Artist (dimmed 0.46 opacity — like cplayer's cp-playlist-artist) */
.cp-dd-artist {
  font-size: 0.72rem;
  color: var(--gold);
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

/* Track count badge */
.cp-dd-count {
  flex-shrink: 0;
  font-size: 0.65rem;
  color: var(--accent-teal);
  opacity: 0.6;
  background: rgba(0,170,203,0.1);
  border-radius: 10px;
  padding: 1px 7px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* ── Playlist <ul> */
.cp-dropdown-list {
  list-style: none;
  margin: 0;
  padding: 2px 0 4px;
  overflow-y: auto;
  max-height: 250px;
  scroll-behavior: smooth;
}

.cp-dropdown-list::-webkit-scrollbar { width: 2px; }
.cp-dropdown-list::-webkit-scrollbar-track { background: transparent; }
.cp-dropdown-list::-webkit-scrollbar-thumb {
  background: rgba(213,173,109,0.25);
  border-radius: 2px;
}

/* ── Track row — mirrors cplayer's li.cp-playlist li */
.cp-playlist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 14px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.025);
  position: relative;
  transition:
    background 0.18s ease,
    border-left-color 0.18s ease;
  /* Left accent line (hidden by default, shown when active) */
  border-left: 2px solid transparent;
  direction: rtl;
}

.cp-playlist-item:first-child { border-top: none; }
.cp-playlist-item:last-child { border-bottom: none; }

.cp-playlist-item:hover {
  background: rgba(255,255,255,0.032);
}

/* Active row: gold glow + teal left bar (cplayer highlight adapted) */
.cp-playlist-item.active {
  background: linear-gradient(
    90deg,
    rgba(213,173,109,0.07) 0%,
    transparent 100%
  );
  border-left-color: var(--accent-teal);
}

/* ── Play triangle (like cplayer's .cp-play-icon in li) */
.cp-pl-play-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: var(--accent-teal);
  opacity: 0;
  transition: opacity 0.18s;
}

.cp-playlist-item.active .cp-pl-play-icon {
  opacity: 1;
  filter: drop-shadow(0 0 4px rgba(0,170,203,0.6));
}

/* Index number (shown in non-active rows where icon is hidden) */
.cp-pl-index {
  flex-shrink: 0;
  width: 16px;
  font-size: 0.65rem;
  color: var(--text-secondary);
  opacity: 0.35;
  text-align: center;
  font-variant-numeric: tabular-nums;
  direction: ltr;
}

.cp-playlist-item.active .cp-pl-index {
  opacity: 0; /* hide number when icon is showing */
}

/* Title + artist stacked (cplayer-style two-liners) */
.cp-pl-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.cp-pl-name {
  font-size: 0.8rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
  transition: color 0.18s;
}

.cp-pl-artist {
  font-size: 0.67rem;
  /* cp-playlist-artist: opacity 0.46 */
  color: var(--text-secondary);
  opacity: 0.52;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cp-playlist-item.active .cp-pl-name {
  color: var(--gold);
  font-weight: 600;
}

.cp-playlist-item.active .cp-pl-artist {
  color: var(--gold-dim);
  opacity: 0.75;
}

/* Duration — right-aligned tabular nums */
.cp-pl-duration {
  flex-shrink: 0;
  font-size: 0.67rem;
  color: var(--text-secondary);
  opacity: 0.45;
  font-variant-numeric: tabular-nums;
  direction: ltr;
  min-width: 30px;
  text-align: left;
}

/* Delete button — appears on hover like a ghost */
.cp-pl-delete {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-secondary);
  opacity: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
  padding: 0;
}

.cp-playlist-item:hover .cp-pl-delete { opacity: 0.4; }
.cp-pl-delete:hover {
  opacity: 1 !important;
  background: rgba(255,70,70,0.15);
  color: #ff6060;
}

/* ── Add-track form — compact, below list */
.cp-dropdown-add {
  padding: 9px 16px 11px;
  border-top: 1px solid rgba(255,255,255,0.04);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.cp-add-hint {
  font-size: 0.65rem;
  color: var(--text-secondary);
  opacity: 0.55;
  margin: 0;
  line-height: 1.4;
  direction: rtl;
}

.cp-dropdown-add-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* URL field full-width, title+artist split 50/50 */
.cp-dropdown-add input[type="url"] {
  flex: 1 0 100%;
}

.cp-dropdown-add input[type="text"] {
  flex: 1 1 calc(50% - 4px);
}

.cp-dropdown-add input {
  background: rgba(255,255,255,0.045);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 0.73rem;
  color: var(--text-primary);
  font-family: 'Vazirmatn', sans-serif;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.cp-dropdown-add input:focus {
  border-color: rgba(0,170,203,0.4);
  background: rgba(0,170,203,0.05);
}

.cp-dropdown-add input::placeholder {
  color: var(--text-secondary);
  opacity: 0.4;
  font-size: 0.7rem;
}

.cp-dropdown-add-footer {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.cp-dropdown-add-btn {
  background: none;
  border: 1px solid rgba(213,173,109,0.2);
  color: var(--gold);
  opacity: 0.75;
  border-radius: 8px;
  padding: 5px 14px;
  font-size: 0.72rem;
  font-family: 'Vazirmatn', sans-serif;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s, transform 0.1s;
  letter-spacing: 0.02em;
}

.cp-dropdown-add-btn:hover {
  background: rgba(213,173,109,0.1);
  opacity: 1;
}

.cp-dropdown-add-btn:active { transform: scale(0.95); }

/* ── Playlist btn highlight when open (player page) */
#playlist-btn.active,
#main-playlist-btn.active {
  color: var(--accent-teal);
  background: rgba(0,170,203,0.12);
}

/* ══════════════════════════════════════════════════════════
   CSS View Transitions (MPA — Chromium 111+)
   @supports guard ensures zero impact on Firefox / Safari
   ══════════════════════════════════════════════════════════ */
@supports (view-transition-name: none) {

  /* ── Root cross-fade ─── */
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 0.38s;
    animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* ── Album section stays consistent leaving/entering ─── */
  header.album-section {
    view-transition-name: player-header;
  }

  ::view-transition-old(player-header),
  ::view-transition-new(player-header) {
    animation-duration: 0.38s;
    animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* ── Player shell slides in from the right (forward nav feel) ─── */
  main.player-shell {
    view-transition-name: player-shell;
  }

  @keyframes vt-slide-right-in {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
  }
  @keyframes vt-slide-right-out {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(40px); }
  }
  @keyframes vt-slide-left-in {
    from { opacity: 0; transform: translateX(-40px); }
    to   { opacity: 1; transform: translateX(0); }
  }
  @keyframes vt-slide-left-out {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(-40px); }
  }

  /* Entering player.html: slide in from right */
  ::view-transition-new(player-shell) {
    animation: vt-slide-right-in 0.38s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  }
  /* Leaving player.html: slide out to right */
  ::view-transition-old(player-shell) {
    animation: vt-slide-right-out 0.38s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  }

  /* ── Controls area fades in with a subtle lift ─── */
  footer.controls-area {
    view-transition-name: player-controls;
  }

  @keyframes vt-fade-up-in {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  @keyframes vt-fade-down-out {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(16px); }
  }

  ::view-transition-new(player-controls) {
    animation: vt-fade-up-in 0.4s cubic-bezier(0.4, 0, 0.2, 1) 0.05s forwards;
    opacity: 0;
  }
  ::view-transition-old(player-controls) {
    animation: vt-fade-down-out 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  }
}




