/* ============================================================
   Ad Announcer Admin — "control room" theme
   A broadcast monitor bay: dark console, tally lights for status,
   monospace readouts for anything numeric/timestamped.
   ============================================================ */

:root {
  --bg:        #0b0d10;
  --panel:     #14171c;
  --panel-2:   #1b1f26;
  --line:      #262b33;
  --text:      #e7ebf0;
  --text-dim:  #8b93a1;
  --text-faint:#5a6272;

  --signal:    #2dd4bf;   /* primary accent — waveform teal */
  --signal-dim:#1b6f66;
  --live:      #f87171;   /* tally red — ad break active / on air */
  --live-dim:  #4a1f1f;
  --standby:   #fbbf24;   /* amber — pending/manual */
  --ok:        #34d399;   /* green — connected/healthy */
  --ok-dim:    #1c3d30;

  --radius: 6px;
  --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', 'Consolas', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
}

a { color: inherit; }

/* Faint scanline texture behind everything — control-room glass, not gimmick */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.012) 0px,
    rgba(255, 255, 255, 0.012) 1px,
    transparent 1px,
    transparent 3px
  );
  z-index: 999;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

.brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
}

.topbar nav { display: flex; gap: 20px; align-items: center; }
.topbar nav a {
  text-decoration: none;
  color: var(--text-dim);
  font-size: 0.9rem;
}
.topbar nav a:hover { color: var(--text); }

.topbar .logout {
  color: var(--text-faint);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 0.85rem;
}
.topbar .logout:hover { border-color: var(--live); color: var(--live); }

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 32px 80px;
}

h1 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 600;
  margin: 0 0 6px;
}

.subtitle {
  color: var(--text-dim);
  margin: 0 0 32px;
  font-size: 0.95rem;
}

/* ---- Auth pages (login / setup) ---- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px 32px;
}

.auth-card .brand { justify-content: center; margin-bottom: 4px; }
.auth-card .eyebrow {
  text-align: center;
  color: var(--text-faint);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 28px;
}

label {
  display: block;
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 6px;
  margin-top: 16px;
}
label:first-of-type { margin-top: 0; }

input[type="text"], input[type="password"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.92rem;
  outline: none;
}
input[type="text"]:focus, input[type="password"]:focus {
  border-color: var(--signal);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.15);
}

button, .btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 10px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: var(--signal);
  color: #04211d;
  width: 100%;
  justify-content: center;
  margin-top: 24px;
}
.btn-primary:hover { background: #4ee0cb; }

.btn-outline {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--signal); color: var(--signal); }

.error-banner {
  background: var(--live-dim);
  border: 1px solid var(--live);
  color: #ffd7d3;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 18px;
}

.success-banner {
  background: var(--ok-dim);
  border: 1px solid var(--ok);
  color: #c8f5e3;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 18px;
}

/* ---- Dashboard ---- */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.channel-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
}

.channel-card .name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 2px;
}

.channel-card .login {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  margin: 0 0 16px;
}

/* Tally light toggle — the signature element. Styled like an on-air
   indicator lamp: a lit ring when active, dark and hollow when off. */
.tally-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.tally-row:first-of-type { border-top: none; }

.tally-label {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.tally-switch {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  cursor: pointer;
  flex-shrink: 0;
}
.tally-switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--text-faint);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.tally-switch.on {
  border-color: var(--live);
  background: var(--live-dim);
}
.tally-switch.on::after {
  transform: translateX(18px);
  background: var(--live);
  box-shadow: 0 0 8px var(--live);
}

.card-footer {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-footer a {
  font-size: 0.82rem;
  color: var(--signal);
  text-decoration: none;
}
.card-footer a:hover { text-decoration: underline; }

.status-pill {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.status-pill.ok { background: var(--ok-dim); color: var(--ok); }
.status-pill.err { background: var(--live-dim); color: var(--live); }

.empty-state {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  color: var(--text-dim);
}
.empty-state code {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--signal);
}

/* ---- Channel detail / edit ---- */
.field-group {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  resize: vertical;
  min-height: 60px;
}

.hint {
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-top: 6px;
}

.back-link {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85rem;
}
.back-link:hover { color: var(--signal); }
