/* ╔══════════════════════════════════════════════════════╗
   ║   God's Teeth — Discord Music Bot Dashboard         ║
   ║   Dark theme · Purple accents · Glassmorphism       ║
   ╚══════════════════════════════════════════════════════╝ */

/* ─── Design Tokens ─────────────────────────────────── */
:root {
  --bg-root:       #07070d;
  --bg-surface:    #0e0e18;
  --bg-card:       rgba(16, 16, 28, 0.85);
  --bg-hover:      rgba(139, 92, 246, 0.08);
  --bg-active:     rgba(139, 92, 246, 0.14);
  --bg-glass:      rgba(16, 16, 28, 0.65);

  --border:        rgba(255, 255, 255, 0.06);
  --border-accent: rgba(139, 92, 246, 0.2);

  --accent:        #8b5cf6;
  --accent-light:  #a78bfa;
  --accent-dark:   #7c3aed;
  --accent-glow:   rgba(139, 92, 246, 0.35);
  --accent-subtle: rgba(139, 92, 246, 0.12);

  --text-primary:  #e8eaed;
  --text-secondary:#9aa0a6;
  --text-muted:    #5f6368;

  --success:       #34d399;
  --danger:        #f87171;
  --warning:       #fbbf24;

  --radius-sm:     6px;
  --radius-md:     10px;
  --radius-lg:     16px;
  --radius-xl:     24px;

  --shadow-lg:     0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow:   0 0 30px var(--accent-glow);

  --topbar-h:      60px;
  --sidebar-w:     260px;
  --np-bar-h:      96px;

  --transition:    0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-root);
  color: var(--text-primary);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

button {
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
  font-family: inherit;
}

input, select {
  font-family: inherit;
  color: inherit;
}

/* ─── Scrollbars ────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }


/* ═══════════════════════════════════════════════════════
   LOGIN SCREEN
   ═══════════════════════════════════════════════════════ */

#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at 30% 50%, rgba(139,92,246,0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 50%, rgba(99,102,241,0.06) 0%, transparent 60%),
              var(--bg-root);
}

.login-bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  animation: orbit 20s ease-in-out infinite;
}
.login-bg-orb-1 {
  width: 400px; height: 400px;
  background: var(--accent);
  top: -100px; left: -100px;
}
.login-bg-orb-2 {
  width: 350px; height: 350px;
  background: #6366f1;
  bottom: -100px; right: -100px;
  animation-delay: -10s;
  animation-direction: reverse;
}

@keyframes orbit {
  0%, 100% { transform: translate(0, 0); }
  25%      { transform: translate(60px, 30px); }
  50%      { transform: translate(20px, -40px); }
  75%      { transform: translate(-40px, 20px); }
}

.login-card {
  background: var(--bg-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  width: 380px;
  max-width: 90vw;
  text-align: center;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  animation: fadeUp 0.6s ease-out;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.login-logo {
  font-size: 52px;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 20px var(--accent-glow));
}

.login-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 32px;
  font-weight: 400;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.input-group {
  margin-bottom: 16px;
}

.input-group input {
  width: 100%;
  padding: 14px 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 15px;
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.input-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.input-group input::placeholder {
  color: var(--text-muted);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--accent-glow);
}
.btn-primary:active {
  transform: translateY(0);
}
.btn-full { width: 100%; }

.login-error {
  margin-top: 14px;
  font-size: 13px;
  color: var(--danger);
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}


/* ═══════════════════════════════════════════════════════
   TOP BAR
   ═══════════════════════════════════════════════════════ */

#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-logo {
  font-size: 26px;
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

.topbar-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  background: linear-gradient(90deg, var(--text-primary) 0%, var(--accent-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.channel-select-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.channel-icon { color: var(--text-muted); flex-shrink: 0; }

.channel-select-wrapper select {
  background: transparent;
  border: none;
  outline: none;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  min-width: 140px;
}
.channel-select-wrapper select option {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.btn-accent {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}
.btn-accent:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-glow);
}
.btn-accent:active { transform: translateY(0); }


/* ═══════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════ */

#content {
  display: flex;
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  right: 0;
  bottom: 0;
  transition: bottom var(--transition);
}

#content.has-player {
  bottom: var(--np-bar-h);
}

/* ─── Sidebar ───────────────────────────────────────── */

#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  text-align: left;
}
.sidebar-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.sidebar-item.active {
  background: var(--bg-active);
  color: var(--accent-light);
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px 4px;
}

.sidebar-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.sidebar-add-btn {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-muted);
  transition: all var(--transition);
}
.sidebar-add-btn:hover {
  background: var(--bg-active);
  color: var(--accent-light);
}

.playlist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 14px;
  font-size: 14px;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  text-align: left;
}
.playlist-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.playlist-item.active {
  background: var(--bg-active);
  color: var(--accent-light);
}

.playlist-item .playlist-icon {
  flex-shrink: 0;
  opacity: 0.6;
}

.playlist-item .playlist-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playlist-item .playlist-count {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.playlist-item .playlist-delete {
  display: none;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.playlist-item:hover .playlist-delete {
  display: flex;
}
.playlist-item .playlist-delete:hover {
  background: rgba(248,113,113,0.15);
  color: var(--danger);
}

/* ─── Main Content ──────────────────────────────────── */

#main-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  position: relative;
}

#track-list-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

#track-list-header h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 8px;
  background: var(--accent-subtle);
  color: var(--accent-light);
  font-size: 12px;
  font-weight: 600;
  border-radius: 12px;
}

/* ─── Track Row ─────────────────────────────────────── */

.track-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  position: relative;
}
.track-row:hover {
  background: var(--bg-hover);
}
.track-row.playing {
  background: var(--bg-active);
}

.track-row .track-num {
  width: 28px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  flex-shrink: 0;
}

.track-row:hover .track-num-text,
.track-row.playing .track-num-text { display: none; }
.track-row .track-play-btn { display: none; }
.track-row:hover .track-play-btn,
.track-row.playing .track-play-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--accent-light);
}

.track-row .track-info {
  flex: 1;
  min-width: 0;
}
.track-row .track-title {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.track-row.playing .track-title {
  color: var(--accent-light);
}
.track-row .track-artist {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-row .track-duration {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  min-width: 40px;
  text-align: right;
}

.track-row .track-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition);
}
.track-row:hover .track-actions { opacity: 1; }

.track-action-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition);
}
.track-action-btn:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
}
.track-action-btn.delete:hover {
  background: rgba(248,113,113,0.12);
  color: var(--danger);
}

/* Drag handle for playlist tracks */
.track-drag-handle {
  width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: grab;
  opacity: 0;
  transition: opacity var(--transition);
  flex-shrink: 0;
}
.track-row:hover .track-drag-handle { opacity: 0.6; }
.track-drag-handle:active { cursor: grabbing; }

.track-row.dragging {
  opacity: 0.4;
  background: var(--bg-active);
}

.track-row.drag-over {
  border-top: 2px solid var(--accent);
}

/* ─── Empty State ───────────────────────────────────── */

#empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 80px 20px;
  color: var(--text-muted);
  font-size: 15px;
}
#empty-state span {
  font-size: 13px;
  opacity: 0.6;
}

/* ─── Upload Dropzone ───────────────────────────────── */

#upload-dropzone {
  position: absolute;
  inset: 0;
  background: rgba(139, 92, 246, 0.08);
  backdrop-filter: blur(4px);
  border: 2px dashed var(--accent);
  border-radius: var(--radius-lg);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.dropzone-content {
  text-align: center;
  color: var(--accent-light);
}
.dropzone-content p {
  margin-top: 12px;
  font-size: 16px;
  font-weight: 500;
}

/* ─── Upload Progress ───────────────────────────────── */

#upload-progress {
  margin-bottom: 16px;
  animation: fadeIn 0.3s ease;
}

.upload-progress-inner {
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
}

#upload-progress-text {
  font-size: 13px;
  color: var(--accent-light);
  margin-bottom: 8px;
  display: block;
}

.upload-progress-bar {
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
}

#upload-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-light) 100%);
  border-radius: 2px;
  transition: width 0.3s ease;
}


/* ═══════════════════════════════════════════════════════
   NOW PLAYING BAR
   ═══════════════════════════════════════════════════════ */

#now-playing-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--np-bar-h);
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  align-items: center;
  padding: 0 20px;
  background: var(--bg-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border);
  z-index: 100;
}

/* Track info (left) */
.np-info {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.np-art {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--accent-dark) 0%, rgba(99,102,241,0.5) 100%);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.np-art-icon {
  transition: opacity var(--transition);
}

.np-eq-bars {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  padding: 12px 8px;
  opacity: 0;
  transition: opacity var(--transition);
}

.np-eq-bars span {
  width: 4px;
  background: var(--accent-light);
  border-radius: 2px;
  animation: eq-bar 0.8s ease-in-out infinite alternate;
}
.np-eq-bars span:nth-child(1) { height: 30%; animation-delay: 0s; }
.np-eq-bars span:nth-child(2) { height: 60%; animation-delay: 0.15s; }
.np-eq-bars span:nth-child(3) { height: 45%; animation-delay: 0.3s; }
.np-eq-bars span:nth-child(4) { height: 75%; animation-delay: 0.1s; }

@keyframes eq-bar {
  0%   { height: 20%; }
  100% { height: 90%; }
}

#now-playing-bar.is-playing .np-art-icon { opacity: 0; }
#now-playing-bar.is-playing .np-eq-bars  { opacity: 1; }

.np-details {
  min-width: 0;
}
.np-title {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.np-artist {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Center controls */
.np-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.np-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.np-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.np-btn:hover {
  color: var(--text-primary);
  transform: scale(1.08);
}

.np-btn-play {
  width: 40px;
  height: 40px;
  background: var(--text-primary);
  color: var(--bg-root) !important;
}
.np-btn-play:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 16px rgba(255,255,255,0.15);
}

/* Progress bar */
.np-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 560px;
}

.np-time {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 36px;
  user-select: none;
}
.np-time:last-child { text-align: right; }

.np-progress-bar {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  transition: height 0.15s ease;
}
.np-progress-bar:hover {
  height: 6px;
}

.np-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
  position: relative;
  transition: none;
}
.np-progress-bar:hover .np-progress-fill {
  background: var(--accent-light);
}

.np-progress-handle {
  position: absolute;
  top: 50%;
  right: -5px;
  width: 12px;
  height: 12px;
  background: var(--text-primary);
  border-radius: 50%;
  transform: translateY(-50%) scale(0);
  transition: transform 0.15s ease;
  pointer-events: none;
}
.np-progress-bar:hover .np-progress-handle {
  transform: translateY(-50%) scale(1);
}

/* Volume (right) */
.np-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.np-volume-slider-wrap {
  width: 100px;
}

.np-volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.np-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  background: var(--text-primary);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.np-volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.25);
}
.np-volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: var(--text-primary);
  border-radius: 50%;
  border: none;
  cursor: pointer;
}

/* ─── Add-to-playlist Popover ───────────────────────── */

.popover {
  position: fixed;
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 200;
  min-width: 200px;
  max-height: 300px;
  overflow-y: auto;
  animation: popIn 0.15s ease;
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

.popover-header {
  padding: 10px 14px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.popover-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: left;
  transition: all var(--transition);
}
.popover-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.popover-empty {
  padding: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

/* ─── Playlist Name Input (inline rename) ───────────── */

.playlist-name-input {
  width: 100%;
  padding: 9px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
}

/* ─── Responsive ────────────────────────────────────── */

@media (max-width: 768px) {
  #sidebar {
    display: none; /* TODO: add hamburger menu on mobile */
  }
  .np-info { display: none; }
  #now-playing-bar {
    grid-template-columns: 1fr auto;
  }
  .np-right {
    display: none;
  }
  .topbar-title { display: none; }
  .channel-select-wrapper { display: none; }
}
