/* ─── Pass the Aux — Shared Components ─────────────────────────────────────── */
@import './variables.css';

/* ─── Top Nav / Session Header ───────────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  background: rgba(8, 12, 20, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.app-header .wordmark {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.app-header .wordmark span { color: var(--accent); }

.session-code-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  background: var(--accent-dim);
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-family: var(--font-mono);
}

/* ─── Queue Item ─────────────────────────────────────────────────────────────── */
.queue-item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius);
  transition: border-color var(--duration) var(--ease),
              transform var(--duration) var(--ease);
}
.queue-item:hover { border-color: var(--border); }

/* Host queue items have a drag handle prepended — add a column for it */
#host-queue-list .queue-item { grid-template-columns: auto 56px 1fr auto; }

.queue-item.is-playing {
  border-color: var(--green);
  box-shadow: 0 0 0 1px var(--green), var(--glow-green);
}

.queue-item.vote-flash {
  animation: vote-pulse 0.4s var(--ease);
}
@keyframes vote-pulse {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.02); border-color: var(--accent); }
  100% { transform: scale(1); }
}

.queue-item__art {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-elevated);
  flex-shrink: 0;
}

.queue-item__art.no-art {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 1.25rem;
}

.queue-item__info {
  overflow: hidden;
}
.queue-item__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.queue-item__meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.queue-item__message {
  font-size: 0.75rem;
  color: var(--accent);
  margin-top: 2px;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.queue-item__round-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--amber);
  background: var(--amber-dim);
  border: 1px solid rgba(255, 184, 48, 0.25);
  border-radius: var(--radius-full);
  padding: 2px 8px;
  display: inline-block;
  margin-top: 2px;
}

.queue-item__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* Vote buttons */
.vote-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: transparent;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  color: var(--text-muted);
}
.vote-btn:hover { color: var(--text); border-color: var(--text-muted); }
.vote-btn.up:hover   { border-color: var(--green); color: var(--green); background: var(--green-dim); }
.vote-btn.down:hover { border-color: var(--red);   color: var(--red);   background: var(--red-dim); }

/* Voted / already voted state */
.vote-btn.voted         { cursor: default; }
.vote-btn.voted-up      { border-color: var(--green); color: var(--green); background: var(--green-dim); }
.vote-btn.voted-down    { border-color: var(--red);   color: var(--red);   background: var(--red-dim); }
.vote-btn.voted:hover,
.vote-btn.voted-up:hover   { border-color: var(--green); color: var(--green); background: var(--green-dim); }
.vote-btn.voted-down:hover { border-color: var(--red);   color: var(--red);   background: var(--red-dim); }

/* ─── Help button (footer) ───────────────────────────────────────────────────── */
.btn-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 0.8125rem;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  flex-shrink: 0;
}
.btn-help:hover { color: var(--accent); border-color: var(--accent); }

/* ─── Help modal rows ────────────────────────────────────────────────────────── */
.help-row {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
}
.help-row__icon {
  font-size: 1.25rem;
  width: 32px;
  flex-shrink: 0;
  text-align: center;
  padding-top: 1px;
}
.help-row__title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-1);
}

.remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.875rem;
  transition: all var(--duration) var(--ease);
}
.remove-btn:hover { color: var(--red); background: var(--red-dim); }

/* ─── Playing indicator (waveform bars) ──────────────────────────────────────── */
.playing-indicator {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 16px;
}
.playing-indicator span {
  width: 3px;
  background: var(--green);
  border-radius: 2px;
  animation: bar-bounce 1.2s ease-in-out infinite;
}
.playing-indicator span:nth-child(1) { animation-delay: 0s;    height: 8px; }
.playing-indicator span:nth-child(2) { animation-delay: 0.2s;  height: 14px; }
.playing-indicator span:nth-child(3) { animation-delay: 0.1s;  height: 10px; }
.playing-indicator span:nth-child(4) { animation-delay: 0.3s;  height: 6px; }

@keyframes bar-bounce {
  0%, 100% { transform: scaleY(0.5); }
  50%       { transform: scaleY(1.2); }
}

/* ─── Search result item ─────────────────────────────────────────────────────── */
.search-result {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--duration) var(--ease);
}
.search-result:hover { background: var(--bg-elevated); }
.search-result.in-queue { opacity: 0.45; cursor: default; }
.search-result.explicit-blocked { opacity: 0.3; cursor: not-allowed; }

.search-result__art {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-elevated);
}
.search-result__info { overflow: hidden; }
.search-result__name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-result__meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-result__add-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--accent-dim);
  border: 1px solid rgba(0, 212, 255, 0.3);
  color: var(--accent);
  font-size: 1.125rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  flex-shrink: 0;
}
.search-result__add-btn:hover {
  background: var(--accent);
  color: var(--bg);
  box-shadow: var(--glow-accent);
}

/* ─── Credits pill ───────────────────────────────────────────────────────────── */
.credits-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--amber-dim);
  border: 1px solid rgba(255, 184, 48, 0.25);
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--amber);
}

.credits-pill.low {
  background: var(--red-dim);
  border-color: rgba(255, 69, 96, 0.3);
  color: var(--red);
  animation: credit-pulse 1.5s ease-in-out infinite;
}
@keyframes credit-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

/* ─── Add song modal / sheet ─────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade-in var(--duration) var(--ease);
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-sheet {
  width: 100%;
  max-width: 560px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-6);
  animation: sheet-up var(--duration-slow) var(--ease);
}
@keyframes sheet-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

/* Desktop: center as a dialog */
@media (min-width: 600px) {
  .modal-backdrop { align-items: center; }
  .modal-sheet {
    border-radius: var(--radius-xl);
    max-height: 90vh;
    overflow-y: auto;
  }
}

/* ─── Toggle switch ──────────────────────────────────────────────────────────── */
.toggle {
  appearance: none;
  width: 44px;
  height: 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  position: relative;
  transition: background var(--duration) var(--ease);
  flex-shrink: 0;
}
.toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform var(--duration) var(--ease), background var(--duration) var(--ease);
}
.toggle:checked {
  background: var(--accent-dim);
  border-color: var(--accent);
}
.toggle:checked::after {
  background: var(--accent);
  transform: translateX(20px);
}

/* ─── Empty state ────────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-6);
  text-align: center;
  gap: var(--space-3);
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 2.5rem; opacity: 0.4; }
.empty-state h3 { color: var(--text); font-size: 1rem; }
.empty-state p  { font-size: 0.875rem; max-width: 280px; }
