/* ─── Pages & Components CSS ─── */

/* ─ Hero ─ */
.hero {
  position: relative;
  width: 100%;
  height: 300px;
  overflow: hidden;
  flex-shrink: 0;
}

.hero-placeholder {
  width: 100%;
  height: 300px;
  background: linear-gradient(135deg, var(--ctp-surface0), var(--ctp-mantle));
  flex-shrink: 0;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: transform 8s ease, opacity 0.8s ease, filter 0.8s ease;
  transform: scale(1.05);
}
.hero:hover .hero-bg { transform: scale(1); }

.hero-dots {
  position: absolute;
  bottom: var(--space-4);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 10;
}
.hero-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.35);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.3s ease;
}
.hero-dot:hover:not(.hero-dot-active) { background: rgba(255, 255, 255, 0.6); }
.hero-dot-active { width: 24px; background: rgba(255, 255, 255, 0.9); }

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to right,
    rgba(0, 0, 0, 0.78) 0%,
    rgba(0, 0, 0, 0.45) 50%,
    rgba(0, 0, 0, 0.18) 100%
  ),
  linear-gradient(
    to top,
    rgba(0, 0, 0, 0.88) 0%,
    transparent 60%
  );
}

.hero-content {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  gap: 2rem;
  padding: var(--space-8);
}

.hero-cover {
  width: 180px;
  height: 180px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.1);
}

.hero-text {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.hero-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ctp-lavender);
  margin-bottom: var(--space-2);
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 700;
  color: #ffffff;
  margin-bottom: var(--space-1);
  line-height: 1.2;
  text-shadow: 0 2px 12px rgba(0,0,0,0.6);
  max-width: 500px;
}

.hero-artist {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.72);
  margin-bottom: var(--space-3);
}

.hero-meta {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.hero-play-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  background: var(--accent);
  color: var(--ctp-crust);
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition-fast);
  width: fit-content;
}
.hero-play-btn:hover { background: var(--ctp-lavender); transform: scale(1.02); box-shadow: var(--shadow-glow); }

/* ─ Section titles ─ */
.section-title, .page-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

/* ─ Album Card ─ */
.album-card {
  cursor: pointer;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
}
.album-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border); }

.album-card-cover {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--bg-hover);
}
.album-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}
.album-card:hover .album-card-cover img { transform: scale(1.04); }

.album-card-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

/* ─ Artist Card (Grid View) ─ */
.artist-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all var(--transition-base);
  text-align: center;
  gap: var(--space-3);
  height: 100%; /* fill grid row */
}
.artist-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border);
}
.artist-card-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
}
.artist-card-avatar-initial {
  background: var(--bg-card);
  border: 2px solid;
  box-shadow: none;
  overflow: hidden;
}
.artist-card-avatar-initial span {
  font-size: 2.5rem;
  font-weight: 800;
  font-family: var(--font-display);
  line-height: 1;
  user-select: none;
}
.artist-card-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.artist-card-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ─ Album Row Container ─ */
.album-row-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  position: relative;
}

.album-row-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

.album-row-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.album-row-nav .nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  cursor: pointer;
}
.album-row-nav .nav-btn:hover:not(.disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border);
}
.album-row-nav .nav-btn.disabled {
  opacity: 0.3;
  cursor: default;
}

.album-grid-wrapper {
  position: relative;
}

.album-grid {
  display: flex;
  gap: var(--space-4);
  overflow-x: auto;
  padding-bottom: var(--space-4);
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  /* Hide scrollbar for Webkit */
  -webkit-overflow-scrolling: touch;
}
.album-grid::-webkit-scrollbar { display: none; }
.album-grid { -ms-overflow-style: none; scrollbar-width: none; }

.album-grid-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-4);
}

.random-albums-progress {
  height: 2px;
  background: var(--border-subtle);
  border-radius: var(--radius-full);
  margin-bottom: 1.5rem;
  overflow: hidden;
}
.random-albums-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-full);
  transition: width 0.1s linear;
}
@media (min-width: 1024px) {
  .album-grid-wrap { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

.album-grid .album-card {
  flex: 0 0 clamp(140px, 15vw, 180px);
  scroll-snap-align: start;
}

.album-card-more {
  flex: 0 0 clamp(140px, 15vw, 180px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  background: var(--bg-hover);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  scroll-snap-align: start;
  transition: all var(--transition-base);
}
.album-card-more:hover {
  background: var(--ctp-surface0);
  color: var(--text-primary);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.album-card-play-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-base);
}
.album-card:hover .album-card-play-overlay { opacity: 1; }

.album-card-details-btn {
  background: var(--accent);
  color: var(--ctp-crust);
  border: none;
  padding: 8px 20px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: transform var(--transition-fast), background var(--transition-fast);
  box-shadow: 0 4px 16px rgba(0,0,0,0.6);
}
.album-card-details-btn:hover { 
  transform: scale(1.05); 
  background: var(--accent);
}

.album-card-info {
  padding: var(--space-3) var(--space-4) var(--space-4);
}
.album-card-title { font-weight: 600; font-size: 13px; color: var(--text-primary); margin-bottom: 2px; }
.album-card-artist { font-size: 12px; color: var(--text-secondary); }
.album-card-year { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ─ Live Search ─ */
.live-search { position: relative; min-width: 280px; max-width: 420px; flex: 1; }
.live-search-input-wrap { position: relative; display: flex; align-items: center; }
.live-search-icon { position: absolute; left: 12px; color: var(--text-muted); pointer-events: none; display: flex; align-items: center; }
.live-search-field { padding-left: 36px !important; padding-right: 32px !important; border-radius: var(--radius-full) !important; }
.live-search-clear { position: absolute; right: 12px; font-size: 18px; color: var(--text-muted); line-height: 1; transition: color var(--transition-fast); }
.live-search-clear:hover { color: var(--text-primary); }

.live-search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--ctp-surface0);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-height: 420px;
  overflow-y: auto;
  z-index: 1000;
  animation: fadeIn 150ms ease both;
}

.search-section { padding: var(--space-2) 0; }
.search-section + .search-section { border-top: 1px solid var(--border-subtle); }

.search-section-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: var(--space-2) var(--space-4);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-2) var(--space-4);
  text-align: left;
  transition: background var(--transition-fast);
  border-radius: 0;
}
.search-result-item:hover { background: var(--bg-hover); }
.search-result-icon { width: 32px; height: 32px; border-radius: var(--radius-sm); background: var(--bg-hover); display: flex; align-items: center; justify-content: center; color: var(--text-muted); flex-shrink: 0; }
.search-result-thumb { width: 32px; height: 32px; border-radius: var(--radius-sm); object-fit: cover; flex-shrink: 0; }
.search-result-name { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.search-result-sub { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.search-empty { padding: var(--space-4); text-align: center; color: var(--text-muted); font-size: 13px; }

/* ─ Album Detail ─ */
.album-detail { display: flex; flex-direction: column; gap: 0; }
.album-detail-header { 
  position: relative;
  padding: var(--space-6) var(--space-6) 0; 
  overflow: hidden;
}

.album-detail-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(20px) brightness(0.6);
  transform: scale(1.1); /* Hide blur edges */
  z-index: 0;
  opacity: 0.8;
  transition: opacity var(--transition-slow);
}

.album-detail-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(30, 30, 46, 0.5) 0%,
    var(--bg-app) 100%
  );
  z-index: 0;
}

.album-detail-hero {
  display: flex;
  gap: var(--space-6);
  align-items: flex-start;
  padding: var(--space-4) 0 var(--space-6);
}
.album-detail-cover {
  width: clamp(120px, 15vw, 200px);
  height: clamp(120px, 15vw, 200px);
  border-radius: var(--radius-lg);
  object-fit: cover;
  box-shadow: var(--shadow-lg);
  flex-shrink: 0;
}
.album-cover-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  font-size: 48px;
  color: var(--text-muted);
}
.album-detail-meta { min-width: 0; flex: 1; }
.album-detail-title { font-family: var(--font-display); font-size: clamp(20px, 3vw, 32px); font-weight: 800; color: var(--text-primary); line-height: 1.1; margin: var(--space-2) 0 var(--space-1); overflow-wrap: break-word; }
.album-detail-artist { font-size: clamp(13px, 1.5vw, 16px); color: var(--accent); font-weight: 600; }
.album-detail-artist-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-size: inherit;
  font-weight: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: color var(--transition-fast), text-decoration var(--transition-fast);
}
.album-detail-artist-link:hover {
  color: var(--text-primary);
  text-decoration: underline;
}
.album-detail-info { display: flex; flex-wrap: wrap; gap: var(--space-2); color: var(--text-muted); font-size: 13px; margin: var(--space-2) 0 var(--space-4); }
.album-detail-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; row-gap: var(--space-2); }

.download-hint {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-secondary);
  background: rgba(203, 166, 247, 0.08);
  border: 1px solid rgba(203, 166, 247, 0.2);
  border-radius: var(--radius-full);
  padding: 3px 10px 3px 8px;
  cursor: default;
  white-space: nowrap;
}

.download-progress-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-3);
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--surface-1);
  border: 1px solid var(--border);
  min-width: 180px;
  color: var(--text-secondary);
  font-size: 12px;
}
.download-progress-bar {
  flex: 1;
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
}
.download-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ctp-mauve), var(--ctp-blue));
  border-radius: 2px;
  transition: width 0.2s ease;
}
.download-progress-pct {
  min-width: 28px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ─ Tracklist ─ */
.tracklist { padding: 0 var(--space-6) var(--space-6); }
.tracklist-header {
  display: grid;
  grid-template-columns: 36px minmax(100px, 3fr) minmax(90px, 1.5fr) 70px 80px 60px;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-2);
}
.tracklist-header.tracklist-va {
  grid-template-columns: 36px minmax(100px, 2fr) minmax(80px, 1.2fr) minmax(90px, 1.5fr) 70px 80px 60px;
}

.track-row {
  display: grid;
  grid-template-columns: 36px minmax(100px, 3fr) minmax(90px, 1.5fr) 70px 80px 60px;
  gap: var(--space-3);
  align-items: start;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.track-row.track-row-va {
  grid-template-columns: 36px minmax(100px, 2fr) minmax(80px, 1.2fr) minmax(90px, 1.5fr) 70px 80px 60px;
}

.tracklist-total {
  display: grid;
  grid-template-columns: 36px minmax(100px, 3fr) minmax(90px, 1.5fr) 70px 80px 60px;
  border-top: 1px solid var(--border-subtle);
  padding: var(--space-3) var(--space-4);
  margin-top: var(--space-1);
}
.tracklist-total.tracklist-va {
  grid-template-columns: 36px minmax(100px, 2fr) minmax(80px, 1.2fr) minmax(90px, 1.5fr) 70px 80px 60px;
}
.tracklist-total-label {
  grid-column: 1 / -2;
  text-align: right;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-right: var(--space-3);
}
.tracklist-total-value {
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.track-row:hover { background: var(--bg-hover); }
.track-row > * { padding-top: 6px; padding-bottom: 6px; }

/* CD / Disc separator */
.disc-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-3) var(--space-2);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
}
.disc-header:first-child { border-top: none; margin-top: 0; }
.disc-icon { font-size: 16px; }

.track-num { font-size: 13px; color: var(--text-muted); text-align: right; font-variant-numeric: tabular-nums; }
.track-info { min-width: 0; }
.track-title { font-size: 13px; font-weight: 500; color: var(--text-primary); overflow-wrap: break-word; word-break: break-word; }
.track-artist-cell { min-width: 0; display: flex; align-items: flex-start; }
.track-artist { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-codec {
  display: block;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-size { color: var(--ctp-overlay0); }
.track-duration { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ─ Modal ─ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 17, 27, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  z-index: 9999;
  animation: fadeIn 150ms ease both;
}
.modal-content {
  background: var(--ctp-surface0);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  animation: fadeIn 200ms ease both;
  box-shadow: var(--shadow-lg);
}
.modal-close { position: absolute; top: var(--space-4); right: var(--space-4); color: var(--text-muted); }
.modal-close:hover { color: var(--text-primary); }

.artist-bio { font-size: 14px; line-height: 1.7; color: var(--text-secondary); }
.artist-bio a { color: var(--accent); text-decoration: underline; }

/* Artist Detail Page */
.artist-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
  margin-bottom: 2rem;
}
.artist-detail-avatar {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-card);
  flex-shrink: 0;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
}
.artist-detail-meta {
  flex: 1;
  min-width: 0;
  padding-top: 0.5rem;
}
.artist-detail-links {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.artist-ext-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.artist-ext-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

/* Bio section */
.artist-bio-section {
  margin-bottom: 0.5rem;
}
.artist-bio-text {
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-secondary);
  max-width: 100%;
}
.artist-bio-text a { color: var(--accent); text-decoration: underline; }


/* ─ Artists Page ─ */
.letter-heading { font-size: 13px; font-weight: 700; color: var(--text-muted); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: var(--space-2); padding: var(--space-2) 0; border-bottom: 1px solid var(--border-subtle); }
.artist-list { display: flex; flex-direction: column; gap: 2px; }
.artist-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); border-radius: var(--radius-md); transition: background var(--transition-fast); width: 100%; text-align: left; }
.artist-row:hover { background: var(--bg-hover); }
.artist-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-dim); display: flex; align-items: center; justify-content: center; color: var(--accent); flex-shrink: 0; }
.artist-avatar-initial { background: var(--bg-card); border: 2px solid; }
.artist-avatar-initial span { font-size: 1rem; font-weight: 700; font-family: var(--font-display); line-height: 1; user-select: none; }
.artist-name { font-size: 14px; font-weight: 500; color: var(--text-primary); }
.artist-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ─ Years Page ─ */
.decade-heading { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--text-primary); margin-bottom: var(--space-3); }
.year-section { margin-bottom: var(--space-3); }
.year-toggle { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); border-radius: var(--radius-md); width: 100%; text-align: left; color: var(--text-secondary); font-size: 15px; font-weight: 500; transition: background var(--transition-fast); }
.year-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }
.year-label { font-variant-numeric: tabular-nums; }

/* ─ Settings ─ */
.settings-section { margin-bottom: var(--space-8); }
.settings-section-header { display: flex; align-items: center; gap: var(--space-2); color: var(--accent); margin-bottom: var(--space-3); }
.settings-section-header h2 { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.settings-card { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: var(--space-5); }

/* ─ Help Page ─ */
.help-list { display: flex; flex-direction: column; border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); overflow: hidden; }
.help-item { border-bottom: 1px solid var(--border-subtle); }
.help-item:last-child { border-bottom: none; }
.help-question { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); width: 100%; padding: var(--space-4) var(--space-5); text-align: left; font-size: 14px; font-weight: 500; color: var(--text-primary); background: var(--bg-card); transition: background var(--transition-fast); }
.help-question:hover { background: var(--bg-hover); }
.help-item-open .help-question { color: var(--accent); background: var(--bg-hover); }
.help-chevron { flex-shrink: 0; color: var(--text-muted); transition: transform 0.2s ease; }
.help-item-open .help-chevron { transform: rotate(180deg); color: var(--accent); }
.help-answer { padding: var(--space-3) var(--space-5) var(--space-5); font-size: 13px; color: var(--text-secondary); line-height: 1.65; background: var(--bg-hover); border-top: 1px solid var(--border-subtle); }
.settings-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }
.settings-about { display: flex; flex-direction: column; }
.settings-about-header { display: flex; align-items: center; gap: var(--space-4); }

/* Toggle switch */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; cursor: pointer; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--ctp-surface2);
  border-radius: var(--radius-full);
  transition: background var(--transition-base);
}
.toggle-track::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  transition: transform var(--transition-base);
  box-shadow: var(--shadow-sm);
}
.toggle-switch input:checked + .toggle-track { background: var(--accent); }
.toggle-switch input:checked + .toggle-track::before { transform: translateX(20px); }

/* ─ Login Page ─ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: var(--bg-app);
}

.login-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(203, 166, 247, 0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(137, 180, 250, 0.06) 0%, transparent 50%);
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 520px;
  background: var(--ctp-mantle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
}

.login-logo { display: flex; justify-content: center; margin-bottom: var(--space-5); }
.login-title { text-align: center; font-family: var(--font-display); font-size: 28px; font-weight: 800; background: linear-gradient(135deg, var(--ctp-mauve), var(--ctp-blue)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.login-subtitle { text-align: center; color: var(--text-muted); font-size: 13px; margin: var(--space-1) 0 var(--space-6); }

.login-form { display: flex; flex-direction: column; gap: var(--space-4); }
.form-group { display: flex; flex-direction: column; gap: var(--space-2); }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text-secondary); letter-spacing: 0.03em; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }

.login-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: 13px;
}
.login-status--testing { background: var(--accent-dim); color: var(--accent); }
.login-status--ok { background: rgba(166, 227, 161, 0.15); color: var(--positive); }
.login-status--error { background: rgba(243, 139, 168, 0.15); color: var(--danger); }

.login-saved-servers { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-4); }
.login-saved-label { font-size: 11px; font-weight: 600; color: var(--text-muted); letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: var(--space-1); }
.login-server-btn { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); text-align: left; width: 100%; }
.login-divider { display: flex; align-items: center; gap: var(--space-3); color: var(--text-muted); font-size: 12px; margin: var(--space-2) 0; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ─ Loading / Empty ─ */
.loading-center { display: flex; justify-content: center; align-items: center; height: 200px; }
.empty-state { text-align: center; padding: var(--space-10); color: var(--text-muted); }

/* ─────────────────────────────────────────
   Fullscreen Player
──────────────────────────────────────────── */
.fs-player {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  will-change: transform;
  contain: layout style paint;
  animation: fsIn 280ms cubic-bezier(0.22, 1, 0.36, 1) both;
  /* Solid base — guarantees nothing shines through, even at edges */
  background: #0e0e1a;
}

@keyframes fsIn {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* Blurred background */
.fs-bg {
  position: absolute;
  inset: -10%;
  background-size: cover;
  background-position: center;
  filter: blur(50px) brightness(0.28) saturate(1.6);
  transform: scale(1.2);
  z-index: 0;
  will-change: opacity;
  pointer-events: none;
  transition: opacity 700ms ease;
}

.fs-bg-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(17, 17, 27, 0.45) 0%,
    rgba(17, 17, 27, 0.75) 65%,
    rgba(17, 17, 27, 0.96) 100%
  );
  z-index: 0;
  pointer-events: none;
}

/* Close button */
.fs-close {
  position: absolute;
  top: 20px;
  left: 24px;
  z-index: 10;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  cursor: pointer;
}
.fs-close:hover {
  background: rgba(255, 255, 255, 0.16);
  color: var(--text-primary);
  transform: translateY(-1px);
}

/* ── Main layout: two columns, left = cover+controls, right = playlist ── */
.fs-layout {
  position: relative;
  z-index: 1;
  display: flex;
  flex: 1;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(28px, 4vw, 72px);
  padding: 72px clamp(40px, 6vw, 100px) 48px;
  min-height: 0;
  overflow: hidden;
}

/* Left column: cover + track info + progress + controls */
.fs-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
  /* Width = cover size (cover fills 100% of this column) */
  width: min(clamp(260px, 36vw, 560px), calc(100vh - 310px));
}

/* Cover fills the column width */
.fs-cover-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255,255,255,0.06);
  flex-shrink: 0;
  transition: transform var(--transition-slow), box-shadow var(--transition-slow);
}
.fs-cover-wrap:hover {
  transform: scale(1.015);
  box-shadow: 0 32px 100px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.1);
}
.fs-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.fs-cover-placeholder {
  background: var(--ctp-surface0);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

/* Track metadata */
.fs-track-info {
  text-align: center;
  width: 100%;
}
.fs-title {
  font-family: var(--font-display);
  font-size: clamp(16px, 1.8vw, 26px);
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 4px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fs-artist {
  font-size: clamp(13px, 1.1vw, 16px);
  font-weight: 600;
  color: var(--ctp-lavender);
  margin: 0;
}
.fs-album {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  margin: 3px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fs-codec {
  display: inline-block;
  font-size: 10px;
  font-family: monospace;
  letter-spacing: 0.04em;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  color: rgba(255, 255, 255, 0.45);
  margin-top: 6px;
}

/* Progress bar */
.fs-progress-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}
.fs-time {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 36px;
  text-align: center;
}
.fs-progress-bar {
  flex: 1;
  position: relative;
}
.fs-progress-bar input[type="range"] {
  width: 100%;
  height: 4px;
  background: linear-gradient(to right, var(--ctp-mauve) var(--pct), rgba(255,255,255,0.12) var(--pct));
  border-radius: 2px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.fs-progress-bar input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
  transition: transform var(--transition-fast);
}
.fs-progress-bar input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.25); }

/* Transport controls */
.fs-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
}
.fs-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  background: transparent;
}
.fs-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.08); }
.fs-btn.active { color: var(--accent); }
.fs-btn-sm { width: 25px; height: 25px; }
.fs-btn-play {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--ctp-mauve), var(--ctp-lavender));
  color: var(--ctp-crust);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.5);
}
.fs-btn-play:hover {
  background: linear-gradient(135deg, var(--ctp-lavender), var(--ctp-mauve));
  color: var(--ctp-crust);
  transform: scale(1.06);
  box-shadow: 0 8px 28px rgba(0,0,0,0.6);
}

/* Right column: upcoming tracks — top-aligned with cover */
.fs-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
  width: clamp(240px, 26vw, 380px);
  align-self: flex-start;
  height: min(clamp(400px, 60vh, 840px), calc(100vh - 180px));
  overflow: hidden;
}
.fs-upcoming-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  margin: 0;
  flex-shrink: 0;
}
.fs-upcoming-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.fs-upcoming-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background var(--transition-fast);
  background: transparent;
  flex-shrink: 0;
}
.fs-upcoming-item:hover { background: rgba(255,255,255,0.07); }
.fs-upcoming-art {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}
.fs-upcoming-placeholder {
  background: var(--ctp-surface1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.fs-upcoming-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.fs-upcoming-name {
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fs-upcoming-artist {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fs-upcoming-dur {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* Chat */
.chat-popup {
  position: absolute;
  width: 340px;
  height: 480px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  z-index: 9999;
  overflow: hidden;
  animation: slideInDown 0.2s ease-out;
}

@keyframes slideInDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface1);
}

.chat-popup-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-message-row {
  display: flex;
  flex-direction: column;
}

.chat-message-row.me {
  align-items: flex-end;
}

.chat-message-row.other {
  align-items: flex-start;
}

.chat-message-bubble {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.4;
  word-break: break-word;
}

.chat-message-row.me .chat-message-bubble {
  background: var(--accent);
  color: var(--mantle);
  border-bottom-right-radius: 4px;
}

.chat-message-row.other .chat-message-bubble {
  background: var(--surface2);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.chat-message-author {
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 2px;
  opacity: 0.8;
}

.chat-message-time {
  font-size: 0.7rem;
  margin-top: 4px;
  text-align: right;
  opacity: 0.7;
}

.chat-popup-input {
  display: flex;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--surface1);
  gap: 8px;
}

.chat-popup-input input {
  flex: 1;
  background: var(--crust);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 16px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

.chat-popup-input input:focus {
  border-color: var(--accent);
}

.chat-popup-input button {
  background: var(--accent);
  color: var(--mantle);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.2s;
}

.chat-popup-input button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─ Context Menu ─ */
.context-menu {
  position: fixed;
  z-index: 10000;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-1) 0;
  min-width: 200px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(16px);
  color: var(--text-primary);
  font-size: 13px;
}

.context-menu-item {
  padding: var(--space-2) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.context-menu-item:hover {
  background: var(--surface-2);
  color: var(--accent);
}

.context-menu-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-1) 0;
}

/* ─ CSS Tooltips ─ */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::before,
[data-tooltip]::after {
  position: absolute;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
  z-index: 9999;
}

[data-tooltip]::before {
  content: '';
  border: 5px solid transparent;
  border-top-color: var(--border-subtle);
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
}

/* Inner triangle for the tooltip arrow to match background */
[data-tooltip]::after {
  content: attr(data-tooltip);
  background: var(--bg-card);
  color: var(--text-primary);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: 12px;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  font-weight: 500;
  border: 1px solid var(--border-subtle);
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
}

/* Modifiers for position */
[data-tooltip][data-tooltip-pos="bottom"]::before {
  top: 100%;
  bottom: auto;
  border-top-color: transparent;
  border-bottom-color: var(--border-subtle);
}

[data-tooltip][data-tooltip-pos="bottom"]::after {
  top: calc(100% + 6px);
  bottom: auto;
}

