/* Public/show skin: projector displays, singer's teleprompter and the
   audience's phone. One visual language across all three
   (docs/tienes-kara-o-ke-diseno.md): cinematic, bold, readable from
   across a room. staff.css is the deliberately plainer counterpart. */
@import url('brand.css');

.public-app {
  min-height: 100vh;
  background: var(--stage-glow), var(--bg);
  background-attachment: fixed;
  color: var(--text);
}

.public-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
}

.public-logo { height: 56px; width: auto; }
.status-header .public-logo { width: clamp(130px, 13vw, 230px); height: auto; }

.vote-ranking {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}
.stage-main .vote-ranking { margin-top: 0; }
.vote-ranking__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: var(--space-3) 0 0;
  padding: 0;
  list-style: none;
}
.vote-ranking__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: color-mix(in srgb, var(--bg-elevated) 82%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.vote-ranking__position {
  min-width: 1.4rem;
  color: var(--brand-orange);
  font-family: var(--font-display);
  font-size: 1.35rem;
  text-align: center;
}
.vote-ranking__song { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.vote-ranking__song strong,
.vote-ranking__song small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vote-ranking__song small,
.vote-ranking__score small { color: var(--text-muted); font-size: 0.76rem; }
.vote-ranking__score { color: var(--accent-gold); font-weight: 800; text-align: right; white-space: nowrap; }
.vote-ranking__score small { display: block; font-weight: 400; }

/* Generic primitives (card/btn/input) - staff.css has its own compact,
   utilitarian versions of these same class names; this skin intentionally
   renders them bolder/rounder/animated instead of sharing one definition,
   per the two-visual-languages brief. */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-soft);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--touch-min);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  background: var(--bg-muted);
  color: var(--text);
  text-decoration: none;
  transition: transform var(--transition-fast) ease, background var(--transition-fast) ease, border-color var(--transition-fast) ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--brand-gradient); color: #fff; border-color: transparent; }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg-muted); border-color: var(--text-subtle); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-danger { background: transparent; border-color: var(--state-error); color: var(--state-error); }
/* Still the minimum touch target - "small" here means narrower, not
   shorter, since these appear on phones (docs §12). */
.btn-sm { min-height: var(--touch-min); padding: var(--space-2) var(--space-3); font-size: 0.9em; }

.input {
  width: 100%;
  min-height: 48px;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  transition: border-color var(--transition-fast) ease;
}
.input::placeholder { color: var(--text-subtle); }
.input:focus { outline: none; border-color: var(--brand-orange); }

.field-label {
  display: block;
  margin-bottom: var(--space-2);
  font-weight: 600;
  font-size: 0.95rem;
}

/* ---- Stage typography -------------------------------------------------
   Read from across a room. Hierarchy per docs §16: song and singer first,
   everything else after. Bebas Neue is uppercase-only by design. */
.stage-eyebrow {
  font-family: var(--font-sans);
  font-size: clamp(0.75rem, 1.1vw, 1rem);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0;
}

.stage-title {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.01em;
  font-weight: 400;
  font-size: clamp(2.25rem, 6vw, 5.5rem);
  line-height: 0.95;
  margin: 0;
  color: var(--text);
}

/* The singer's name - the single most prominent thing on a public
   screen (docs §7: "más visible que el QR"). */
.stage-name {
  font-family: var(--font-display);
  text-transform: uppercase;
  font-weight: 400;
  font-size: clamp(3rem, 9vw, 8rem);
  line-height: 0.9;
  margin: 0;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stage-subtitle {
  font-size: clamp(1rem, 2vw, 1.6rem);
  color: var(--text-muted);
  margin: var(--space-2) 0 0;
}

/* The singer's name when the song title is the headline (lyrics wall).
   Big and brand-coloured so it still carries across the room. */
.stage-singer {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.01em;
  font-weight: 400;
  font-size: clamp(1.75rem, 3.6vw, 3.25rem);
  line-height: 1;
  margin: var(--space-2) 0 0;
  color: var(--brand-orange);
}

.stage-meta {
  font-size: clamp(0.9rem, 1.5vw, 1.25rem);
  color: var(--text-subtle);
  margin: var(--space-1) 0 0;
}

/* ---- SongRow: Spotify-style compact row, not a heavy card (docs §5) --- */
.song-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  min-height: 60px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition-fast) ease;
}
.song-row:last-child { border-bottom: none; }
.song-row:hover, .song-row:focus-visible { background: var(--bg-muted); }
.song-row.is-selected {
  background: var(--bg-muted);
  box-shadow: inset 3px 0 0 0 var(--brand-red);
}
.song-row__icon { color: var(--text-muted); flex-shrink: 0; font-size: 1.1rem; }
/* Explicit block/flex: these are <span>s, so without this the title and
   artist run together on one line whenever the title is short. */
.song-row__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.song-row__title {
  display: block;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.song-row__artist {
  display: block;
  color: var(--text-muted);
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.song-row__action {
  flex-shrink: 0;
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.25rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
}
.song-row__action:hover { background: var(--bg-subtle); color: var(--text); }

/* Scrollable catalog container */
.song-list {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.song-list--scroll { max-height: 52vh; overflow-y: auto; }

/* ---- QueueList: numbered upcoming performances ----------------------- */
.queue-list { display: flex; flex-direction: column; gap: var(--space-2); }

.queue-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.queue-item__pos {
  flex-shrink: 0;
  width: 34px; height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--brand-gradient);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
}
.queue-item__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.queue-item__title { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-item__singer { display: block; color: var(--text-muted); font-size: 0.9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Legacy alias still used by some display markup. */
.queue-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

/* ---- QRPanel --------------------------------------------------------- */
.qr-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}
/* The QR itself needs a real white quiet zone to scan reliably, so this
   stays white in both themes on purpose. */
.qr-panel__code {
  background: #fff;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  line-height: 0;
}
.qr-panel__label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
}

/* ---- VoteButton ------------------------------------------------------ */
.vote-row { display: flex; align-items: center; gap: var(--space-1); }
.vote-star {
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text-subtle);
  border-radius: var(--radius-pill);
  transition: transform var(--transition-fast) ease;
}
.vote-star.is-on { color: var(--accent-gold); }
.vote-star:hover { transform: scale(1.12); }
.vote-star:disabled { cursor: default; transform: none; }
.vote-star.just-voted { animation: vote-pop 420ms cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes vote-pop {
  0% { transform: scale(1); }
  45% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* ---- MobileTabBar (docs §5) ------------------------------------------ */
.tab-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: flex;
  min-height: 72px;
  background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tab-bar__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--touch-min);
  padding: var(--space-2);
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  border-top: 2px solid transparent;
  transition: color var(--transition-fast) ease;
}
.tab-bar__item .icon { font-size: 1.3rem; line-height: 1; }
.tab-bar__item[aria-current='page'] {
  color: var(--text);
  border-top-color: var(--brand-orange);
}
/* Pages with a tab bar must reserve room so the last row isn't hidden
   behind it (docs §12). */
.has-tab-bar { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }

/* ---- EmptyState ------------------------------------------------------ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-10) var(--space-5);
  text-align: center;
  color: var(--text-muted);
}
.empty-state__icon { font-size: 2.5rem; opacity: 0.65; }
.empty-state__title { font-weight: 700; color: var(--text); font-size: 1.05rem; }
.empty-state__hint { font-size: 0.9rem; color: var(--text-subtle); max-width: 34ch; }

/* ---- Toasts ---------------------------------------------------------- */
.toast-stack {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--bg-muted);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-raised);
  font-weight: 600;
  animation: toast-in 220ms ease-out;
}
.toast--success { border-color: var(--state-success); }
.toast--error { border-color: var(--state-error); }
@keyframes toast-in {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ---- Lyrics ---------------------------------------------------------- */
.lyrics-line { transition: color var(--transition-base) ease, opacity var(--transition-base) ease; }
.lyrics-line--past { color: var(--text-subtle); opacity: 0.45; }
.lyrics-line--next { color: var(--text-muted); }
.lyrics-line--active { color: var(--text); font-weight: 600; }
.lyrics-chord {
  color: var(--accent-gold);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.8em;
}

/* ---- Song-change transition overlay ---------------------------------- */
.transition-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  /* Near-opaque plus a blur: at this text size the old 0.94 let the
     previous singer's name ghost through behind the new one. */
  background: rgba(9, 12, 22, 0.985);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  z-index: 100;
}
/* Quick fade in, long readable hold, quick fade out. js/celebrate.js
   reads this duration off the element rather than hardcoding its own
   copy, so the two can't drift apart - change it here only. */
.transition-overlay {
  --transition-duration: 20s;
}
.transition-overlay.is-active {
  opacity: 1;
  animation: overlay-fade var(--transition-duration) ease forwards;
}
@keyframes overlay-fade {
  0% { opacity: 0; }
  3% { opacity: 1; }
  96% { opacity: 1; }
  100% { opacity: 0; }
}
/* The pop stays snappy on its own timeline rather than being stretched
   across the whole hold. */
.transition-overlay .stage-title,
.transition-overlay .stage-name {
  transform: scale(0.85);
  animation: overlay-pop 900ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes overlay-pop {
  0% { transform: scale(0.7); opacity: 0; }
  55% { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
/* The name is the whole point of this overlay, so it goes as large as
   the viewport allows. */
.transition-overlay .stage-name {
  font-size: clamp(3.5rem, 13vw, 12rem);
  margin: var(--space-3) 0 0;
  /* Long names must wrap instead of running off the projector. */
  max-width: 100%;
  overflow-wrap: anywhere;
  line-height: 0.92;
}
.transition-overlay .stage-title {
  font-size: clamp(1.5rem, 3.5vw, 3rem);
  color: var(--text-muted);
  margin: var(--space-4) 0 0;
}

.celebration-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background: rgba(9, 12, 22, 0.97);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  z-index: 250;
  --celebration-duration: 5000ms;
}
.celebration-overlay.is-active {
  opacity: 1;
  animation: celebration-fade var(--celebration-duration) ease forwards;
}
.celebration-message {
  margin: 0;
  color: #fff;
  font-family: var(--font-display);
  font-size: clamp(4rem, 13vw, 12rem);
  font-weight: 400;
  line-height: 0.9;
  text-align: center;
  text-wrap: balance;
  animation: celebration-pop 900ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes celebration-fade {
  0% { opacity: 0; }
  5%, 92% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes celebration-pop {
  0% { transform: scale(0.65) rotate(-3deg); opacity: 0; }
  55% { transform: scale(1.08) rotate(1deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* "You're up next" alert - singer's screen, mirrored on public display. */
.turn-alert {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  background: var(--brand-gradient);
  color: #fff;
  z-index: 200;
  animation: turn-alert-in 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes turn-alert-in {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.turn-alert .stage-title, .turn-alert .stage-name {
  color: #fff;
  background: none;
  -webkit-text-fill-color: #fff;
  animation: turn-alert-pulse 1.1s ease-in-out infinite;
}
@keyframes turn-alert-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

/* Celebration burst on song completion - see web/js/celebrate.js. */
.confetti-piece {
  position: fixed;
  top: -10px;
  width: 8px;
  height: 14px;
  opacity: 0.9;
  z-index: 300;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  to { transform: translateY(110vh) rotate(540deg); opacity: 0; }
}

/* ---- Mobile signup flow ---------------------------------------------- */
.signup-form {
  max-width: 520px;
  margin: 0 auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.song-search { position: relative; }
.song-search input {
  width: 100%;
  min-height: 52px;
  font-size: 1.05rem;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
}
.song-search input:focus { outline: none; border-color: var(--brand-orange); }

/* Legacy names kept so existing markup keeps rendering while pages are
   migrated to .song-list / .song-row. */
.song-results {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.song-result-item {
  padding: var(--space-3) var(--space-4);
  min-height: 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.song-result-item:hover, .song-result-item:focus { background: var(--bg-muted); }
.song-result-item .title { font-weight: 600; }
.song-result-item .artist { color: var(--text-muted); font-size: 0.875em; }
.song-result-item.is-selected { background: var(--bg-muted); box-shadow: inset 3px 0 0 0 var(--brand-red); }
.song-catalog { margin-top: var(--space-3); max-height: 52vh; overflow-y: auto; }

.public-btn {
  min-height: 56px;
  border-radius: var(--radius-md);
  border: none;
  font-weight: 700;
  font-size: 1.05rem;
  background: var(--brand-gradient);
  color: #fff;
  cursor: pointer;
  transition: transform var(--transition-fast) ease;
}
.public-btn:active { transform: translateY(1px); }
.public-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-3);
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-muted);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.badge-live { background: color-mix(in srgb, var(--brand-red) 22%, transparent); color: var(--brand-red); border-color: transparent; }
.badge-done { background: color-mix(in srgb, var(--state-success) 18%, transparent); color: var(--state-success); border-color: transparent; }

/* Offline indicator (docs §11) */
.connection-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 500;
  padding: var(--space-2) var(--space-4);
  text-align: center;
  font-size: 0.875rem;
  font-weight: 600;
  background: var(--state-warning);
  color: #1a1200;
}

@media (max-width: 600px) {
  .public-header { padding: var(--space-3) var(--space-4); }
  .public-logo { height: 40px; }
}
