/* ============================================================
   S2Y — Spotify → YouTube  |  style.css
   Dark cinematic design with glassmorphism & smooth animations
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

:root {
  --bg:          #08080f;
  --surface:     rgba(255,255,255,0.055);
  --surface-hov: rgba(255,255,255,0.09);
  --border:      rgba(255,255,255,0.1);
  --text-1:      #f0f0f8;
  --text-2:      rgba(240,240,248,0.6);
  --text-3:      rgba(240,240,248,0.35);
  --green:       #1db954;
  --green-glow:  rgba(29,185,84,0.35);
  --red:         #e8445a;
  --radius-sm:   8px;
  --radius-md:   16px;
  --radius-lg:   24px;
  --radius-xl:   32px;
  --trans:       cubic-bezier(0.4, 0, 0.2, 1);
  --shadow:      0 20px 60px rgba(0,0,0,0.6);
}

html, body {
  height: 100%;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-1);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Dynamic background ─────────────────────────────────────── */
.bg-blur {
  position: fixed; inset: -40px;
  background-size: cover;
  background-position: center;
  filter: blur(80px) saturate(1.4) brightness(0.35);
  transition: background-image 1.2s var(--trans);
  z-index: 0;
}
.bg-overlay {
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(29,185,84,0.06) 0%, transparent 65%),
              linear-gradient(180deg, rgba(8,8,15,0.55) 0%, rgba(8,8,15,0.85) 100%);
  z-index: 1;
}

/* ── Screens ─────────────────────────────────────────────────── */
.screen {
  position: fixed; inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--trans);
}
.screen.active {
  opacity: 1;
  pointer-events: all;
}

/* ── Setup Screen ────────────────────────────────────────────── */
#setup-screen { background: var(--bg); z-index: 30; }
.setup-card {
  max-width: 560px; width: 90%;
  padding: 48px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  text-align: center;
}
.setup-card .logo { font-size: 2.5rem; margin-bottom: 16px; }
.setup-card h1 { font-size: 1.8rem; font-weight: 700; margin-bottom: 8px; }
.setup-card > p { color: var(--text-2); margin-bottom: 32px; }
.setup-steps { display: flex; flex-direction: column; gap: 20px; text-align: left; }
.step {
  display: flex; gap: 16px; align-items: flex-start;
  background: rgba(255,255,255,0.04);
  border-radius: var(--radius-md);
  padding: 18px;
}
.step-num {
  flex-shrink: 0;
  width: 32px; height: 32px;
  background: var(--green);
  color: #000;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 0.9rem;
}
.step strong { display: block; margin-bottom: 4px; }
.step p { color: var(--text-2); font-size: 0.85rem; margin-top: 4px; }
.step a { color: var(--green); text-decoration: none; }
.step a:hover { text-decoration: underline; }
.step code, .setup-card code {
  background: rgba(255,255,255,0.08);
  padding: 2px 8px; border-radius: 4px;
  font-size: 0.82rem; word-break: break-all;
}

/* ── Login Screen ────────────────────────────────────────────── */
.login-card {
  width: min(420px, 90vw);
  padding: 48px 40px;
  background: rgba(255,255,255,0.055);
  backdrop-filter: blur(30px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  text-align: center;
}
.app-logo {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; margin-bottom: 28px;
}
.logo-icon { font-size: 2rem; }
.logo-text  { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.5px; }
.login-title {
  font-size: 1.6rem; font-weight: 700;
  background: linear-gradient(135deg, #fff 0%, var(--green) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}
.login-subtitle { color: var(--text-2); font-size: 0.95rem; line-height: 1.6; margin-bottom: 32px; }
.btn-spotify {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 14px 24px;
  background: var(--green);
  color: #000; font-weight: 600; font-size: 0.95rem;
  border: none; border-radius: 100px;
  cursor: pointer; transition: all 0.2s var(--trans);
  box-shadow: 0 4px 24px var(--green-glow);
}
.btn-spotify:hover {
  background: #23d160;
  transform: translateY(-2px);
  box-shadow: 0 8px 32px var(--green-glow);
}
.btn-spotify:active { transform: translateY(0); }
.login-note { color: var(--text-3); font-size: 0.78rem; margin-top: 16px; }

/* ── Idle Screen ─────────────────────────────────────────────── */
#idle-screen { flex-direction: column; gap: 24px; }
.idle-content { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 20px; }
.idle-content h2 { font-size: 1.6rem; font-weight: 600; }
.idle-content p  { color: var(--text-2); }

/* Vinyl animation */
.vinyl-anim { position: relative; width: 140px; height: 140px; }
.vinyl-disc {
  width: 140px; height: 140px;
  background: radial-gradient(circle, #2a2a2a 28%, #111 28%, #111 32%, #1a1a1a 32%, #1a1a1a 36%, #111 36%);
  border-radius: 50%;
  animation: vinyl-spin 3s linear infinite;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}
.vinyl-label {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--green) 0%, #169c40 100%);
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 1.2rem;
  color: rgba(0,0,0,0.8);
}
@keyframes vinyl-spin { to { transform: rotate(360deg); } }

/* EQ bars */
.eq-bars { display: flex; gap: 5px; align-items: flex-end; height: 32px; }
.eq-bar {
  width: 4px; background: var(--green);
  border-radius: 2px;
  animation: eq-bounce 0.8s ease-in-out infinite alternate;
}
.eq-bar:nth-child(1) { animation-delay: 0s;    height: 60%; }
.eq-bar:nth-child(2) { animation-delay: 0.15s; height: 90%; }
.eq-bar:nth-child(3) { animation-delay: 0.30s; height: 40%; }
.eq-bar:nth-child(4) { animation-delay: 0.45s; height: 75%; }
.eq-bar:nth-child(5) { animation-delay: 0.60s; height: 55%; }
@keyframes eq-bounce { to { height: 15%; } }

.btn-logout {
  padding: 8px 20px;
  background: rgba(255,255,255,0.07);
  color: var(--text-2); font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.12); color: var(--text-1); }

/* ── Player Screen ───────────────────────────────────────────── */
#player-screen {
  flex-direction: column;
  padding: 0;
  transition: opacity 0.35s var(--trans);
}

.player-layout {
  display: grid;
  grid-template-rows: 1fr auto;
  width: 100%; height: 100%;
  padding: 20px 20px 0;
  gap: 0;
}

/* ── Media area ─────────────────────────────────────────────── */
.media-area {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: rgba(0,0,0,0.4);
  min-height: 0;
}

#video-wrap {
  width: 100%; height: 100%;
  display: none;
}
#video-wrap iframe { width: 100%; height: 100%; border: none; display: block; }

#album-fallback {
  display: none;
  width: 100%; height: 100%;
  align-items: center; justify-content: center;
}
#fallback-img {
  max-height: 85%; max-width: 85%;
  border-radius: var(--radius-md);
  box-shadow: 0 24px 80px rgba(0,0,0,0.7);
  object-fit: contain;
  animation: float 6s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-12px); }
}

/* Loading overlay */
#loading-overlay {
  display: flex;
  align-items: center; justify-content: center;
  flex-direction: column; gap: 16px;
  width: 100%; height: 100%;
}
.spinner {
  width: 44px; height: 44px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: var(--text-2); font-size: 0.9rem; }

/* ── Now Playing bar ─────────────────────────────────────────── */
.now-playing-bar {
  padding: 16px 0 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.album-thumb {
  flex-shrink: 0;
  width: 56px; height: 56px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

.track-meta { flex: 1; min-width: 0; }
.track-meta h2 {
  font-size: 1rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.track-meta .artist {
  font-size: 0.82rem; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px;
}
.track-meta .album {
  font-size: 0.75rem; color: var(--text-3);
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Progress row */
.progress-row {
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px;
}
.time-label { font-size: 0.72rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
.progress-track {
  flex: 1; height: 3px;
  background: rgba(255,255,255,0.12);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), #23d160);
  border-radius: 2px;
  transition: width 0.9s linear;
}

/* Status text */
.status-row {
  text-align: center;
  margin-top: 6px;
}
#status-text {
  font-size: 0.75rem; color: var(--text-3);
  letter-spacing: 0.02em;
}

/* Controls */
.bar-controls {
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  flex-shrink: 0;
}
.ctrl-btn {
  width: 36px; height: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-2);
  cursor: pointer;
  display: grid; place-items: center;
  transition: all 0.2s;
}
.ctrl-btn:hover {
  background: var(--surface-hov);
  color: var(--text-1);
  border-color: rgba(255,255,255,0.2);
}
.logout-link {
  font-size: 0.72rem; color: var(--text-3);
  background: none; border: none;
  cursor: pointer;
  transition: color 0.2s;
  padding: 0;
}
.logout-link:hover { color: var(--text-2); }

/* ── Toast ───────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px; left: 50%; transform: translateX(-50%) translateY(12px);
  padding: 10px 20px;
  background: rgba(30,30,40,0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.85rem;
  opacity: 0;
  transition: all 0.3s var(--trans);
  z-index: 999;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: rgba(232,68,90,0.4); color: #f8a0ae; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 600px) {
  .player-layout { padding: 12px 12px 0; }
  .album-thumb   { width: 44px; height: 44px; }
  .track-meta h2 { font-size: 0.9rem; }
  .now-playing-bar { gap: 10px; }
}
