/* ==========================================================================
   TOKENS & THEMES
   - Design tokens and theme overrides (light/dark).
   ========================================================================== */

/* ---- Accent + surface tokens (dark as base) ---- */
:root {
  --accent: #27a1ff;           /* brand blue (primary accent) */
  --accent-600: #198cff;       /* darker accent for gradients */
  --accent-700: #0f76df;       /* deepest accent for depth */
  --accent-25a: rgba(39,161,255,.25); /* shadow/glow helper */
  --ring: 0 0 0 3px rgba(39,161,255,.28); /* focus ring */

  --surface-0: #0f1114;  /* page background (far) */
  --surface-1: #171b20;  /* cards (base) */
  --surface-2: #1e242b;  /* inputs/secondary blocks */
  --surface-3: #262c34;  /* elevated surfaces */
  --text-1: #f3f5f7;     /* primary text */
  --text-2: #c7d1dc;     /* secondary text */
  --muted: #8a95a6;      /* muted UI text */

  --main-nav-height: 70px; /* sticky main nav height */
}

/* ---- Light mode overrides ---- */
[data-bs-theme="light"] {
  --surface-0: #f6f7fb;
  --surface-1: #ffffff;
  --surface-2: #f2f5f8;
  --surface-3: #eef3f8;
  --text-1: #0e1116;
  --text-2: #2b3340;
  --muted: #5c6777;
}


/* ==========================================================================
   BASE LAYER
   - Page background, selection, focus, scrollbars.
   ========================================================================== */

/* ---- Page background + base text (dark default) ---- */
html, body {
  color: var(--text-1);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(39,161,255,.08), transparent 60%),
    radial-gradient(900px 500px at 110% 20%, rgba(39,161,255,.06), transparent 55%),
    linear-gradient(180deg, var(--surface-0), var(--surface-1));
    height: 100%;
    display: flex;
    flex-direction: column;
}
#app {
  min-height: 100svh;           /* safer on mobile; use 100vh if you prefer */
  display: flex;
  flex-direction: column;
}

main {

  min-height: 0; /* prevents flexbox overflow issues */
  overflow: hidden;
}

/* ---- Light variant of hero background ---- */
[data-bs-theme="light"] body {
  background:
    radial-gradient(1200px 600px at -10% -10%, rgba(39,161,255,.10), transparent 60%),
    radial-gradient(900px 500px at 110% -10%, rgba(39,161,255,.07), transparent 55%),
    linear-gradient(180deg, #f9fbff, #f2f6fb);
  color: var(--text-1);
}

/* ---- Selection color ---- */
::selection { background: var(--accent); color: #fff; }

/* ---- Accessible focus rings for interactive elements ---- */
:where(input, textarea, select, button, .btn, .form-control, .form-select):focus-visible,
:where(.list-group-item, .card, .nav-link):focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-color: var(--accent) !important;
}

/* ---- SCROLLBARS REMOVED — using native browser defaults ---- */
/* (all ::-webkit-scrollbar rules deleted) */


/* ==========================================================================
   COMPONENTS: SURFACES & CONTENT
   - Cards, stream monitor, charts, video thumbnails.
   ========================================================================== */

/* ---- Card surfaces (elevated) ---- */
.card {
  background:
    linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,0)),
    var(--surface-3);
  border: 1px solid rgba(255,255,255,.06);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 30px rgba(0,0,0,.25), 0 0 0 1px rgba(39,161,255,.10) inset;
  border-color: rgba(39,161,255,.25);
}
[data-bs-theme="light"] .card {
  background:
    linear-gradient(180deg, rgba(255,255,255,.8), rgba(255,255,255,.6)),
    var(--surface-1);
  border: 1px solid rgba(11,27,43,.08);
  box-shadow: 0 2px 10px rgba(11,27,43,.06);
}

/* ---- Stream monitor lift ---- */
.stream-monitor {
  background: var(--surface-3);
  border: 1px solid rgba(255,255,255,.06);
  box-shadow: 0 10px 30px rgba(0,0,0,.16);
}
[data-bs-theme="light"] .stream-monitor {
  background: var(--surface-1);
  border-color: rgba(11,27,43,.08);
  box-shadow: 0 10px 24px rgba(11,27,43,.08);
}

/* ---- Charts slight lift ---- */
.chart-container {
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,0));
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.06);
  box-shadow: 0 6px 16px rgba(0,0,0,.14);
}
[data-bs-theme="light"] .chart-container {
  background: linear-gradient(180deg, rgba(11,27,43,.03), rgba(11,27,43,0));
  border-color: rgba(11,27,43,.08);
}

/* ---- Video thumbnails polish ---- */
.video-list .list-group-item img {
  border-radius: 0.8rem;
  box-shadow: 0 6px 14px rgba(0,0,0,.25), 0 0 0 1px rgba(255,255,255,.06) inset;
}
[data-bs-theme="light"] .video-list .list-group-item img {
  box-shadow: 0 6px 14px rgba(11,27,43,.12), 0 0 0 1px rgba(11,27,43,.06) inset;
}


/* ==========================================================================
   PAGINATION & LIST HOVERS
   - Pagination states and soft hover glow for list items.
   ========================================================================== */

.pagination .page-link {
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid rgba(255,255,255,.06);
  transition: transform .12s ease, box-shadow .12s ease, color .12s ease;
}
[data-bs-theme="light"] .pagination .page-link {
  background: var(--surface-1);
  border-color: rgba(11,27,43,.08);
}
.pagination .page-link:hover { color: var(--text-1); transform: translateY(-1px); }
.pagination .active .page-link,
.pagination .page-link.active {
  background: linear-gradient(180deg, var(--accent), var(--accent-600));
  color: #fff;
  box-shadow: 0 6px 16px var(--accent-25a);
}

/* ---- Hover glow for playlists/videos ---- */
.playlist-list .playlist-list-item:hover,
.playlist-list .playlist-list-item:focus,
.video-list .list-group-item:hover,
.video-list .list-group-item:focus {
  background: color-mix(in srgb, var(--surface-3) 80%, var(--accent) 20%) !important;
  box-shadow: 0 2px 14px var(--accent-25a);
}


/* ==========================================================================
   FORMS & TAGS
   - Tag input container, tag chips, input mono style, copy buttons.
   ========================================================================== */

/* ---- Tag input container ---- */
.tags-input-container {
  background: var(--surface-2);
  border-bottom-width: 3px;
  border-color: rgba(255,255,255,.12);
  border-radius: 10px;
  transition: box-shadow .15s ease, border-color .15s ease, background .15s ease;

  /* layout */
  display: flex;
  flex-wrap: wrap;        /* allow tags + input to wrap */
  align-items: center;
  padding: 8px 10px;
}
[data-bs-theme="light"] .tags-input-container {
  background: var(--surface-1);
  border-color: rgba(11,27,43,.12);
}
.tags-input-container:focus-within {
  border-color: var(--accent);
  box-shadow: 0 6px 20px var(--accent-25a), inset 0 -2px 0 var(--accent);
  background: linear-gradient(180deg, rgba(39,161,255,.06), transparent), var(--surface-2);
}

/* ---- Tag chips (badged, multiple per row) ---- */
.tags-input-container .tag {
  display: inline-flex;          /* keep them chip-sized */
  align-items: center;
  margin: 0 6px 6px 0;           /* spacing between chips */
  background: linear-gradient(180deg, var(--accent), var(--accent-600));
  color: #fff;
  padding: 6px 8px;
  border-radius: 999px;
  box-shadow: 0 4px 12px var(--accent-25a);
  gap: .35rem;
}
.tag:hover { filter: brightness(.98); transform: translateY(-1px); }
.tag-close { color: #eaf5ff; opacity: .9; cursor: pointer; }
.tag-close:hover { color: #fff; opacity: 1; }

/* ---- Input: full-width row *below* the tags ---- */
.tags-input-container input {
  flex: 0 0 100%;         /* force it onto its own full-width row */
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  padding: 4px 0 2px;
  margin-top: 2px;
}

/* If this input has .form-control from Bootstrap, keep it from fighting flex */
.tags-input-container input.form-control {
  flex: 0 0 100%;
  width: 100%;
}
/* ---- Monospace inputs (keys, URLs) ---- */
.mono-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: .9rem;
  letter-spacing: .01em;
}

/* ---- Copy button ---- */
.btn-copy {
  background: var(--surface-2);
  border: 1px solid rgba(255,255,255,.10);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.btn-copy:hover {
  transform: translateY(-1px);
  border-color: rgba(39,161,255,.35);
  box-shadow: 0 6px 14px var(--accent-25a);
}
[data-bs-theme="light"] .btn-copy {
  background: var(--surface-1);
  border-color: rgba(11,27,43,.12);
}


/* ==========================================================================
   STATUS & MICRO-ACCENTS
   - Tiny accents, pills, switches, live panel, collapsible creds.
   ========================================================================== */

/* ---- Tiny live clock accent ---- */
.current-time { color: var(--text-2); }
.current-time:after {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  margin-left: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff 5%, var(--accent) 40%, var(--accent-700) 100%);
  box-shadow: 0 0 12px var(--accent-25a);
}

/* ---- Global accent glow utility ---- */
.glow-accent { box-shadow: 0 8px 28px var(--accent-25a) !important; }

/* ---- Toggle switch (custom) ---- */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 25px;
}
.switch input { opacity: 0; width: 0; height: 0; }

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 34px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
}
.slider::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}
input:checked + .slider { background-color: #0f94f5; }
input:checked + .slider::before { transform: translateX(24px); }

/* ---- Live Now panel ---- */
.live-now-panel {
  width: 100%;
  background:
    linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,0)),
    var(--surface-3);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(0,0,0,.20);
}
[data-bs-theme="light"] .live-now-panel {
  background:
    linear-gradient(180deg, rgba(255,255,255,.82), rgba(255,255,255,.62)),
    var(--surface-1);
  border-color: rgba(11,27,43,.08);
  box-shadow: 0 10px 24px rgba(11,27,43,.08);
}

/* ---- Tiny status pill ---- */
.auto-badge {
  background: linear-gradient(180deg, var(--accent), var(--accent-600));
  color: #fff;
  padding: .35rem .6rem;
  border-radius: 999px;
  font-size: .75rem;
  letter-spacing: .02em;
  box-shadow: 0 6px 16px var(--accent-25a);
}

/* ---- Helper line text ---- */
.live-now-panel .helper { color: var(--text-2); max-width: 56ch; }

/* ---- Collapsible encoder credentials ---- */
.encoder-credentials {
  grid-template-rows: 0fr;
  display: grid;
  transition: grid-template-rows .28s ease, margin .28s ease, opacity .28s ease;
  opacity: 0;
  overflow: hidden;
  margin-top: 0;
}
.encoder-credentials.open {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: .75rem;
}
.encoder-credentials > * { min-height: 0; }

/* ---- Fine print ---- */
.fine-print { font-size: .8rem; }


/* ==========================================================================
   RESPONSIVE TWEAKS
   - Small-screen stacking for subnav card/title.
   ========================================================================== */

@media (max-width: 576px) {
  .subnav-card {
    flex-direction: column;
    align-items: stretch;
    gap: .5rem;
  }
  .subnav-title { font-size: 1rem; }
}


/* Sending state */
.badge-sending {
  color: #fff;
  background: linear-gradient(180deg, var(--accent), var(--accent-600));
  border: 1px solid rgba(39,161,255,.35);
  position: relative;
  overflow: hidden;
}
.badge-sending::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(255,255,255,.15) 30%, transparent 60%);
  transform: translateX(-100%);
  animation: shimmer 1.2s ease-in-out infinite;
}
@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Button reset to look like your pill badges */
.status-badge.btn { cursor: pointer; }
.status-badge.btn:disabled { opacity: .85; cursor: not-allowed; }
/* Error state */
.badge-error {
  color: #fff;
  background: linear-gradient(180deg, #ef4444, #b91c1c);
  border: 1px solid rgba(239,68,68,.4);
  animation: subtle-shake .35s ease-in-out 1;
}
.retry-btn {
  background: rgba(255,255,255,.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,.18);
  padding: .15rem .5rem;
  border-radius: 999px;
  line-height: 1.1;
}
.retry-btn:hover { filter: brightness(1.05); }

/* tiny entrance nudge for error */
@keyframes subtle-shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(2px); }
  50% { transform: translateX(-2px); }
  75% { transform: translateX(1px); }
  100% { transform: translateX(0); }
}


/* ==========================================================================
   player page
   ========================================================================== */
.waiting-message {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  max-width: 960px;
  aspect-ratio: 16 / 9;
  margin: 2rem auto;
  border: 2px solid rgba(200, 200, 200, 0.2);
  border-radius: 12px;
  color: #999;
  font-size: 1.8rem;
  font-weight: 500;
  font-family: "Inter", sans-serif;
  letter-spacing: 0.5px;
  background: transparent;
  position: relative;
}

.waiting-message span {
  animation: softPulse 2.5s ease-in-out infinite;
}

.waiting-message::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at center, rgba(255,255,255,0.05), transparent 70%);
  pointer-events: none;
}

@keyframes softPulse {
  0% {
    opacity: 0.5;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.03);
  }
  100% {
    opacity: 0.5;
    transform: scale(1);
  }
}

/* Nice pill-style button groups for queue */
.queue-btn-group.btn-group {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;          /* space between buttons */
  flex-wrap: wrap;
}

/* Reset Bootstrap's square-group look and make pills */
.queue-btn-group.btn-group > .btn {
  flex: 0 0 auto;
  border-radius: 999px !important;
  padding-inline: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Remove any tight border-joining look between group buttons */
.queue-btn-group.btn-group > .btn:not(:first-child),
.queue-btn-group.btn-group > .btn:not(:last-child) {
  border-radius: 999px !important;
}

/* Optional: smaller icon tweak */
.queue-btn-group .btn i {
  font-size: 0.9em;
}

/* Optional: subtle shadow so they feel clickable */
.queue-btn-group .btn {
  box-shadow: 0 0.15rem 0.3rem rgba(15, 23, 42, 0.08);
}

.sticky-top {
  position: sticky;
  top: 0;
  z-index: 1020;
}