/* IPTV Panel — Apple "liquid glass" look, matching the Substation design.
   Dark mode is the default; light mode follows the system setting. */

:root {
  color-scheme: dark;
  /* wallpaper */
  --bg: #0b0a14;
  --blob-1: #2a1a6b; --blob-2: #3a1655; --blob-3: #1b1e5e; --blob-4: #4a1540;
  --blob-4-op: .55;
  /* glass */
  --glass: rgba(30,30,34,.62);
  --glass-strong: rgba(38,38,42,.82);
  --edge: rgba(255,255,255,.08);
  --fill: rgba(118,118,128,.24);
  --fill-soft: rgba(118,118,128,.14);
  --shadow: 0 20px 60px rgba(0,0,0,.45);
  /* text */
  --text-1: #f5f5f7;
  --text-2: rgba(235,235,245,.64);
  --text-3: rgba(235,235,245,.36);
  /* system colours */
  --blue: #0a84ff; --green: #30d158; --orange: #ff9f0a; --red: #ff453a;
  --purple: #bf5af2; --pink: #ff375f; --teal: #40c8e0; --indigo: #5e5ce6; --gray: #98989d;
  /* Panel accent: violet / indigo (distinct from the TV app's blue) */
  --accent: #5e5ce6; --accent-2: #8a6cf0;
  --accent-tint: rgba(94,92,230,.20); --accent-glow: rgba(94,92,230,.45);
  --blue-tint: rgba(10,132,255,.18);
  --radius-card: 20px; --radius-sm: 12px; --radius-side: 22px;
  --ease: cubic-bezier(.2,.8,.2,1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, Roboto, "Segoe UI", system-ui, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f0eef8;
    --blob-1: #d9d4ff; --blob-2: #ecd9ff; --blob-3: #dcd6ff; --blob-4: #ffd9f0; --blob-4-op: .7;
    --glass: rgba(255,255,255,.66); --glass-strong: rgba(255,255,255,.82);
    --edge: rgba(0,0,0,.06);
    --fill: rgba(120,120,128,.12); --fill-soft: rgba(120,120,128,.08);
    --shadow: 0 20px 60px rgba(60,60,80,.18);
    --text-1: #1d1d1f; --text-2: rgba(60,60,67,.66); --text-3: rgba(60,60,67,.38);
    --accent-tint: rgba(94,92,230,.14);
    --blue-tint: rgba(10,132,255,.12);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; letter-spacing: -.01em;
  color: var(--text-1); background: var(--bg); min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* --- drifting wallpaper --- */
.wallpaper { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--bg); }
.blob { position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%;
  filter: blur(80px); opacity: .9; animation: drift 38s var(--ease) infinite alternate; }
.blob.b1 { background: var(--blob-1); top: -10%; left: -8%; }
.blob.b2 { background: var(--blob-2); top: 20%; right: -12%; animation-delay: -8s; }
.blob.b3 { background: var(--blob-3); bottom: -14%; left: 18%; animation-delay: -16s; }
.blob.b4 { background: var(--blob-4); opacity: var(--blob-4-op); bottom: 6%; right: 6%; animation-delay: -24s; }
@keyframes drift {
  0%   { transform: translate(0,0) scale(1); }
  50%  { transform: translate(6%, 8%) scale(1.12); }
  100% { transform: translate(-5%, -6%) scale(1.04); }
}
@media (prefers-reduced-motion: reduce) { .blob { animation: none; } }

/* --- layout --- */
.shell { display: flex; gap: 20px; min-height: 100dvh; padding: 20px;
  padding-top: calc(20px + env(safe-area-inset-top, 0px)); }

/* --- sidebar --- */
.sidebar { flex: 0 0 256px; align-self: flex-start; position: sticky;
  top: calc(20px + env(safe-area-inset-top, 0px));
  background: var(--glass); backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid var(--edge); border-radius: var(--radius-side); box-shadow: var(--shadow);
  padding: 16px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; }
.brand .mark { width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(160deg, var(--accent), var(--purple)); }
.brand .name { font-weight: 700; letter-spacing: -.02em; }
.nav-group { margin-top: 10px; }
.nav-group h4 { margin: 10px 8px 6px; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-3); }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px;
  color: var(--text-1); text-decoration: none; transition: background .25s var(--ease); }
.nav-link:hover { background: var(--fill-soft); }
.nav-link.active { background: var(--fill); font-weight: 600; }
.nav-link .tile { width: 26px; height: 26px; border-radius: 7px; flex: 0 0 26px;
  display: grid; place-items: center; }
.tile svg { width: 15px; height: 15px; stroke: #fff; stroke-width: 2; fill: none;
  stroke-linecap: round; stroke-linejoin: round; }
.tile.blue { background: linear-gradient(160deg,#5e5ce6,#8a3fd1); }
.tile.green { background: linear-gradient(160deg,#30d158,#1a9e3e); }
.tile.purple { background: linear-gradient(160deg,#bf5af2,#8a3fd1); }
.tile.orange { background: linear-gradient(160deg,#ff9f0a,#d97700); }
.tile.gray { background: linear-gradient(160deg,#98989d,#6c6c70); }

/* --- main --- */
.main { flex: 1 1 auto; min-width: 0; max-width: 980px; }
.page-head { margin: 4px 2px 20px; }
.kicker { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3); }
.title { font-size: 34px; font-weight: 700; letter-spacing: -.03em; margin: 2px 0 4px; }
.subtitle { color: var(--text-2); }

.card { background: var(--glass); backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%); border: 1px solid var(--edge);
  border-radius: var(--radius-card); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.card h3 { margin: 0 0 12px; font-size: 15px; font-weight: 600; }

/* grouped rows */
.rows { border-radius: var(--radius-sm); overflow: hidden; background: var(--fill-soft); }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-bottom: 1px solid var(--edge); }
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1 1 auto; min-width: 0; }
.row .muted { color: var(--text-2); font-size: 13px; }
.mono { font-variant-numeric: tabular-nums; }

/* pills / badges */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px;
  border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.green { color: var(--green); background: rgba(48,209,88,.16); }
.pill.red { color: var(--red); background: rgba(255,69,58,.16); }
.pill.gray { color: var(--text-2); background: var(--fill); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.dot.live { animation: pulse 1.6s var(--ease) infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 34px; padding: 0 16px; border-radius: 999px; font-weight: 600; font-size: 14px;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: transform .2s var(--ease), background .25s var(--ease), box-shadow .25s var(--ease); }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 20px var(--accent-glow); }
.btn-primary:hover { background: var(--accent-2); }
.btn-secondary { background: var(--accent-tint); color: var(--accent-2); }
.btn-ghost { background: var(--fill-soft); color: var(--text-1); }

/* forms */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.field input { width: 100%; height: 40px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--edge); background: var(--fill-soft); color: var(--text-1);
  font-size: 15px; font-family: inherit; }
.field input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.hint { color: var(--text-3); font-size: 12px; margin-top: 6px; }
.alert { padding: 10px 12px; border-radius: 10px; font-size: 13px; margin-bottom: 14px;
  color: var(--red); background: rgba(255,69,58,.14); border: 1px solid rgba(255,69,58,.3); }

.empty { color: var(--text-2); text-align: center; padding: 28px 10px; }
.actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.spacer { flex: 1 1 auto; }

/* login */
.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: 100%; max-width: 380px; }

/* responsive: sidebar collapses under the main column on narrow screens */
@media (max-width: 760px) {
  .shell { flex-direction: column; padding: 14px; }
  .sidebar { flex-basis: auto; width: 100%; position: static; }
  .title { font-size: 28px; }
}
