/* ===== Shared Styles ===== */
@import url('https://fonts.googleapis.com/css2?family=Pacifico&family=Playfair+Display:wght@700;900&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg-dark: #141211;
  --bg-card: #1e1c1a;
  --bg-card-hover: #2a2725;
  --text-primary: #f5efe6;
  --text-secondary: #a89e93;
  --accent-amber: #d4851f;
  --accent-ember: #c0392b;
  --accent-gold: #e6a817;
  --accent-warm: #e8723a;
  --border-subtle: rgba(212, 133, 31, 0.15);
  --border-glow: rgba(212, 133, 31, 0.4);
  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', -apple-system, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--bg-dark);
  color: var(--text-primary);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Subtle noise texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
}

/* ===== TV Page ===== */
.tv-container {
  width: 100vw;
  height: 100vh;
  position: relative;
  background: #000;
  overflow: hidden;
}

.tv-player {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}

.tv-player iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.tv-logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
  vertical-align: middle;
  margin-right: 0.75rem;
  border-radius: 10px;
}

.tv-idle {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-dark);
  z-index: 10;
  transition: opacity 0.8s ease;
  cursor: pointer;
}

.tv-idle.hidden {
  opacity: 0;
  pointer-events: none;
}

.tv-idle h1 {
  font-family: 'Pacifico', cursive;
  font-size: 5rem;
  font-weight: 400;
  color: var(--accent-amber);
  text-shadow: 0 0 40px rgba(212, 133, 31, 0.3);
  margin-bottom: 1rem;
}

.tv-idle p {
  font-size: 1.5rem;
  color: var(--text-secondary);
  margin-bottom: 3rem;
}

.tv-idle .qr-container {
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
}

.tv-idle .qr-container img {
  width: 200px;
  height: 200px;
}

.tv-idle .scan-text {
  margin-top: 1.5rem;
  font-size: 1.2rem;
  color: var(--accent-gold);
}

/* Overlay on video */
.tv-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  opacity: 1;
  transition: opacity 0.5s ease;
}

.tv-overlay.fade-out {
  opacity: 0;
}

.tv-now-playing {
  flex: 1;
}

.tv-now-playing .label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent-amber);
  margin-bottom: 0.3rem;
}

.tv-now-playing .title {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  max-width: 60vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tv-now-playing .added-by {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

.tv-up-next {
  text-align: right;
  margin-left: 2rem;
}

.tv-up-next .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}

.tv-up-next .title {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 25vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tv-qr-corner {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 20;
}

.tv-qr-corner img {
  width: 140px;
  height: auto;
  border-radius: 6px;
}

.tv-qr-corner .qr-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.tv-qr-corner .qr-label strong {
  color: var(--accent-gold);
  display: block;
}

.tv-queue-count {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  z-index: 20;
  background: rgba(0, 0, 0, 0.6);
  padding: 0.6rem 1rem;
  border-radius: 8px;
  backdrop-filter: blur(8px);
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: opacity 0.5s ease;
}

.tv-queue-count.fade-out {
  opacity: 0;
}

.tv-queue-count span {
  color: var(--accent-amber);
  font-weight: 600;
}

/* Karaoke Splash */
.karaoke-splash {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-dark);
  z-index: 30;
  transition: opacity 0.5s ease;
}

.karaoke-splash.hidden {
  opacity: 0;
  pointer-events: none;
}

.karaoke-label {
  font-family: 'Pacifico', cursive;
  font-size: 2rem;
  color: var(--accent-gold);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  margin-bottom: 1rem;
}

.karaoke-singer {
  font-family: 'Pacifico', cursive;
  font-size: 5rem;
  color: var(--text-primary);
  text-shadow: 0 0 40px rgba(230, 168, 23, 0.4);
  margin-bottom: 0.5rem;
}

.karaoke-song {
  font-family: var(--font-body);
  font-size: 1.5rem;
  color: var(--text-secondary);
  max-width: 60vw;
  text-align: center;
}

.karaoke-countdown {
  margin-top: 2rem;
  font-size: 1.2rem;
  color: var(--accent-amber);
}

/* ===== Guest Page ===== */
.guest-container {
  max-width: 480px;
  margin: 0 auto;
  padding: 1rem;
  min-height: 100vh;
  padding-bottom: 6rem;
}

.guest-header {
  text-align: center;
  padding: 1.5rem 0 1rem;
}

.guest-header h1 {
  font-family: 'Pacifico', cursive;
  font-size: 2rem;
  font-weight: 400;
  color: var(--accent-amber);
  text-shadow: 0 0 20px rgba(212, 133, 31, 0.2);
}

.guest-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  vertical-align: middle;
  margin-right: 0.4rem;
  border-radius: 6px;
}

.guest-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* Mode Toggle */
.mode-toggle {
  display: flex;
  background: var(--bg-card);
  border: 2px solid var(--border-subtle);
  border-radius: 14px;
  padding: 5px;
  margin-bottom: 1.25rem;
  gap: 5px;
}

.mode-btn {
  flex: 1;
  padding: 0.85rem 1rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}

.mode-btn.active {
  background: var(--accent-amber);
  color: var(--bg-dark);
  box-shadow: 0 2px 8px rgba(212, 133, 31, 0.4);
}

.mode-btn:not(.active) {
  background: var(--bg-card-hover);
}

.mode-btn:not(.active):active {
  background: rgba(212, 133, 31, 0.15);
}

/* Now Playing Bar */
.now-playing-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.skip-btn {
  flex-shrink: 0;
  background: var(--accent-ember);
  color: var(--text-primary);
  border: none;
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.skip-btn:active {
  background: #e74c3c;
}

.clear-queue-btn {
  float: right;
  background: none;
  border: 1px solid var(--accent-ember);
  color: var(--accent-ember);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.15s;
}

.clear-queue-btn:active {
  background: var(--accent-ember);
  color: var(--text-primary);
}

.now-playing-bar .pulse {
  width: 10px;
  height: 10px;
  background: var(--accent-ember);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.now-playing-bar .np-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-amber);
}

.now-playing-bar .np-title {
  font-size: 0.85rem;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.now-playing-bar.empty {
  justify-content: center;
}

.now-playing-bar.empty .np-title {
  color: var(--text-secondary);
  font-style: italic;
}

/* Search */
.search-section {
  margin-bottom: 1.5rem;
}

.search-box {
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 2.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 1rem;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.2s;
}

.search-box input::placeholder {
  color: var(--text-secondary);
}

.search-box input:focus {
  border-color: var(--border-glow);
}

.search-box .search-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-size: 1.1rem;
  pointer-events: none;
}

.search-results {
  margin-top: 0.75rem;
}

.search-result {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.search-result:active {
  background: var(--bg-card-hover);
  border-color: var(--border-glow);
}

.search-result img {
  width: 72px;
  height: 54px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

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

.search-result .sr-title {
  font-size: 0.85rem;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-warning {
  background: linear-gradient(135deg, rgba(192, 57, 43, 0.25), rgba(230, 168, 23, 0.15));
  border: 2px solid var(--accent-ember);
  color: #ff6b6b;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  margin-bottom: 0.75rem;
  text-align: center;
  line-height: 1.4;
  animation: warningPulse 2s infinite;
}

@keyframes warningPulse {
  0%, 100% { border-color: var(--accent-ember); box-shadow: 0 0 8px rgba(192, 57, 43, 0.3); }
  50% { border-color: #ff6b6b; box-shadow: 0 0 16px rgba(255, 107, 107, 0.4); }
}

.search-result .sr-add {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-amber);
  border: none;
  color: var(--bg-dark);
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  line-height: 1;
  padding: 0;
  text-align: center;
}

.search-result .sr-add:active {
  background: var(--accent-gold);
}

.search-result .sr-add.added {
  background: #2d6a30;
  color: white;
  font-size: 0.9rem;
}

.search-loading {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Queue */
.queue-section h2 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.queue-section h2 .count {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.queue-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-style: italic;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  margin-bottom: 0.5rem;
}

.queue-item.is-current {
  border-color: var(--accent-amber);
  background: rgba(212, 133, 31, 0.08);
}

.queue-item .qi-position {
  font-size: 0.75rem;
  color: var(--text-secondary);
  width: 1.5rem;
  text-align: center;
  flex-shrink: 0;
}

.queue-item.is-current .qi-position {
  color: var(--accent-amber);
}

.queue-item img {
  width: 56px;
  height: 42px;
  border-radius: 5px;
  object-fit: cover;
  flex-shrink: 0;
}

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

.queue-item .qi-title {
  font-size: 0.8rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item .qi-by {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.queue-item .qi-remove {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.3rem;
  opacity: 0.5;
  transition: opacity 0.15s;
}

.queue-item .qi-remove:active {
  opacity: 1;
  color: var(--accent-ember);
}

/* Name input */
.name-section {
  margin-bottom: 1rem;
}

.name-input {
  width: 100%;
  padding: 0.65rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.2s;
}

.name-input:focus {
  border-color: var(--border-glow);
}

.name-input::placeholder {
  color: var(--text-secondary);
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-card);
  border: 1px solid var(--accent-amber);
  color: var(--text-primary);
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-size: 0.85rem;
  z-index: 100;
  transition: transform 0.3s ease;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}
