:root {
  --bg: #0f1117;
  --card: rgba(26, 29, 39, 0.38);
  --card2: rgba(34, 38, 51, 0.30);
  --glass-border: rgba(255, 255, 255, 0.14);
  --accent: #6c5ce7;
  --accent2: #00cec9;
  --text: #e8e8ec;
  --muted: #a9acb8;
  --danger: #ff6b6b;
  --success: #2ecc71;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { overflow-x: hidden; max-width: 100%; }
body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background-color: #0f1117;
  background-image:
    linear-gradient(160deg, rgba(10,11,16,0.45), rgba(16,18,25,0.35) 55%, rgba(10,11,16,0.55)),
    url('../images/music_player/office-bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
}
/* Insurance for any text that sits directly on the background photo (not
   inside a .card's own solid backing) — keeps it legible over busy areas. */
h1, h2, h3, h4, strong, .container > p, .stat-box, .np-sub, .emp {
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}
a { color: var(--accent2); text-decoration: none; }
.container { max-width: 1100px; margin: 0 auto; padding: 24px 16px 60px; }
.navbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  padding: 14px 24px; background: var(--card); border-bottom: 1px solid var(--glass-border);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.navbar .brand {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
}
.navbar .brand-logo { height: 26px; width: auto; object-fit: contain; }
.navbar .brand-text { font-weight: 700; font-size: 15px; }
.navbar nav a { margin-left: 18px; color: var(--muted); font-size: 14px; }
.navbar nav a.active, .navbar nav a:hover { color: var(--text); }
.navbar-right { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.navbar .user-chip { font-size: 13px; color: var(--muted); }
.navbar .logout { color: var(--danger); }

@media (max-width: 480px) {
  .navbar { padding: 12px 16px; }
  .navbar-right { gap: 10px; width: 100%; justify-content: space-between; }
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--glass-border);
  margin-bottom: 20px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}
.grid { display: grid; gap: 16px; }
/* Grid items default to a min-width of "auto" (their own content's intrinsic
   size), which lets wide content (long titles, side-by-side controls) force
   the whole grid - and the page - wider than the viewport instead of
   shrinking/wrapping/truncating in place. This is what was pushing a
   horizontal scrollbar onto the whole admin page. */
.grid > div { min-width: 0; }
.grid-5 { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.grid-2 { grid-template-columns: 1.3fr 0.9fr; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

.slot {
  background: var(--card2);
  border: 1px dashed #ffffff22;
  border-radius: 12px;
  padding: 12px;
  min-height: 170px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.slot.filled { border-style: solid; border-color: #ffffff16; }
.slot img { width: 100%; border-radius: 8px; aspect-ratio: 16/9; object-fit: cover; }
.slot .title { font-size: 13px; margin: 8px 0 4px; line-height: 1.3; max-height: 2.6em; overflow: hidden; }
.slot .empty-label { color: var(--muted); text-align: center; margin: auto; font-size: 13px; }

.slot-thumb-wrap { position: relative; }
.slot-edit-btn {
  position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%;
  border: none; background: rgba(0,0,0,0.65); color: #fff; cursor: pointer; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.slot-edit-btn:hover { background: var(--accent); }
.slot-add-btn {
  width: 100%; height: 100%; min-height: 150px; border: none; background: transparent;
  color: var(--muted); font-size: 40px; font-weight: 300; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.slot-add-btn:hover { color: var(--text); }
.badge { display:inline-block; font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.badge.pending { background: #f1c40f22; color: #f1c40f; }
.badge.played { background: #2ecc7122; color: #2ecc71; }
.badge.removed { background: #ff6b6b22; color: #ff6b6b; }
.badge.draft { background: #8a8d9a22; color: var(--muted); }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 999; padding: 16px;
}
.modal-box { max-width: 560px; width: 100%; max-height: 85vh; overflow-y: auto; }

.btn {
  display: inline-block; padding: 8px 16px; border-radius: 8px; border: none;
  background: var(--accent); color: #fff; cursor: pointer; font-size: 14px; font-weight: 600;
}
.btn:hover { filter: brightness(1.1); }
.btn.danger { background: var(--danger); }
.btn.outline { background: transparent; border: 1px solid #ffffff30; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

input, select {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid #ffffff20;
  background: rgba(15, 17, 23, 0.55); color: var(--text); font-size: 14px;
}
label { font-size: 13px; color: var(--muted); display:block; margin-bottom: 6px; }
.form-row { margin-bottom: 14px; }

.flash {
  padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 14px;
  background: rgba(15, 17, 23, 0.82);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.flash.success { color: #4ade80; border: 1px solid rgba(46,204,113,0.45); }
.flash.error { color: #ff8585; border: 1px solid rgba(255,107,107,0.45); }
.flash.info { color: #2dd4cf; border: 1px solid rgba(0,206,201,0.45); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #ffffff12; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }

/* Tables don't reflow on phones - let them scroll sideways instead of
   squeezing every column unreadably thin. */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll table { min-width: 560px; }

.speaker-row {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px;
  margin-bottom: 14px; font-size: 13px; color: var(--muted);
}

/* Compact "Now Playing" card — round album-art thumbnail, title/subtitle,
   progress bar, and circular play controls, all in one row. */
#player-wrap { position: relative; }
.now-playing-card {
  display: flex; align-items: center; gap: 18px;
  background: var(--card2); border-radius: 16px; padding: 16px 18px;
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.np-thumb-wrap { position: relative; flex-shrink: 0; }
.np-thumb-round { width: 110px; height: 110px; border-radius: 14px; object-fit: cover; display: block; background: #000; }
@media (max-width: 480px) { .np-thumb-round { width: 80px; height: 80px; } }

/* Phones: thumb + title + controls in one row gets too tight even at the
   smaller thumb size - stack them instead. 480px (not 400px) so this
   actually covers common phone widths (360-430px), not just unusually
   narrow ones. */
@media (max-width: 480px) {
  .now-playing-card { flex-wrap: wrap; justify-content: center; text-align: center; }
  .np-info { flex-basis: 100%; min-width: 100%; }
  .np-info strong { white-space: normal; }
  .np-controls { flex-basis: 100%; justify-content: center; }
}

/* Little "now playing" equalizer bars, overlaid on the thumbnail's corner.
   Bounce continuously while playing; freeze low when paused. */
.eq-badge {
  position: absolute; left: 7px; bottom: 7px;
  display: none; align-items: flex-end; gap: 3px;
  background: rgba(0,0,0,0.6); padding: 5px 7px; border-radius: 7px;
  height: 18px; backdrop-filter: blur(4px);
}
.eq-badge.show { display: flex; }
.eq-badge span {
  width: 3px; min-height: 3px; background: var(--accent2); border-radius: 2px;
  animation: eq-bounce 0.9s ease-in-out infinite;
}
.eq-badge span:nth-child(1) { animation-delay: 0s; }
.eq-badge span:nth-child(2) { animation-delay: 0.2s; }
.eq-badge span:nth-child(3) { animation-delay: 0.4s; }
.eq-badge span:nth-child(4) { animation-delay: 0.1s; }
.eq-badge.paused span { animation-play-state: paused; height: 3px !important; }
@keyframes eq-bounce {
  0%, 100% { height: 3px; }
  50% { height: 16px; }
}
.np-info { flex: 1; min-width: 0; }
.np-info strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-sub { font-size: 12px; color: var(--muted); }
.np-controls { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.btn-circle {
  width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--accent); color: #fff;
  font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.btn-circle.outline { background: transparent; border: 1px solid #ffffff30; color: var(--text); width: 38px; height: 38px; font-size: 14px; }
.btn-circle:hover { filter: brightness(1.1); }
/* The real YouTube player stays in the DOM (so audio keeps playing + the API
   stays controllable) but is visually tucked away — the thumbnail above is
   the only thing anyone sees. */
#yt-player-hidden { position: absolute; width: 2px; height: 2px; opacity: 0; pointer-events: none; overflow: hidden; top: 0; left: 0; }
.progress-wrap {
  position: relative; height: 6px; border-radius: 4px; background: #ffffff18;
  margin-top: 10px; cursor: pointer; touch-action: none;
}
.progress-fill { position: absolute; top:0; left:0; height: 100%; width: 0%; background: var(--accent); border-radius: 4px; }
.progress-handle {
  position: absolute; top: 50%; left: 0%; width: 13px; height: 13px; border-radius: 50%;
  background: #fff; transform: translate(-50%, -50%); box-shadow: 0 0 0 3px #6c5ce766;
  pointer-events: none;
}
.progress-times { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }
.controls { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.mode-toggle { display:flex; flex-wrap: wrap; border: 1px solid #ffffff20; border-radius: 8px; overflow: hidden; }
.mode-toggle button { border: none; padding: 8px 14px; background: transparent; color: var(--muted); cursor:pointer; font-size: 13px; }
.mode-toggle button.active { background: var(--accent); color: #fff; }

.queue-list { list-style: none; margin: 0; padding: 0; }
.queue-list li { display:flex; align-items:center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #ffffff0c; font-size: 13px; }
.queue-list .pos { width: 22px; height:22px; border-radius:50%; background:#ffffff10; display:flex; align-items:center; justify-content:center; font-size:11px; flex-shrink: 0; }
.queue-list img { width: 48px; height: 32px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.queue-list .q-info { flex: 1; min-width: 0; }
.queue-list .q-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-list .emp { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-list .btn.sm { flex-shrink: 0; }
.queue-list .drag-handle { cursor: grab; color: var(--muted); flex-shrink: 0; font-size: 16px; touch-action: none; }
.queue-list li.sortable-ghost { opacity: 0.4; }
.queue-list li.sortable-chosen .drag-handle { cursor: grabbing; }

.stat-row { display:flex; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.stat-box {
  flex:1; min-width: 140px; background: var(--card); border-radius: 12px; padding: 16px; border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.stat-box .num { font-size: 26px; font-weight: 700; }
.stat-box .lbl { font-size: 12px; color: var(--muted); }

/* Employee's "today's slots" strip: on phone widths a grid collapses to one
   column (vertical stack) since nothing else fits minmax(190px,1fr) side by
   side. Switch it to a horizontal, swipeable strip instead. */
@media (max-width: 600px) {
  #slots-grid {
    display: flex;
    overflow-x: auto;
    gap: 12px;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
  }
  #slots-grid .slot {
    flex: 0 0 150px;
    min-width: 150px;
  }
}

/* Employee's read-only Up Next list: cap to ~5 visible rows, scroll for the rest. */
#employeeQueueList {
  max-height: 260px;
  overflow-y: auto;
}

.requester-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  background: #00cec922;
  color: var(--accent2);
  margin-top: 4px;
}

.tabs { display:flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.tabs button {
  background: var(--card2); color: var(--muted); border: 1px solid var(--glass-border);
  border-radius: 999px; padding: 8px 16px; font-size: 13px; cursor: pointer;
}
.tabs button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

@media (max-width: 480px) {
  .tabs { gap: 6px; }
  .tabs button { padding: 7px 12px; font-size: 12px; }
}
