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

:root {
  --bg-dark: #06060c;
  --bg-card: #10101c;
  --bg-surface: #161625;
  --text-primary: #eeeef4;
  --text-secondary: #7a7a9e;
  --accent-green: #1DB954;
  --accent-green-light: #1ed760;
  --accent-pink: #ff2d8a;
  --accent-purple: #a855f7;
  --accent-blue: #38bdf8;
  --gradient-neon: linear-gradient(135deg, #ff2d8a, #a855f7, #38bdf8, #1DB954);
  --gradient-green: linear-gradient(180deg, #1DB954, #1ed760);
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-glow: 0 0 60px -10px rgba(168, 85, 247, 0.3);
}

html, body {
  width: 100%;
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

/* Allow scrolling on admin pages */
body.admin-body {
  overflow: auto;
}

/* ===== Screens ===== */
.screen {
  display: none;
  position: fixed;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.screen.active {
  display: flex;
}

/* ===== Welcome Screen ===== */
.welcome-container {
  text-align: center;
  padding: 2rem;
  position: relative;
  z-index: 1;
}

#screen-welcome {
  background:
    radial-gradient(ellipse at 20% 50%, rgba(168, 85, 247, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 50%, rgba(255, 45, 138, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 100%, rgba(29, 185, 84, 0.05) 0%, transparent 50%),
    var(--bg-dark);
}

#screen-welcome::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='1' cy='1' r='1' fill='%23ffffff08'/%3E%3C/svg%3E");
  pointer-events: none;
}

.title-glow {
  font-size: clamp(3rem, 12vw, 5rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  background: var(--gradient-neon);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 5s ease infinite;
  margin-bottom: 0.4rem;
  filter: drop-shadow(0 0 30px rgba(168, 85, 247, 0.25));
}

@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 3rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  font-weight: 500;
}

/* ===== Buttons ===== */
.btn-primary {
  position: relative;
  background: var(--gradient-neon);
  background-size: 200% 200%;
  color: #fff;
  border: none;
  padding: 1rem 2.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: 50px;
  cursor: pointer;
  letter-spacing: 0.04em;
  animation: gradient-shift 5s ease infinite;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s;
  box-shadow: 0 4px 20px -4px rgba(168, 85, 247, 0.35);
}

.btn-primary:active {
  transform: scale(0.95);
}

.btn-primary:hover {
  box-shadow: 0 6px 30px -4px rgba(168, 85, 247, 0.5);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--accent-green);
  border: 2px solid rgba(29, 185, 84, 0.4);
  padding: 0.8rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.25s;
  margin-bottom: 1rem;
  backdrop-filter: blur(4px);
}

.btn-secondary:hover {
  background: rgba(29, 185, 84, 0.1);
  border-color: var(--accent-green);
  box-shadow: 0 0 20px -4px rgba(29, 185, 84, 0.3);
}

/* ===== Scanner Screen ===== */
.scanner-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 1.5rem 1.5rem 2.5rem;
  text-align: center;
  z-index: 10;
  background: linear-gradient(to bottom, rgba(6, 6, 12, 0.95), transparent);
}

.scanner-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.04em;
}

#qr-reader {
  width: 100%;
  height: 100%;
}

#qr-reader video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

/* Hide html5-qrcode default UI elements */
#qr-reader__scan_region {
  min-height: 100vh !important;
}

#qr-reader__scan_region > img,
#qr-reader__dashboard,
#qr-reader__dashboard_section,
#qr-reader__dashboard_section_swaplink,
#qr-reader__status_span,
#qr-reader__header_message {
  display: none !important;
}

.scanner-hint {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
  z-index: 10;
  background: linear-gradient(to top, rgba(6, 6, 12, 0.95) 30%, transparent);
  padding: 3rem 1rem 2rem;
  letter-spacing: 0.02em;
}

/* ===== Playback Screen ===== */
#screen-playback {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(29, 185, 84, 0.06) 0%, transparent 60%),
    var(--bg-dark);
}

.playback-container {
  text-align: center;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

/* Vinyl disc */
.vinyl-icon {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, transparent 18%, #1a1a1a 19%, #222 21%, transparent 22%),
    radial-gradient(circle at 50% 50%, transparent 38%, #1a1a1a 39%, #252525 41%, transparent 42%),
    radial-gradient(circle at 50% 50%, transparent 58%, #1a1a1a 59%, #222 61%, transparent 62%),
    conic-gradient(from 0deg, #1a1a1a, #2a2a2a, #1a1a1a, #2a2a2a, #1a1a1a, #2a2a2a, #1a1a1a);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: spin 2.5s linear infinite;
  box-shadow:
    0 0 0 3px #111,
    0 0 40px -8px rgba(29, 185, 84, 0.25),
    inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.vinyl-disc {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle, #1ed760, #1DB954);
  box-shadow: 0 0 15px rgba(29, 185, 84, 0.5);
  border: 3px solid #111;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Visualizer */
.visualizer {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  height: 90px;
  width: 100%;
  max-width: 340px;
}

.visualizer .bar {
  flex: 1;
  min-width: 6px;
  max-width: 10px;
  border-radius: 5px 5px 0 0;
  background: var(--gradient-green);
  transition: height 0.12s ease-out;
  opacity: 0.85;
}

.playback-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 500;
}

/* ===== Admin Styles ===== */
.admin-wrapper {
  min-height: 100vh;
  padding: 1.5rem;
  overflow-y: auto;
  max-width: 900px;
  margin: 0 auto;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.admin-header h1 {
  font-size: 1.4rem;
  background: var(--gradient-neon);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 5s ease infinite;
  font-weight: 800;
}

.admin-section {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: var(--shadow-glow);
  transition: border-color 0.3s;
}

.admin-section:hover {
  border-color: rgba(255, 255, 255, 0.08);
}

.admin-section h2 {
  font-size: 1.05rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* Login form */
.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(168, 85, 247, 0.06) 0%, transparent 60%),
    var(--bg-dark);
}

.login-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 360px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  text-align: center;
  box-shadow: var(--shadow-glow);
}

.login-box h1 {
  font-size: 2.2rem;
  margin-bottom: 0.4rem;
  background: var(--gradient-neon);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 5s ease infinite;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.login-box p {
  color: var(--text-secondary);
  margin-bottom: 1.8rem;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.input-field {
  width: 100%;
  padding: 0.9rem 1.2rem;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 1rem;
  margin-bottom: 1rem;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.input-field:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.1);
}

.login-error {
  color: #f43f5e;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  min-height: 1.2em;
}

.flash-msg {
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 0.8rem 1.2rem;
  margin-bottom: 1rem;
  color: var(--accent-green);
  font-size: 0.9rem;
}

.login-title {
  font-size: 2.2rem;
  margin-bottom: 0.4rem;
  background: var(--gradient-neon);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 5s ease infinite;
  font-weight: 900;
  letter-spacing: 0.08em;
}

/* Drag & drop */
.drop-zone {
  border: 2px dashed rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.01);
}

.drop-zone:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.02);
}

.drop-zone.dragover {
  border-color: var(--accent-green);
  background: rgba(29, 185, 84, 0.04);
  box-shadow: inset 0 0 30px rgba(29, 185, 84, 0.05);
}

.drop-zone p {
  margin-bottom: 0.5rem;
}

.drop-zone .drop-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.drop-zone input[type="file"] {
  display: none;
}

/* Song table */
.song-table-wrapper {
  overflow: auto;
  margin-top: 1rem;
  max-height: 300px;
}

.song-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.song-table th,
.song-table td {
  padding: 0.7rem 0.8rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.song-table th {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}

.song-table td {
  color: var(--text-primary);
}

.song-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.song-count {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 0.8rem;
}

/* Card preview area */
.card-actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.card-actions .btn-primary,
.card-actions .btn-secondary {
  font-size: 0.9rem;
  padding: 0.7rem 1.5rem;
}

