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

html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0f0f0f;
  color: #f1f1f1;
  -webkit-text-size-adjust: 100%;
}

/* ─── App Layout ────────────────────────────────────────── */
#app {
  display: flex;
  height: 100dvh;
  width: 100vw;
}

#queue-panel {
  width: 460px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.divider { width: 1px; background: #1f1f1f; flex-shrink: 0; }

#search-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px 18px;
  gap: 14px;
  overflow: hidden;
  min-width: 0;
}

/* ─── YouTube Player ────────────────────────────────────── */
#player-container { flex-shrink: 0; background: #000; }

#yt-player { width: 100%; aspect-ratio: 16 / 9; display: block; }

/* ─── Queue Content ─────────────────────────────────────── */
#queue-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
  overflow-y: auto;
}

.section-label {
  font-size: 10px;
  font-weight: 600;
  color: #717171;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* ─── Now Playing Card ──────────────────────────────────── */
.now-playing-card {
  background: #181818;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.now-playing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.skip-btn {
  background: none;
  border: none;
  color: #555;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s;
}
.skip-btn:hover { color: #f1f1f1; }

.label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.label.playing { color: #f06292; }
.label.next-up  { color: #00c853; }

.song-title {
  font-size: 14px;
  font-weight: 600;
  color: #f1f1f1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-artist { font-size: 11px; color: #717171; }

.progress-bar {
  background: #2a2a2a;
  border-radius: 2px;
  height: 3px;
  margin-top: 8px;
}

.progress-fill {
  background: #f06292;
  height: 3px;
  border-radius: 2px;
  width: 0%;
  transition: width 1s linear;
}

.progress-time { font-size: 10px; color: #555; text-align: right; margin-top: 3px; }

/* ─── Countdown Card ────────────────────────────────────── */
.countdown-card {
  background: #1f0d14;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  flex-shrink: 0;
}

.countdown-number {
  font-size: 48px;
  font-weight: 800;
  color: #00c853;
  line-height: 1;
  margin-top: 8px;
}

/* ─── Empty State ───────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 12px;
  color: #555;
  padding: 40px 20px;
  text-align: center;
}

.empty-state .mic-icon { font-size: 36px; opacity: 0.3; }
.empty-state p { font-size: 13px; line-height: 1.5; }

/* ─── Queue List ────────────────────────────────────────── */
#queue-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }

.queue-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-radius: 8px;
}

.queue-item:first-child { background: #181818; }

.drag-handle {
  color: #444;
  font-size: 16px;
  cursor: grab;
  padding: 2px 4px;
  flex-shrink: 0;
  user-select: none;
  line-height: 1;
  touch-action: none;
}
.drag-handle:active { cursor: grabbing; }

.queue-item-info { flex: 1; min-width: 0; }

.item-title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-artist { font-size: 11px; color: #444; margin-top: 2px; }

/* Fade items by depth */
.queue-item:nth-child(1) .item-title { color: #f1f1f1; }
.queue-item:nth-child(2) .item-title { color: #b0b0b0; }
.queue-item:nth-child(3) .item-title { color: #888; }
.queue-item:nth-child(n+4) .item-title { color: #666; }

.remove-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #1f1f1f;
  border: none;
  color: #555;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.remove-btn:hover { background: #2a2a2a; color: #f1f1f1; }

/* ─── Search Bar ────────────────────────────────────────── */
.search-bar-wrapper {
  display: flex;
  align-items: center;
  background: #212121;
  border-radius: 24px;
  padding: 11px 18px;
  gap: 10px;
  flex-shrink: 0;
}

.search-bar-wrapper svg { flex-shrink: 0; }

#search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 14px;
  color: #f1f1f1;
  font-family: inherit;
}
#search-input::placeholder { color: #717171; }

/* ─── Search Results ────────────────────────────────────── */
#search-results {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.result-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-shrink: 0;
}

.result-thumb {
  width: 112px;
  height: 63px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: #272727;
}
.result-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.result-info { flex: 1; min-width: 0; }

.result-title {
  font-size: 13px;
  font-weight: 500;
  color: #f1f1f1;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result-channel { font-size: 11px; color: #717171; margin-top: 3px; }

.add-btn {
  background: #f06292;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
  font-family: inherit;
  transition: background 0.15s;
}
.add-btn:hover { background: #e0507a; }
.add-btn.added { background: #2a2a2a; color: #717171; cursor: default; }

/* ─── Toast ─────────────────────────────────────────────── */
.toast {
  background: #0d2a0d;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  color: #81c784;
  font-weight: 500;
  flex-shrink: 0;
}
.toast.hidden { display: none; }
