/* ═══════════════════════════════════════════════════════════
   GLOBAL RESET & VARS
═══════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f3f5fb;
  --surface: #ffffff;
  --surface2: #edf0f8;
  --border: rgba(15,23,42,0.10);
  --purple: #8b5cf6;
  --purple-light: #8b5cf6;
  --pink: #db2777;
  --cyan: #0e7490;
  --green: #059669;
  --red: #dc2626;
  --yellow: #b45309;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-sub: #334155;
  --grad: linear-gradient(135deg, var(--purple) 0%, var(--pink) 100%);
  --grad-soft: linear-gradient(135deg, rgba(139,92,246,0.15), rgba(244,114,182,0.15));
  --grad-hover: linear-gradient(135deg, #7c3aed 0%, #db2777 100%);
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 20px 60px rgba(15,23,42,0.12);
  --shadow-glow: 0 0 60px rgba(139,92,246,0.22);
  --shadow-card: 0 8px 40px rgba(124,58,237,0.10);
}

html, body { height: 100%; }

body {
  font-family: 'Sarabun', 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ═══════════════════════════════════════════════════════════
   BACKGROUND ORBS (user page)
═══════════════════════════════════════════════════════════ */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.2;
  pointer-events: none;
  z-index: 0;
  animation: floatOrb 20s ease-in-out infinite;
}
.orb-1 {
  width: 600px; height: 600px;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  top: -150px; left: -150px;
  animation-delay: 0s;
}
.orb-2 {
  width: 500px; height: 500px;
  background: linear-gradient(135deg, var(--pink), var(--cyan));
  bottom: -100px; right: -100px;
  animation-delay: -7s;
}
.orb-3 {
  width: 400px; height: 400px;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  top: 50%; right: 15%;
  animation-delay: -14s;
}
.orb-4 {
  width: 350px; height: 350px;
  background: linear-gradient(135deg, var(--purple-light), var(--cyan));
  top: 30%; left: 10%;
  animation-delay: -10s;
}

@keyframes floatOrb {
  0%, 100% {
    transform: translate(0, 0) scale(1);
    opacity: 0.2;
  }
  33% {
    transform: translate(30px, -20px) scale(1.1);
    opacity: 0.25;
  }
  66% {
    transform: translate(-20px, 30px) scale(0.95);
    opacity: 0.18;
  }
}

/* ═══════════════════════════════════════════════════════════
   USER PAGE
═══════════════════════════════════════════════════════════ */
.user-page { min-height: 100vh; background: var(--bg); }

.page-container {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 24px;
}

.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 28px; }
.logo-text { font-size: 22px; font-weight: 700; background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 600; }
.badge-open { background: rgba(16,185,129,0.15); border: 1px solid rgba(16,185,129,0.3); color: #059669; }
.badge-closed { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); color: #ef4444; }

.pulse-dot {
  width: 8px; height: 8px;
  background: #059669;
  border-radius: 50%;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* Stats */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 24px; }
.stat-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.94), rgba(248,250,255,0.95));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  min-width: 0; /* allow grid cell to shrink below content size */
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(circle at 50% 0%, rgba(139,92,246,0.1) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}
.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(139,92,246,0.2);
  border-color: rgba(139,92,246,0.3);
}
.stat-card:hover::before { opacity: 1; }
.stat-value { font-size: 28px; font-weight: 800; background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; position: relative; z-index: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; position: relative; z-index: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Form card */
.form-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.97), rgba(248,250,255,0.98));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: var(--shadow-card), 0 0 0 1px rgba(139,92,246,0.1);
  backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
}
.form-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(139,92,246,0.1) 0%, transparent 70%);
  pointer-events: none;
}
.form-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 28px;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
  z-index: 1;
}

.form-section { margin-bottom: 22px; }
.form-label { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--text-sub); margin-bottom: 10px; }
.label-icon { font-size: 16px; }

.form-input {
  width: 100%;
  background: rgba(255,255,255,0.9);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  padding: 14px 18px;
  outline: none;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}
.form-input:focus {
  border-color: var(--purple-light);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.15);
  background: #ffffff;
}
.form-input::placeholder { color: var(--text-muted); }

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }

.input-wrapper { display: flex; gap: 10px; }
.input-wrapper .form-input { flex: 1; }

.btn-preview {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-sub);
  font-size: 13px;
  padding: 0 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.btn-preview:hover { border-color: var(--purple); color: var(--text); }

/* YouTube preview */
.yt-preview {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
}
.yt-thumb { width: 90px; height: 52px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.yt-title { font-size: 13px; font-weight: 600; line-height: 1.4; }
.yt-duration { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Social tabs */
.social-tabs { display: flex; gap: 8px; margin-bottom: 0; }
.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(255,255,255,0.9);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 14px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}
.tab-btn:hover {
  border-color: rgba(139,92,246,0.3);
  color: var(--text);
  background: #ffffff;
}
.tab-btn.active {
  border-color: var(--purple-light);
  color: var(--purple-light);
  background: linear-gradient(135deg, rgba(139,92,246,0.2), rgba(244,114,182,0.15));
  box-shadow: 0 4px 16px rgba(139,92,246,0.2);
}

/* Image tabs */
.image-input-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.img-tab {
  background: rgba(255,255,255,0.9);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  padding: 10px 18px;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}
.img-tab:hover {
  border-color: rgba(139,92,246,0.3);
  color: var(--text);
  background: #ffffff;
}
.img-tab.active {
  border-color: var(--purple-light);
  color: var(--purple-light);
  background: linear-gradient(135deg, rgba(139,92,246,0.15), rgba(244,114,182,0.1));
  box-shadow: 0 2px 12px rgba(139,92,246,0.15);
}

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 36px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(10px);
}
.upload-zone:hover {
  border-color: var(--purple-light);
  background: rgba(255,255,255,0.85);
  box-shadow: 0 0 24px rgba(139,92,246,0.15);
}
.upload-zone.drag-over {
  border-color: var(--purple-light);
  background: linear-gradient(135deg, rgba(139,92,246,0.1), rgba(244,114,182,0.08));
  box-shadow: 0 0 32px rgba(139,92,246,0.2);
}
.upload-placeholder { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--text-muted); font-size: 14px; position: relative; z-index: 1; }
.upload-icon { font-size: 36px; animation: floatIcon 3s ease-in-out infinite; }
@keyframes floatIcon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.upload-preview {
  width: 110px; height: 110px;
  border-radius: 50%; object-fit: cover;
  border: 3px solid rgba(139,92,246,0.45);
  box-shadow: 0 8px 24px rgba(15,23,42,0.08);
}

/* Submit button */
.btn-submit {
  width: 100%;
  background: var(--grad);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  padding: 16px;
  cursor: pointer;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s ease;
  box-shadow: 0 8px 24px rgba(139,92,246,0.3);
  position: relative;
  overflow: hidden;
}
.btn-submit::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, rgba(15,23,42,0.16) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.3s;
}
.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(139,92,246,0.4);
}
.btn-submit:hover::before { opacity: 1; }
.btn-submit:active { transform: translateY(0) scale(0.98); }
.btn-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.spinner {
  width: 20px; height: 20px;
  border: 3px solid rgba(15,23,42,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Closed card */
.closed-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 60px 24px;
  text-align: center;
}
.closed-icon { font-size: 64px; margin-bottom: 16px; }
.closed-card h2 { font-size: 22px; margin-bottom: 8px; }
.closed-card p { color: var(--text-muted); }

/* ─── POPUP ──────────────────────────────────────────────── */
.popup-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.5);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.popup-card {
  background: var(--surface);
  border: 1px solid rgba(124,58,237,0.3);
  border-radius: 24px;
  padding: 40px 32px 32px;
  text-align: center;
  max-width: 360px;
  width: 90%;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(124,58,237,0.2);
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes popIn { from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: scale(1); } }

.popup-icon { font-size: 56px; margin-bottom: 12px; }
.popup-title { font-size: 22px; font-weight: 700; margin-bottom: 16px; }
.popup-queue-number {
  font-size: 36px;
  font-weight: 800;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 8px;
}
.popup-date { font-size: 14px; color: var(--text-muted); margin-bottom: 12px; }
.popup-song { font-size: 15px; font-weight: 600; color: var(--text-sub); margin-bottom: 16px; }
.popup-thumb { width: 100%; max-width: 280px; border-radius: 8px; margin-bottom: 16px; }

.btn-close-popup {
  background: var(--grad);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 32px;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-close-popup:hover { opacity: 0.85; }

/* ─── QUEUE LIST POPUP (today & tomorrow) ────────────────────
   ใช้กับ #queueListOverlay ที่ hardcode ใน index.ejs
   ซ่อนไว้โดยค่าเริ่มต้น แสดงเมื่อ .is-open ถูกเติมโดย JS ── */
.ql-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(8px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  z-index: 1000;
  padding: 24px 16px;
  overflow-y: auto;
  animation: fadeIn 0.2s ease;
}
.ql-popup-overlay.is-open {
  display: flex;
}
.ql-sheet {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 440px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 60px rgba(124, 58, 237, 0.2);
  overflow: hidden;
}
.ql-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.ql-title { flex: 1; }
.ql-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 8px;
  transition: color 0.2s;
}
.ql-close:hover { color: var(--text); }
.ql-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.ql-empty {
  text-align: center;
  padding: 36px 16px;
  color: var(--text-muted);
  font-size: 14px;
}
.ql-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 6px;
  background: var(--surface2);
  transition: background 0.2s;
}
.ql-item:hover { background: rgba(139, 92, 246, 0.08); }
.ql-item.ql-playing {
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.3);
}
.ql-item.ql-done { opacity: 0.6; }
.ql-item.ql-my-item {
  border: 1.5px solid var(--purple-light);
}
.ql-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ql-num.playing { background: var(--green); }
.ql-num.done { background: var(--text-muted); }
.ql-av {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.ql-info {
  flex: 1;
  min-width: 0;
}
.ql-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ql-song {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ql-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}
.ql-pill-playing {
  background: rgba(139, 92, 246, 0.2);
  color: var(--purple-light);
}
.ql-pill-pending {
  background: rgba(15, 23, 42, 0.07);
  color: var(--text-muted);
}

/* ─── AUDIO UNLOCK BUTTON (index.ejs) ────────────────────────── */
.btn-audio-unlock {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: none;
  align-items: center;
  gap: 8px;
  background: var(--grad);
  color: #fff;
  border: none;
  border-radius: 50px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 12px 24px;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(139, 92, 246, 0.3);
  transition: all 0.2s;
}
.btn-audio-unlock:hover {
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 12px 40px rgba(139, 92, 246, 0.4);
}

/* ─── SONG SEARCH COMBOBOX ──────────────────────────────────────
   ใช้กับ .search-combo-wrap / .search-dropdown ที่ hardcode ใน index.ejs ── */
.search-combo-wrap {
  position: relative;
  width: 100%;
}
.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 40px rgba(15, 23, 42, 0.12);
  overflow: hidden;
  max-height: 480px;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.15s ease;
}
.search-dropdown-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
}
.search-dropdown-title { flex: 1; }
.search-close-btn {
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 8px;
  transition: color 0.2s;
}
.search-close-btn:hover { color: var(--text); }
.search-results-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-radius: 6px;
  margin: 2px 8px;
  transition: background 0.2s;
}
.search-result-item:hover { background: var(--surface2); }
.search-result-item.focused {
  background: rgba(139, 92, 246, 0.15);
  outline: 2px solid var(--purple-light);
  outline-offset: -1px;
}
.search-result-thumb {
  width: 60px;
  height: 34px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}
.search-result-info {
  flex: 1;
  min-width: 0;
}
.search-result-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-result-sub {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-result-dur {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.search-msg {
  text-align: center;
  padding: 20px 16px;
  color: var(--text-muted);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.search-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(15, 23, 42, 0.2);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.search-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface2);
}
.search-pager-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-sub);
  transition: all 0.2s;
}
.search-pager-btn:hover:not(:disabled) {
  background: var(--purple-light);
  color: #fff;
  border-color: var(--purple-light);
}
.search-pager-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.search-page-info {
  font-size: 12px;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════
   DISPLAY PAGE
═══════════════════════════════════════════════════════════ */
.display-page {
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

/* Ambient background */
.ambient-bg { position: fixed; inset: 0; z-index: 0; }
.ambient-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.12;
  transition: background 2s ease;
}
.blob-1 { width: 600px; height: 600px; top: -150px; left: -150px; background: var(--purple); animation: floatBlob1 20s ease-in-out infinite; }
.blob-2 { width: 500px; height: 500px; bottom: -100px; right: -100px; background: var(--pink); animation: floatBlob2 25s ease-in-out infinite; }
@keyframes floatBlob1 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(60px, 40px); } }
@keyframes floatBlob2 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(-50px, -30px); } }

/* Idle screen */
.idle-screen {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  gap: 20px;
}
.idle-music-bars {
  display: flex; align-items: flex-end; gap: 6px;
  height: 60px;
}
.idle-music-bars span {
  width: 8px;
  background: var(--grad);
  border-radius: 4px;
  animation: musicBar 1.2s ease-in-out infinite;
}
.idle-music-bars span:nth-child(1) { height: 30px; animation-delay: 0s; }
.idle-music-bars span:nth-child(2) { height: 50px; animation-delay: 0.2s; }
.idle-music-bars span:nth-child(3) { height: 40px; animation-delay: 0.4s; }
.idle-music-bars span:nth-child(4) { height: 55px; animation-delay: 0.1s; }
.idle-music-bars span:nth-child(5) { height: 35px; animation-delay: 0.3s; }
@keyframes musicBar { 0%,100% { transform: scaleY(1); } 50% { transform: scaleY(0.3); } }

.idle-title { font-size: 48px; font-weight: 800; background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.idle-sub { font-size: 20px; color: var(--text-muted); }
.btn-start-session {
  background: var(--grad);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  padding: 14px 36px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}
.btn-start-session:hover { opacity: 0.85; transform: scale(1.03); }

/* Now playing screen */
.now-playing-screen {
  position: relative; z-index: 1;
  width: 100%;
  max-width: 700px;
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.np-queue-badge {
  background: rgba(124,58,237,0.2);
  border: 1px solid rgba(124,58,237,0.4);
  border-radius: 20px;
  padding: 6px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--purple-light);
  letter-spacing: 0.5px;
}

/* Profile */
.np-profile { display: flex; flex-direction: column; align-items: center; gap: 16px; }

.np-avatar-ring {
  width: 160px; height: 160px;
  border-radius: 50%;
  padding: 4px;
  background: var(--grad);
  box-shadow: 0 0 60px rgba(124,58,237,0.4);
  animation: avatarGlow 3s ease-in-out infinite;
}
@keyframes avatarGlow {
  0%,100% { box-shadow: 0 0 40px rgba(124,58,237,0.4); }
  50% { box-shadow: 0 0 80px rgba(236,72,153,0.6); }
}

.np-avatar {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface2);
}

.np-user-info { display: flex; align-items: center; gap: 10px; }
.np-social-icon { font-size: 22px; }
.np-username {
  font-size: 28px;
  font-weight: 700;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Song section */
.np-song-section { text-align: center; }
.np-song-label { font-size: 13px; color: var(--text-muted); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 8px; }
.np-song-title {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
  max-width: 600px;
}

/* Progress */
.np-progress-section { width: 100%; max-width: 580px; }

.np-time-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}
.np-time { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--purple-light); }
.np-time-total { font-size: 16px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.np-progress-track {
  height: 8px;
  background: var(--surface2);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.np-progress-bar {
  height: 100%;
  background: var(--grad);
  border-radius: 4px;
  transition: width 0.5s linear;
  position: relative;
  z-index: 1;
}
.np-progress-glow {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  background: var(--grad);
  border-radius: 4px;
  filter: blur(6px);
  opacity: 0.5;
  transition: width 0.5s linear;
}

.np-remaining { text-align: center; font-size: 14px; color: var(--text-muted); margin-top: 8px; }
.np-remaining span { color: var(--pink); font-weight: 600; }

/* Thumbnail */
.np-thumb-strip { width: 100%; max-width: 300px; }
.np-thumbnail { width: 100%; border-radius: 12px; box-shadow: var(--shadow); }

/* Next up bar */
.next-up-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 10;
  background: rgba(20, 20, 42, 0.9);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.next-up-label { font-size: 12px; font-weight: 700; color: var(--purple-light); letter-spacing: 1px; text-transform: uppercase; white-space: nowrap; }
.next-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid var(--purple); }
.next-info { flex: 1; }
.next-username { font-size: 13px; font-weight: 700; color: var(--text); }
.next-song { font-size: 12px; color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════
   ADMIN PAGE
═══════════════════════════════════════════════════════════ */
.admin-page { background: var(--bg); min-height: 100vh; }

/* Login */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 32px;
  width: 100%;
  max-width: 380px;
  position: relative;
  z-index: 1;
  box-shadow: var(--shadow);
}
.login-icon { font-size: 48px; text-align: center; margin-bottom: 16px; }
.login-title { font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 24px; }

.alert { padding: 10px 14px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; }
.alert-error { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); color: #dc2626; }
.alert-success { background: rgba(16,185,129,0.15); border: 1px solid rgba(16,185,129,0.3); color: #059669; }

/* Admin layout */
.admin-layout { display: flex; min-height: 100vh; }

.admin-sidebar {
  width: 256px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 0;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  transition: width 0.25s ease, padding 0.25s ease, opacity 0.2s ease;
  z-index: 100;
}

/* ── Sidebar collapsed (desktop toggle) ─── */
.admin-layout.sidebar-collapsed .admin-sidebar {
  width: 0;
  padding-left: 0;
  padding-right: 0;
  overflow: hidden;
  border-right: none;
  opacity: 0;
}

/* ── Sidebar toggle button ─── */
.sidebar-toggle-btn {
  width: 36px; height: 36px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; flex-shrink: 0;
  background: rgba(15,23,42,0.06);
  border: 1.5px solid var(--border);
  border-radius: 8px; cursor: pointer;
  transition: all 0.2s;
  padding: 0;
}
.sidebar-toggle-btn span {
  display: block; width: 16px; height: 2px;
  background: var(--text-muted); border-radius: 2px;
  transition: all 0.25s;
}
.sidebar-toggle-btn:hover { background: rgba(139,92,246,0.15); border-color: rgba(139,92,246,0.4); }
.sidebar-toggle-btn:hover span { background: var(--purple-light); }

/* ── Sidebar overlay (mobile) ─── */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(15,23,42,0.45); z-index: 999;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

.sidebar-logo { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; padding: 0 8px 16px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }

.sidebar-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--text-muted); padding: 12px 12px 4px; opacity: 0.6;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s;
}
.nav-link:hover, .nav-link.active { background: rgba(124,58,237,0.15); color: var(--purple-light); }

/* Sidebar compact action buttons */
.sidebar-action-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 12px;
  background: transparent; border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted); font-family: inherit;
  font-size: 13px; font-weight: 600;
  cursor: pointer; text-align: left;
  transition: all 0.15s;
}
.sidebar-action-btn:hover { background: rgba(245,158,11,0.12); color: #b45309; }
.sidebar-action-btn.danger:hover { background: rgba(239,68,68,0.12); color: #dc2626; }
.sidebar-action-btn.danger-hard:hover { background: rgba(239,68,68,0.2); color: #dc2626; }

.sidebar-divider { height: 1px; background: var(--border); margin: 8px 0; opacity: 0.6; }

.btn-logout {
  width: 100%;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: var(--radius-sm);
  color: #dc2626;
  font-family: inherit;
  font-size: 14px;
  padding: 10px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-logout:hover { background: rgba(239,68,68,0.2); }

.admin-main { flex: 1; padding: 28px; overflow-x: auto; }

.admin-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.admin-page-title { font-size: 24px; font-weight: 700; }
.admin-date { font-size: 14px; color: var(--text-muted); }

/* Admin stats — always 5 columns in one row */
.admin-stats { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; margin-bottom: 28px; }
.admin-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 16px;
  text-align: center;
}
.ast-value { font-size: 30px; font-weight: 700; background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.ast-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Admin grid */
.admin-grid { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start; }
.admin-col { display: flex; flex-direction: column; gap: 20px; }

/* Admin card */
.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card-title { font-size: 15px; font-weight: 700; color: var(--text-sub); margin-bottom: 16px; letter-spacing: 0.3px; }

.toggle-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.status-badge { font-size: 14px; font-weight: 600; flex: 1; }

.btn-toggle {
  background: var(--grad);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s;
}
.btn-toggle:hover { opacity: 0.85; }

.now-playing-admin { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.admin-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid var(--purple); }
.admin-playing-name { font-size: 14px; font-weight: 700; }
.admin-playing-song { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.play-controls { display: flex; gap: 10px; }
.btn-control {
  flex: 1;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 10px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-next:hover { border-color: var(--purple); background: rgba(124,58,237,0.1); }
.btn-stop:hover { border-color: var(--red); background: rgba(239,68,68,0.1); }

.input-row { display: flex; gap: 10px; margin-top: 10px; }
.input-row .form-input { flex: 1; }
.btn-save {
  background: var(--grad);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 12px 20px;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-save:hover { opacity: 0.85; }

.text-muted { color: var(--text-muted); font-size: 14px; }
.text-center { text-align: center; }

/* Queue table */
.queue-table-wrap { overflow-x: auto; }
.queue-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.queue-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-weight: 600;
  position: sticky; top: 0;
  background: var(--surface);
  z-index: 1;
}
.queue-table td { padding: 12px; border-bottom: 1px solid rgba(15,23,42,0.05); vertical-align: middle; }
.queue-row:hover td { background: rgba(15,23,42,0.03); }
.queue-row.status-playing td { background: rgba(124,58,237,0.06); }
.queue-row.status-done td { opacity: 0.45; }

.q-num { font-size: 16px; font-weight: 700; color: var(--purple-light); }
.q-user { display: flex; align-items: flex-start; gap: 10px; min-width: 190px; }
.q-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.q-name { font-weight: 600; white-space: normal; overflow-wrap: anywhere; line-height: 1.35; }
.q-type { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.q-user-meta { min-width: 0; }
.q-social { color: var(--purple-light); text-decoration: none; }
.q-social:hover { text-decoration: underline; }
.q-tagline {
  font-size: 11px; font-style: italic; color: var(--text-muted);
  margin-top: 3px; max-width: 260px;
  white-space: normal; overflow-wrap: anywhere; line-height: 1.35;
}
.q-song-title { font-weight: 600; max-width: 420px; white-space: normal; overflow-wrap: anywhere; line-height: 1.35; }
.q-link { font-size: 11px; color: var(--purple-light); text-decoration: none; }
.q-link:hover { text-decoration: underline; }
.q-duration { font-variant-numeric: tabular-nums; color: var(--text-muted); white-space: nowrap; }

.status-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.status-pill.status-playing { background: rgba(124,58,237,0.2); color: var(--purple-light); }
.status-pill.status-done { background: rgba(16,185,129,0.15); color: #059669; }
.status-pill.status-pending { background: rgba(245,158,11,0.15); color: #b45309; }

.btn-play-item, .btn-delete-item {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12px;
  padding: 5px 10px;
  cursor: pointer;
  transition: all 0.15s;
  margin-right: 4px;
}
.btn-play-item:hover { border-color: var(--purple); color: var(--purple-light); background: rgba(124,58,237,0.1); }
.btn-delete-item:hover { border-color: var(--red); color: #dc2626; background: rgba(239,68,68,0.1); }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════ */

/* ── Tablet / large mobile ───────────────────────────────── */
@media (max-width: 1024px) {
  /* Sidebar becomes a fixed slide-in drawer */
  .admin-sidebar {
    position: fixed !important;
    left: -270px;
    top: 0; bottom: 0;
    width: 256px !important;
    height: 100vh !important;
    z-index: 1000;
    transition: left 0.3s ease !important;
    opacity: 1 !important;
  }
  .admin-sidebar.mobile-open {
    left: 0 !important;
  }
  /* Collapsed state has no effect on mobile (drawer handles it) */
  .admin-layout.sidebar-collapsed .admin-sidebar {
    width: 256px !important;
    padding: 20px 14px !important;
    opacity: 1 !important;
  }
  .admin-main {
    width: 100%;
    flex: 1 1 auto;
    padding: 14px;
    min-height: 100vh;
    margin-left: 0 !important;
  }
  .admin-stats {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }
  .admin-grid  { grid-template-columns: 1fr; }
  .admin-topbar { flex-direction: row; gap: 10px; align-items: center; }
  .toggle-row,
  .play-controls,
  .input-row { flex-direction: column; align-items: stretch; }
  .toggle-row > *,
  .play-controls > *,
  .input-row > * { width: 100%; }
  .queue-table-wrap { width: 100%; overflow-x: auto; }
  .queue-table { min-width: 600px; }
}

/* ── Small mobile (≤ 600 px) ─────────────────────────────── */
@media (max-width: 600px) {
  /* User page */
  .stats-row   { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .stat-card   { padding: 10px 4px; }
  .stat-value  { font-size: 15px; }
  .stat-label  { font-size: 9px; }
  .form-card   { padding: 18px 14px; }
  .social-tabs { flex-wrap: wrap; }
  .tab-btn     { font-size: 13px; padding: 10px 8px; gap: 4px; }

  /* Now-playing mini card */
  .np-avatar-ring { width: 120px; height: 120px; }
  .np-username    { font-size: 22px; }
  .np-song-title  { font-size: 18px; }

  /* Admin stats — 4 per row × 2 rows */
  .admin-stats        { grid-template-columns: repeat(4, 1fr); gap: 5px; }
  .ast-value          { font-size: 15px; }
  .ast-label          { font-size: 8px; }
  .admin-stat-card    { padding: 10px 4px; }
  .admin-topbar       { flex-direction: row; gap: 8px; align-items: center; }
  .admin-page-title   { font-size: 16px; }
  .admin-date         { display: none; }
  .queue-table-wrap   { font-size: 12px; max-height: none; overflow-x: auto; }
  .queue-table        { min-width: 560px; }
  .queue-table th,
  .queue-table td     { padding: 8px 6px; white-space: normal; }
  .q-song-title       { max-width: 140px; }
  .queue-table td:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
  }
  .btn-play-item,
  .btn-delete-item {
    margin-right: 0;
    margin-bottom: 6px;
  }
  .admin-card         { padding: 18px; }
  .admin-topbar       { padding: 0; }
}

@media (max-width: 600px) {
  .queue-table td:last-child {
    flex-direction: column;
    align-items: stretch;
  }
  .btn-play-item,
  .btn-delete-item {
    width: 100%;
  }
}

/* ── Tiny mobile (≤ 400 px) ──────────────────────────────── */
@media (max-width: 400px) {
  /* 4-col stats, very compact */
  .stats-row   { gap: 4px; }
  .stat-card   { padding: 8px 2px; }
  .stat-value  { font-size: 13px; }
  .stat-label  { font-size: 8px; }

  /* Form */
  .form-card   { padding: 16px 12px; border-radius: 14px; }
  .form-input  { font-size: 14px; padding: 12px 12px; }
  .form-title  { font-size: 18px; margin-bottom: 20px; }
  .btn-submit  { font-size: 15px; padding: 14px; }
  .btn-preview { font-size: 12px; padding: 0 12px; }

    /* Social tabs — stack Clear button under IG/FB row */
  .social-tabs { flex-wrap: wrap; }
  .tab-btn     { font-size: 12px; padding: 10px 6px; }

  /* Popup */
  .popup-card  { padding: 28px 20px 24px; }
  .popup-icon  { font-size: 44px; }
  .popup-queue-number { font-size: 28px; }

  /* Queue list popup */
  .ql-popup-overlay { padding: 16px 8px; }
  .ql-header { padding: 12px 16px; font-size: 14px; }
  .ql-item { padding: 10px 12px; gap: 8px; }
  .ql-num  { width: 30px; height: 30px; font-size: 12px; }
  .ql-av   { width: 32px; height: 32px; }
  .ql-name { font-size: 12px; }
  .ql-song { font-size: 11px; }

  /* Search dropdown */
  .search-result-item { padding: 8px 12px; gap: 8px; }
  .search-result-thumb { width: 50px; height: 28px; }
  .search-result-title { font-size: 12px; }
  .search-result-sub   { font-size: 10px; }

  /* Admin */
  .admin-stats { grid-template-columns: repeat(4, 1fr); gap: 4px; }
  .ast-value   { font-size: 14px; }
  .ast-label   { font-size: 8px; }
}

/* ── Landscape phone (short height ≤ 500 px) ─────────────── */
@media (max-height: 500px) and (max-width: 900px) {
  .np-panel    { min-height: unset; }
  .form-card   { padding: 16px 14px; }
}

/* ═══════════════════════════════════════════════════════════════
   DARK THEME — เปิดใช้งานเมื่อ <body data-theme="dark">
   (สลับได้จากปุ่มธีมในหน้า Admin)
   ═══════════════════════════════════════════════════════════════ */
[data-theme="dark"] {
  --bg: #0b0f1a;
  --surface: #131a2c;
  --surface2: #1a2340;
  --border: rgba(148,163,184,0.16);
  --purple: #8b5cf6;
  --purple-light: #a78bfa;
  --pink: #f472b6;
  --cyan: #22d3ee;
  --green: #34d399;
  --red: #f87171;
  --yellow: #fbbf24;
  --text: #e6ebf5;
  --text-muted: #8b95ab;
  --text-sub: #c2cbe0;
  --shadow: 0 20px 60px rgba(0,0,0,0.55);
  --shadow-glow: 0 0 60px rgba(139,92,246,0.30);
  --shadow-card: 0 8px 40px rgba(0,0,0,0.5);
}

body[data-theme="dark"] { background: var(--bg); color: var(--text); }

/* พื้นผิวขาวแบบ hardcode ใน style.css หลัก */
[data-theme="dark"] .stat-card,
[data-theme="dark"] .form-card {
  background: linear-gradient(135deg, rgba(23,30,52,0.96), rgba(19,26,44,0.98));
}
[data-theme="dark"] .form-input,
[data-theme="dark"] textarea.form-input {
  background: rgba(19,26,44,0.9);
}
[data-theme="dark"] .form-input:focus,
[data-theme="dark"] textarea.form-input:focus { background: rgba(19,26,44,0.96); }
[data-theme="dark"] .tab-btn,
[data-theme="dark"] .img-tab { background: rgba(19,26,44,0.8); }
[data-theme="dark"] .tab-btn:hover,
[data-theme="dark"] .img-tab:hover { background: rgba(19,26,44,0.96); }
[data-theme="dark"] .upload-zone:hover { background: rgba(19,26,44,0.75); }
[data-theme="dark"] .upload-zone { background: rgba(19,26,44,0.55); }
[data-theme="dark"] .queue-table td { border-bottom: 1px solid rgba(148,163,184,0.08); }
[data-theme="dark"] .queue-row:hover td { background: rgba(148,163,184,0.05); }
[data-theme="dark"] .queue-row.status-playing td { background: rgba(139,92,246,0.12); }

/* Admin — พื้นผิวที่ hardcode ใน admin.ejs */
[data-theme="dark"] .admin-topbar {
  background: rgba(19,26,44,0.85);
  border-bottom: 1px solid rgba(148,163,184,0.12);
}
[data-theme="dark"] .admin-sidebar {
  background: linear-gradient(180deg, rgba(19,26,44,0.97), rgba(15,19,34,0.99));
  border-right-color: rgba(148,163,184,0.12);
}
[data-theme="dark"] .admin-card { background: var(--surface); }
[data-theme="dark"] .rc-panel { background: #151c30; }
[data-theme="dark"] .sr-list { background: #10141f; }
[data-theme="dark"] .queue-toggle-block { background: rgba(21,28,48,0.7); }
[data-theme="dark"] .btn-settings-open { background: rgba(21,28,48,0.8); }
[data-theme="dark"] .btn-modal-close { background: rgba(15,23,42,0.5); }
[data-theme="dark"] .icon-ctrl { background: rgba(19,26,44,0.9); }
[data-theme="dark"] .timer-time-input,
[data-theme="dark"] .timer-time-input-lg { background: rgba(19,26,44,0.92); color: var(--text); }
[data-theme="dark"] .timer-row { background: rgba(21,28,48,0.7); }
[data-theme="dark"] #manualDateInput {
  background: rgba(19,26,44,0.92) !important;
  color: var(--text) !important;
}
[data-theme="dark"] .ss-row { background: rgba(21,28,48,0.8); }
[data-theme="dark"] .np-bar-track { background: rgba(15,23,42,0.45); }
[data-theme="dark"] .admin-page-title,
[data-theme="dark"] .dj-logo-text,
[data-theme="dark"] .login-title {
  background: linear-gradient(135deg, #a78bfa, #f472b6);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

/* User page — พื้นผิวที่ hardcode ใน index.ejs */
[data-theme="dark"] .search-dropdown { background: rgba(19,26,44,0.99); }
[data-theme="dark"] .search-dropdown-head,
[data-theme="dark"] .search-pager { background: rgba(19,26,44,0.8); }
[data-theme="dark"] .search-pager-btn { color: var(--text); }
[data-theme="dark"] .search-spinner {
  border-color: rgba(148,163,184,0.3);
  border-top-color: var(--purple);
}
[data-theme="dark"] #headerAcctDropdown { background: rgba(19,26,44,0.99); }
[data-theme="dark"] .ql-popup-overlay { background: rgba(11,15,26,0.9); }
[data-theme="dark"] .ql-sheet { border-color: rgba(148,163,184,0.12); }

/* Display / TV screen — พื้นผิวที่ hardcode ใน display.ejs */
[data-theme="dark"] #topBar,
[data-theme="dark"] #mvFullBtn,
[data-theme="dark"] #mvInfoChip,
[data-theme="dark"] #progressBar,
[data-theme="dark"] #nextBar,
[data-theme="dark"] #resetToast,
[data-theme="dark"] #remoteBar,
[data-theme="dark"] #pausedBanner { background: rgba(19,26,44,0.92); }
[data-theme="dark"] .req-input { background: rgba(19,26,44,0.95); color: var(--text); }

/* Reset page */
[data-theme="dark"] .reset-page .form-input,
[data-theme="dark"] .login-card .form-input { background: rgba(19,26,44,0.9); }

/* ── Navbar หน้าผู้ใช้ (index.ejs ใช้ inline style สีขาว → ต้องใช้ !important) ── */
[data-theme="dark"] .site-header {
  background: rgba(19,26,44,0.92) !important;
  border-bottom: 1px solid rgba(148,163,184,0.14) !important;
  box-shadow: 0 2px 30px rgba(0,0,0,0.45) !important;
}

/* ── Display / TV — พื้นผิวขาวที่เหลือใน display.ejs ── */
[data-theme="dark"] #unlockOverlay { background: rgba(11,15,26,0.97); }
[data-theme="dark"] #unlockOverlay h2 { color: var(--text); }
[data-theme="dark"] #unlockOverlay p { color: rgba(148,163,184,0.85); }
[data-theme="dark"] #pendingBadge {
  background: rgba(148,163,184,0.12);
  border-color: rgba(148,163,184,0.22);
  color: var(--text-muted);
}

/* ── จานเสียงหมุน (vinyl) ฝั่ง display + admin ให้เป็นสีเข้มไม่แยงตา ── */
[data-theme="dark"] .unlock-vinyl,
[data-theme="dark"] .idle-vinyl,
[data-theme="dark"] .top-vinyl,
[data-theme="dark"] .dj-vinyl-sm {
  background: radial-gradient(circle at 50% 50%,
    #1b2440 0%, #1b2440 13%,
    rgba(139,92,246,0.9) 13%, rgba(139,92,246,0.9) 17%,
    #151b2e 17%, #10141f 100%);
}

/* ── ตัวหนังสือสว่างในธีมมืด (แก้สีเข้มที่ยังเหลือ + หัวข้อไล่สี) ── */
body[data-theme="dark"] .admin-page-title,
body[data-theme="dark"] .dj-logo-text,
body[data-theme="dark"] .login-title,
body[data-theme="dark"] #displayName {
  background: linear-gradient(135deg, #a78bfa, #f472b6, #22d3ee) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
  color: transparent !important;
}

/* inline style color เข้มที่ฝังใน HTML → ยกให้สว่าง */
body[data-theme="dark"] [style*="color:#059669"] { color: #34d399 !important; }
body[data-theme="dark"] [style*="color:#0e7490"] { color: #22d3ee !important; }
body[data-theme="dark"] [style*="color:#b45309"] { color: #fbbf24 !important; }

/* admin — stat card / ปุ่ม / แท็ก */
body[data-theme="dark"] .admin-stat-card.sc-cyan  .ast-value { color: #22d3ee !important; }
body[data-theme="dark"] .admin-stat-card.sc-yellow .ast-value { color: #fbbf24 !important; }
body[data-theme="dark"] .admin-stat-card.sc-green .ast-value { color: #34d399 !important; }
body[data-theme="dark"] .admin-stat-card.sc-purple .ast-value { color: #a78bfa !important; }
body[data-theme="dark"] .admin-stat-card.sc-pink  .ast-value { color: #f472b6 !important; }
body[data-theme="dark"] .status-done,
body[data-theme="dark"] .status-pill.status-done { color: #34d399 !important; }
body[data-theme="dark"] .ss-title { color: #34d399 !important; }
body[data-theme="dark"] .day-label .day-tag.today { color: #34d399; }
body[data-theme="dark"] .day-label .day-tag.tomorrow { color: #fbbf24; }
body[data-theme="dark"] .btn-next,
body[data-theme="dark"] .btn-save,
body[data-theme="dark"] .btn-toggle-day,
body[data-theme="dark"] .day-status-badge.is-open { color: #34d399; }
body[data-theme="dark"] .btn-tmr-save { color: #22d3ee; }

/* index (body .user-page) แบดจ์+สเตตัส */
body[data-theme="dark"] .badge-open,
body[data-theme="dark"] .alert-success { color: #34d399 !important; }
body[data-theme="dark"] .hd-msg.ok { color: #34d399; }
body[data-theme="dark"] .qi-status-done,
body[data-theme="dark"] .ql-pill-done { color: #34d399; }

/* display / TV — ตัวหนังสือที่ hardcode #0f172a/#334155 เดิม */
body[data-theme="dark"] #socialHandle { color: rgba(226,232,240,0.75); }
body[data-theme="dark"] #nowPlayingLabel,
body[data-theme="dark"] #mvInfoChip .mv-t { color: #67e8f9; }
body[data-theme="dark"] #mvInfoChip .mv-s,
body[data-theme="dark"] #nextBarName,
body[data-theme="dark"] #resetToastMsg { color: var(--text); }
body[data-theme="dark"] #totalTimeDisp,
body[data-theme="dark"] #nextBarSong,
body[data-theme="dark"] #resetToastSub,
body[data-theme="dark"] .rc-empty { color: rgba(226,232,240,0.6); }
body[data-theme="dark"] #progressTrack { background: rgba(148,163,184,0.16); }
body[data-theme="dark"] #displayTagline,
body[data-theme="dark"] .rc-title,
body[data-theme="dark"] .rc-mv,
body[data-theme="dark"] .rc-num,
body[data-theme="dark"] .rc-dur,
body[data-theme="dark"] .rc-song,
body[data-theme="dark"] .req-label,
body[data-theme="dark"] .sr-sub,
body[data-theme="dark"] .sr-dur,
body[data-theme="dark"] .rp-dur { color: #c4b5fd; }
body[data-theme="dark"] .rc-name,
body[data-theme="dark"] .sr-title,
body[data-theme="dark"] .rp-title,
body[data-theme="dark"] .qnp-song { color: var(--text); }
body[data-theme="dark"] .rc-close { color: #cbd5e1; background: rgba(148,163,184,0.12); }
body[data-theme="dark"] .rc-pill.pending,
body[data-theme="dark"] [style*="color:#b45309"] { color: #fbbf24; }
body[data-theme="dark"] .rc-pill.done { color: rgba(226,232,240,0.6); }
body[data-theme="dark"] .req-type,
body[data-theme="dark"] .up-zone { color: rgba(226,232,240,0.8); background: rgba(148,163,184,0.08); }
body[data-theme="dark"] .qnp-name { color: rgba(226,232,240,0.75); }
body[data-theme="dark"] .idle-tag { color: #67e8f9; }

/* ── ตัวบอกสถานะเรียลไทม์หน้าแอดมิน ─────────────────────────────────────── */
#liveDot {
  position: fixed; right: 14px; bottom: 14px; z-index: 900;
  display: flex; align-items: center; gap: 7px;
  padding: 5px 11px; border-radius: 999px;
  font-size: 11px; font-weight: 600; color: #059669;
  background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.35);
  backdrop-filter: blur(8px); pointer-events: none;
  transition: color .3s, background .3s, border-color .3s;
}
#liveDot .live-bulb {
  width: 7px; height: 7px; border-radius: 50%; background: #10b981;
  animation: livePulse 2s ease-in-out infinite;
}
#liveDot.off { color: #b45309; background: rgba(245,158,11,0.14); border-color: rgba(245,158,11,0.4); }
#liveDot.off .live-bulb { background: #f59e0b; animation-duration: .8s; }
@keyframes livePulse { 0%,100%{opacity:1} 50%{opacity:.25} }
@media (prefers-reduced-motion: reduce) { #liveDot .live-bulb { animation: none; } }

/* แถวคิวที่เพิ่งเข้ามาใหม่ */
.queue-row.row-new td { animation: rowNewFlash 6s ease-out; }
@keyframes rowNewFlash {
  0%   { background: rgba(16,185,129,0.28); }
  15%  { background: rgba(16,185,129,0.22); }
  100% { background: transparent; }
}
@media (prefers-reduced-motion: reduce) { .queue-row.row-new td { animation: none; } }

/* ═══════════════════════════════════════════════════════════
   LUXE DJ — ปุ่มมาตรฐานเดียวกันทุกหน้า (กรมท่า + ทอง) + ของหมุนแบบแผ่นเสียง
   แก้ขนาด/สีปุ่มทั้งระบบที่ตัวแปรชุดนี้ที่เดียว
═══════════════════════════════════════════════════════════ */
:root {
  --lx-h: 44px; --lx-h-sm: 32px; --lx-radius: 12px; --lx-font: 14px;
  --lx-navy: #0b1730; --lx-navy2: #16295c;
  --lx-gold: #c9a24a; --lx-gold-hi: #f3dc9a; --lx-gold-lo: #9a7422;
}

/* 1) ขนาดเท่ากันทุกปุ่มหลัก */
body .btn-submit, body .btn-save, body .btn-control, body .btn-toggle,
body .btn-danger, body .btn-warning, body .btn-logout, body .btn-timer-save,
body .btn-toggle-today, body .btn-toggle-tomorrow, body .btn-toggle-day,
body .btn-close-popup, body .hd-btn, body .hd-btn-ghost, body .req-acct-btn,
body .btn-audio-unlock, body .btn-start-session {
  min-height: var(--lx-h) !important; padding: 0 18px !important;
  border-radius: var(--lx-radius) !important;
  font-size: var(--lx-font) !important; font-weight: 700 !important; line-height: 1.2 !important;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  box-sizing: border-box; letter-spacing: 0.3px; cursor: pointer;
  transition: transform .2s, box-shadow .25s, filter .25s;
}
body .btn-play-item, body .btn-delete-item, body .search-pager-btn {
  min-height: var(--lx-h-sm) !important; padding: 0 12px !important;
  border-radius: 8px !important; font-size: 12px !important; font-weight: 700 !important;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; box-sizing: border-box;
}
/* ป้าย/ปุ่มบนแถบบนของหน้าจอเปิดเพลง สูงเท่ากัน */
#topBar .top-badge-group > .on-air, #topBar .top-badge-group > a,
#topBar .top-badge-group > button, #topBar #pendingBadge {
  min-height: 40px !important; box-sizing: border-box; align-items: center;
  padding-top: 0 !important; padding-bottom: 0 !important;
}

/* 2) ผิวหรู: ปุ่มหลัก = กรมท่าขอบทอง ตัวอักษรทอง */
body .btn-submit, body .btn-save, body .btn-close-popup, body .hd-btn:not(.hd-btn-danger),
body .btn-timer-save, body .btn-control, body .btn-toggle, body .btn-start-session,
body .btn-toggle-today:not(.is-open), body .btn-toggle-tomorrow:not(.is-open) {
  background: linear-gradient(135deg, var(--lx-navy) 0%, var(--lx-navy2) 100%) !important;
  color: var(--lx-gold-hi) !important; -webkit-text-fill-color: var(--lx-gold-hi);
  border: 1px solid var(--lx-gold) !important;
  box-shadow: 0 6px 18px rgba(11,23,48,0.28), inset 0 1px 0 rgba(243,220,154,0.28) !important;
  text-shadow: none;
}
body .btn-submit:hover, body .btn-save:hover, body .btn-close-popup:hover,
body .hd-btn:not(.hd-btn-danger):hover, body .btn-timer-save:hover, body .btn-control:hover,
body .btn-toggle:hover, body .btn-start-session:hover,
body .btn-toggle-today:not(.is-open):hover, body .btn-toggle-tomorrow:not(.is-open):hover {
  transform: translateY(-2px); filter: brightness(1.12);
  box-shadow: 0 10px 26px rgba(201,162,74,0.38), inset 0 1px 0 rgba(243,220,154,0.4) !important;
}
/* ปุ่มรอง = โปร่ง ขอบทอง */
body .hd-btn-ghost, body .req-acct-btn, body .btn-audio-unlock, body .search-pager-btn {
  background: rgba(201,162,74,0.08) !important; color: var(--lx-gold-lo) !important;
  border: 1px solid rgba(201,162,74,0.55) !important;
}
[data-theme="dark"] .hd-btn-ghost, [data-theme="dark"] .req-acct-btn,
[data-theme="dark"] .btn-audio-unlock, [data-theme="dark"] .search-pager-btn { color: var(--lx-gold-hi) !important; }
body .hd-btn-ghost:hover, body .req-acct-btn:hover, body .search-pager-btn:hover { background: rgba(201,162,74,0.2) !important; }
body button:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }

/* 3) ของหมุนแบบดีเจ */
@keyframes lxSpin { to { transform: rotate(360deg); } }
/* โลโก้ = แผ่นเสียงหมุน ขอบทอง */
img[src="/img/logo"] {
  animation: lxSpin 9s linear infinite;
  box-shadow: 0 0 0 2px var(--lx-navy), 0 0 0 3.5px var(--lx-gold), 0 0 18px rgba(201,162,74,0.35);
}
/* แผ่นเสียงจิ๋วหมุนหน้าปุ่มส่งเพลง */
body .btn-submit::before {
  content: ''; width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  background:
    radial-gradient(circle, var(--lx-gold-hi) 0 16%, var(--lx-navy) 17% 24%, transparent 25%),
    repeating-radial-gradient(circle, #0a0f1f 0 2px, #26304d 2px 3px);
  border: 1px solid var(--lx-gold);
  background-blend-mode: normal; animation: lxSpin 2.4s linear infinite;
  position: static; opacity: 1; inset: auto;
}
/* ปุ่มกลม (แถบควบคุมหน้าจอ + ปุ่มเล่นเพลงหน้าแอดมิน): วงแหวนทองวิ่งรอบปุ่ม */
#remoteBar button, .icon-ctrl { position: relative; isolation: isolate; }
#remoteBar button::after, .icon-ctrl::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%; padding: 2px; pointer-events: none;
  background: conic-gradient(from 0deg, transparent 0 55%, var(--lx-gold) 75%, var(--lx-gold-hi) 88%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  animation: lxSpin 3.2s linear infinite;
}
#remoteBar button:nth-child(even)::after, .icon-ctrl:nth-child(even)::after { animation-duration: 4.4s; animation-direction: reverse; }
@media (prefers-reduced-motion: reduce) {
  img[src="/img/logo"], body .btn-submit::before, #remoteBar button::after, .icon-ctrl::after { animation: none; }
}
