/* ── Layout overrides ──────────────────────────────────────────────────── */

:root {
  --bg: #0a0a0a;
  --card: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.08);
  --border-active: rgba(255, 255, 255, 0.5);
  --text: rgba(255, 255, 255, 0.88);
  --text-dim: rgba(255, 255, 255, 0.3);
  --accent: rgba(255, 255, 255, 0.88);
  --neon: #ffffff;
}

body { background: #000; position: relative; }

.navbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
}

.nav-tabs {
  background: rgba(0, 0, 0, 0.42);
  border-color: rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  text-shadow: 0 1px 4px rgba(0,0,0,0.8), 0 2px 12px rgba(0,0,0,0.4);
}

.tab { color: rgba(255, 255, 255, 0.45); }
.tab.active { background: rgba(255, 255, 255, 0.12); color: rgba(255, 255, 255, 0.88); }

.profile-popover {
  background: rgba(0, 0, 0, 0.42);
  border-color: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
}

.pi-label { color: rgba(255, 255, 255, 0.45); }
.pi-name  { color: rgba(255, 255, 255, 0.92); }
.pi-sub   { color: rgba(255, 255, 255, 0.45); }
.pi-meta  { color: rgba(255, 255, 255, 0.45); }

.pi-logout {
  color: #e87a7a;
  border-color: #5c2e2e;
}

.pi-logout:hover {
  color: #ff9f9f;
  border-color: #a03030;
  background: rgba(255, 80, 80, 0.08);
}

.profile-btn {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  text-shadow: 0 1px 4px rgba(0,0,0,0.8), 0 2px 12px rgba(0,0,0,0.4);
}

.app-content {
  position: relative;
  height: 100dvh;
  min-height: 100vh;
  padding: 0;
  display: block;
  overflow: hidden;
}

.section {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.section.hidden { display: none; }

.hidden { display: none !important; }

/* ── Player section ────────────────────────────────────────────────────── */

#player-section { background: #0a0a0a; }

#player-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 220px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.55) 0%, transparent 100%);
  z-index: 1;
  pointer-events: none;
}

#bg-blur {
  position: absolute;
  inset: -10%;
  background-size: cover;
  background-position: center;
  filter: blur(40px) brightness(0.9) saturate(1);
  z-index: 0;
  transform: scale(1.1);
  transition: background-image 0.6s ease;
}

#player-inner {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 106px 24px 24px;
  gap: 14px;
  min-height: 0;
}

/* Cover art — square, sits at the bottom */
#cover-art {
  margin-top: 16px;
  width: 70%;
  max-width: 280px;
  aspect-ratio: 1 / 1;
  flex: 0 1 auto;
  min-height: 0;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px;
}

#cover-art:has(img) { padding: 0; gap: 0; }

#cover-art img { width: 100%; height: 100%; object-fit: cover; display: block; }

.cover-placeholder { font-size: 48px; opacity: 0.25; }

.idle-msg {
  color: rgba(255, 255, 255, 0.88);
  font-size: 13px;
  font-family: inherit;
  text-align: center;
}

/* Track info */
#track-info {
  width: 100%;
  text-align: center;
  flex-shrink: 0;
}

#track-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9), 0 2px 20px rgba(0,0,0,0.5);
}

#track-subtitle {
  font-size: 12px;
  color: rgba(255,255,255,0.35);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: inherit;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9), 0 2px 20px rgba(0,0,0,0.5);
}

/* Seek */
#seek-section {
  width: 100%;
  flex-shrink: 0;
}

#seek-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.seek-edge {
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9), 0 2px 12px rgba(0,0,0,0.5);
}

#seek-bar {
  -webkit-appearance: none;
  flex: 1;
  height: 4px;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  background: linear-gradient(
    to right,
    var(--accent) var(--p, 0%),
    rgba(255,255,255,0.15) var(--p, 0%)
  );
}

#seek-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

#t-current {
  display: block;
  width: 50%;
  max-width: 190px;
  margin: 0 auto;
  background: rgba(255,255,255,0.04);
  border: 1.5px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  color: #fff;
  font-size: 32px;
  font-weight: 200;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
  text-align: center;
  padding: 10px 20px;
  outline: none;
  caret-color: var(--accent);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

#t-current:focus {
  border-color: var(--border-active);
  background: rgba(255,255,255,0.07);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.1);
  cursor: text;
}

/* Controls */
#controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  width: 100%;
  flex-shrink: 0;
}

.ctrl-cluster {
  display: flex;
  align-items: center;
  gap: 40px;
}

.ctrl-extra {
  position: relative;
  display: flex;
  justify-content: flex-end;
}

.vol-popup {
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 16px;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  z-index: 20;
}

.vol-track-wrap {
  width: 20px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  position: relative;
}

#vol-slider {
  position: absolute;
  top: 50%;
  left: 50%;
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 4px;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  transform: translate(-50%, -50%) rotate(-90deg);
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0.88) var(--vp, 100%),
    rgba(255, 255, 255, 0.15) var(--vp, 100%)
  );
}

#vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

#vol-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  border: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.autoplay-toggle {
  width: 48px;
  height: 26px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.14);
  cursor: pointer;
  position: relative;
  padding: 0;
  justify-self: start;
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.autoplay-toggle.on {
  background: rgba(255, 255, 255, 0.88);
  border-color: transparent;
}

.autoplay-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(0, 0, 0, 0.65);
  transition: left 0.2s, background 0.2s, color 0.15s;
}

.autoplay-toggle.on .autoplay-knob {
  left: 23px;
  background: #111;
  color: rgba(255, 255, 255, 0.9);
}

.ap-icon-off { display: flex; }
.ap-icon-on  { display: none; }
.autoplay-toggle.on .ap-icon-off { display: none; }
.autoplay-toggle.on .ap-icon-on  { display: flex; }

.ctrl-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s, transform 0.1s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
  /* filter: drop-shadow(0 1px 4px rgba(0,0,0,0.9)) drop-shadow(0 2px 12px rgba(0,0,0,0.4)); */
}

.ctrl-btn:hover { color: #fff; }
.ctrl-btn:active { transform: scale(0.88); }

#btn-play {
  width: 64px;
  height: 64px;
  background: #fff;
  border-radius: 50%;
  color: #000;
  /* box-shadow: 0 6px 24px rgba(0,0,0,0.5); */
  transition: transform 0.1s, box-shadow 0.15s;
}

/* #btn-play:hover { box-shadow: 0 8px 32px rgba(255,255,255,0.25); } */
#btn-play:active { transform: scale(0.9); }

#idle-msg {
  color: rgba(255,255,255,0.2);
  font-size: 13px;
  font-family: inherit;
  margin-top: 24px;
}

/* ── Library section ───────────────────────────────────────────────────── */

#library-section {
  background: #0a0a0a;
  overflow-y: auto;
  padding-top: 86px;
}

/* ── Login page ─────────────────────────────────────────────────────────── */

.login-screen {
  position: relative;
  overflow: hidden;
  background: #000;
}

#login-bg {
  position: absolute;
  inset: -10%;
  background-size: cover;
  background-position: center;
  filter: blur(40px) brightness(0.9) saturate(1);
  transform: scale(1.1);
  z-index: 0;
}

.login-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 1;
  pointer-events: none;
}

.login-card-wrap { position: relative; z-index: 2; }

.login-card {
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(28px) saturate(1.6);
  -webkit-backdrop-filter: blur(28px) saturate(1.6);
}

.login-logo {
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

.login-domain {
  color: rgba(255, 255, 255, 0.4);
}

.login-domain:hover { color: rgba(255, 255, 255, 0.75); }

.login-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.88);
}

.login-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.38);
}

.app-about {
  position: relative;
  z-index: 2;
  color: rgba(255, 255, 255, 0.4);
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

.login-divider { position: relative; z-index: 2; }
.login-divider::before,
.login-divider::after { background: rgba(255, 255, 255, 0.4); }
.login-divider-dot { border-color: rgba(255, 255, 255, 0.4); }

#tree-root { padding-bottom: 40px; }

.tree-row {
  display: flex;
  align-items: center;
  padding: 11px 20px;
  gap: 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s;
}

.tree-row:hover  { background: var(--card); }
.tree-row:active { background: var(--card); }

.row-icon { font-size: 18px; width: 24px; text-align: center; flex-shrink: 0; color: var(--text-dim); }

.row-label {
  flex: 1;
  font-size: 13px;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-arrow {
  font-size: 14px;
  color: var(--text-dim);
  transition: transform 0.2s;
  line-height: 1;
  flex-shrink: 0;
}

.tree-row.open .row-arrow { transform: rotate(90deg); }

.tree-row.audio-row.playing .row-label { color: var(--accent); font-weight: 600; }

.tree-row.audio-row.playing .row-icon {
  animation: pulse 1.4s ease-in-out infinite;
  color: var(--accent);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.tree-children { padding-left: 18px; }
.tree-children.hidden { display: none; }
