/* ─── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --bg:               hsl(204, 9%, 11%);
  --surface:          hsl(203, 9%, 17%);
  --surface-raised:   hsl(203, 9%, 22%);
  --surface-hover:    hsl(203, 9%, 26%);

  --accent:           hsl(200, 100%, 73%);
  --accent-dim:       hsla(200, 100%, 73%, 0.12);
  --accent-border:    hsla(200, 100%, 73%, 0.28);
  --accent-glow:      hsla(200, 100%, 73%, 0.35);

  --prussian:         hsl(196, 100%, 14%);

  --text-primary:     hsl(225, 7%, 89%);
  --text-secondary:   hsl(208, 12%, 60%);

  --border:           rgba(255, 255, 255, 0.06);
  --border-hover:     rgba(255, 255, 255, 0.12);

  --shadow-sm:  0 1px 4px  rgba(0, 0, 0, 0.35);
  --shadow-md:  0 4px 16px rgba(0, 0, 0, 0.45);
  --shadow-lg:  0 8px 32px rgba(0, 0, 0, 0.55);

  --radius-sm:   8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-pill: 100px;

  --ease:       cubic-bezier(0.2, 0, 0, 1);
  --t-fast:     150ms var(--ease);
  --t-normal:   250ms var(--ease);
}

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

html { font-size: 62.5%; scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  font-size: 1.4rem;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img    { display: block; max-width: 100%; }
button { cursor: pointer; border: none; background: none; font-family: inherit; color: inherit; }
input  { font-family: inherit; border: none; outline: none; background: none; color: inherit; }
h1, h2 { font-weight: 600; letter-spacing: -0.02em; }

/* ─── Scrollbar ──────────────────────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 2px; }

/* ─── Utility ────────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ─── App Bar ────────────────────────────────────────────────────────────────── */
.app-bar {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  height: 64px;
  background: hsla(204, 9%, 11%, 0.92);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  z-index: 100;
}

.app-bar-inner {
  max-width: 1440px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  user-select: none;
}
.logo .material-symbols-rounded { font-size: 2.8rem; }
.logo-text { font-size: 1.8rem; font-weight: 600; }

.role-badge {
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 16px;
  border-radius: var(--radius-pill);
}
.role-badge.master {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}
.role-badge.guest {
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border-hover);
}

/* ─── Icon Button ────────────────────────────────────────────────────────────── */
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: background var(--t-fast), color var(--t-fast);
}
.icon-btn:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.icon-btn .material-symbols-rounded { font-size: 2rem; }

/* ─── Master Layout ──────────────────────────────────────────────────────────── */
.main-layout {
  max-width: 1440px;
  margin: 0 auto;
  padding: 88px 28px 40px;
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 28px;
  min-height: 100vh;
  align-items: start;
}

/* ─── Player Panel ───────────────────────────────────────────────────────────── */
.player-panel {
  position: sticky;
  top: 88px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

/* Artwork */
.artwork-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--prussian);
}
.artwork {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity var(--t-normal);
}
.artwork-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 45%, rgba(0,0,0,0.72) 100%);
  pointer-events: none;
}

/* Song info */
.song-info {
  padding: 18px 22px 6px;
}
.song-title {
  font-size: 1.7rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.song-artist {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Progress */
.progress-section { padding: 16px 22px 6px; }

.progress-bar {
  position: relative;
  height: 4px;
  cursor: pointer;
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: height var(--t-fast);
}
.progress-bar:hover { height: 6px; }

.progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: var(--radius-pill);
  transition: width 0.5s linear;
}
.progress-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  transition: transform var(--t-fast);
  pointer-events: none;
}
.progress-bar:hover .progress-thumb,
.progress-bar.seeking .progress-thumb { transform: translate(-50%, -50%) scale(1.25); }
.progress-bar.seeking { height: 6px; }

.time-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 1.1rem;
  color: var(--text-secondary);
}

/* Controls */
.controls-section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 14px 22px 10px;
}

.control-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
.control-btn:active { transform: scale(0.94); }

.play-pause-btn {
  width: 58px;
  height: 58px;
  background: var(--accent);
  color: var(--prussian);
  box-shadow: 0 4px 18px var(--accent-glow);
}
.play-pause-btn .material-symbols-rounded { font-size: 3.2rem; }
.play-pause-btn:hover {
  background: hsl(200, 100%, 79%);
  box-shadow: 0 6px 24px var(--accent-glow);
  transform: scale(1.04);
}

.skip-btn {
  width: 44px;
  height: 44px;
}
.skip-btn .material-symbols-rounded { font-size: 2.6rem; color: var(--text-secondary); }
.skip-btn:hover { background: rgba(255,255,255,0.07); }
.skip-btn:hover .material-symbols-rounded { color: var(--text-primary); }

/* Volume */
.volume-section {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 22px 22px;
}

.volume-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.12); /* overridden inline by JS */
  cursor: pointer;
  outline: none;
  transition: height var(--t-fast);
}
.volume-slider:hover { height: 6px; }
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 6px var(--accent-glow);
}
.volume-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}
.volume-value {
  font-size: 1.1rem;
  color: var(--text-secondary);
  min-width: 26px;
  text-align: right;
}

/* ─── Right Panel ────────────────────────────────────────────────────────────── */
.right-panel {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* ─── Search Bar ─────────────────────────────────────────────────────────────── */
.search-section { position: relative; }

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0 16px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.search-bar:focus-within {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.search-icon { font-size: 2.2rem !important; color: var(--text-secondary); flex-shrink: 0; }

.search-input {
  flex: 1;
  height: 52px;
  font-size: 1.45rem;
  color: var(--text-primary);
  caret-color: var(--accent);
}
.search-input::placeholder { color: var(--text-secondary); }

.search-clear { color: var(--text-secondary); }

/* Search results dropdown */
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--surface-raised);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  overflow: hidden;
  max-height: 380px;
  overflow-y: auto;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--t-fast);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover  { background: var(--surface-hover); }
.search-result-item:active { background: var(--accent-dim); }
.search-result-item.added  { background: var(--accent-dim); transition: background 0s; }

.result-thumb {
  width: 56px;
  height: 42px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--prussian);
}
.result-info { flex: 1; min-width: 0; }
.result-title {
  font-size: 1.35rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.result-artist {
  font-size: 1.2rem;
  color: var(--text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.result-duration {
  font-size: 1.1rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}


/* ─── Queue Section ──────────────────────────────────────────────────────────── */
.queue-section {
  background: var(--surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.queue-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.queue-header .material-symbols-rounded { font-size: 2.2rem; color: var(--accent); }
.queue-title { font-size: 1.5rem; flex: 1; }
.queue-count {
  font-size: 1.1rem;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.06);
  padding: 3px 11px;
  border-radius: var(--radius-pill);
}

.queue-list {
  max-height: 520px;
  overflow-y: auto;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 22px;
  border-bottom: 1px solid var(--border);
  transition: background var(--t-fast);
  position: relative;
}
.queue-item:last-child { border-bottom: none; }
.queue-item:not(.active):hover { background: rgba(255,255,255,0.03); }

.queue-item.active {
  background: var(--accent-dim);
  border-left: 3px solid var(--accent);
  padding-left: 19px; /* compensate for border */
}

.queue-num {
  font-size: 1.1rem;
  color: var(--text-secondary);
  min-width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.queue-thumb {
  width: 46px;
  height: 35px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--prussian);
}

.queue-info { flex: 1; min-width: 0; }
.queue-song-title {
  font-size: 1.3rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.queue-song-artist {
  font-size: 1.15rem;
  color: var(--text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.queue-item.active .queue-song-title { color: var(--accent); }

.queue-duration {
  font-size: 1.1rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* ─── EQ Bars (animated playing indicator) ───────────────────────────────────── */
.eq-bars {
  display: none;
  align-items: flex-end;
  gap: 2px;
  height: 16px;
  width: 20px;
  flex-shrink: 0;
}
.queue-item.active.playing .eq-bars  { display: flex; }
.queue-item.active.playing .queue-num { display: none; }

.eq-bar {
  width: 3px;
  border-radius: 2px;
  background: var(--accent);
  transform-origin: bottom;
  animation: eq-pulse 0.75s ease-in-out infinite alternate;
}
.eq-bar:nth-child(1) { height: 6px;  animation-delay: 0s;    }
.eq-bar:nth-child(2) { height: 14px; animation-delay: 0.18s; }
.eq-bar:nth-child(3) { height: 9px;  animation-delay: 0.36s; }

@keyframes eq-pulse {
  from { transform: scaleY(0.35); }
  to   { transform: scaleY(1);    }
}

/* ─── Empty Queue ────────────────────────────────────────────────────────────── */
.empty-queue {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 52px 24px;
  gap: 8px;
  color: var(--text-secondary);
  text-align: center;
}
.empty-queue .material-symbols-rounded { font-size: 4.2rem; opacity: 0.3; }
.empty-queue p     { font-size: 1.4rem; }
.empty-queue small { font-size: 1.2rem; opacity: 0.65; }

/* ─── Toast ──────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface-raised);
  color: var(--text-primary);
  font-size: 1.3rem;
  padding: 12px 26px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-hover);
  box-shadow: var(--shadow-md);
  white-space: nowrap;
  pointer-events: none;
  z-index: 200;
  transition: transform var(--t-normal);
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ─── Dude Layout ────────────────────────────────────────────────────────────── */
.dude-layout {
  max-width: 740px;
  margin: 0 auto;
  padding: 88px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.dude-search-section { position: relative; }

.dude-heading {
  font-size: 2.6rem;
  margin-bottom: 16px;
}

.search-bar.large {
  padding: 0 20px;
  border-radius: var(--radius-xl);
}
.search-bar.large .search-input {
  height: 62px;
  font-size: 1.6rem;
}
.search-bar.large .search-icon { font-size: 2.6rem !important; }

.dude-results {
  position: absolute;
  top: calc(100% + 10px);
  left: 0; right: 0;
}

.dude-queue .queue-list { max-height: none; }



/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .main-layout {
    grid-template-columns: 1fr;
    gap: 22px;
  }
  .player-panel {
    position: static;
    max-width: 480px;
    width: 100%;
    margin: 0 auto;
  }
}
