/* ===== F1 Streams — Dark Theme ===== */

/* --- Design Tokens --- */
:root {
  /* Backgrounds */
  --bg-base: #0f0f13;
  --bg-surface: #1a1a24;
  --bg-elevated: #252536;
  --bg-input: #14141e;

  /* Accent */
  --accent-red: #e10600;
  --accent-red-hover: #ff1a14;
  --accent-red-glow: rgba(225, 6, 0, 0.35);
  --accent-teal: #00d2be;
  --accent-teal-glow: rgba(0, 210, 190, 0.25);

  /* Text */
  --text-primary: #f0f0f5;
  --text-secondary: #a0a0b4;
  --text-disabled: #5a5a6e;

  /* Status */
  --status-green: #00c853;
  --status-yellow: #ffc107;
  --status-red: #ff3d3d;

  /* Borders & Shadows */
  --border-color: #2a2a3d;
  --border-subtle: #1f1f30;
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-elevated: 0 8px 32px rgba(0, 0, 0, 0.6);
  --shadow-glow-red: 0 0 20px var(--accent-red-glow);

  /* Spacing */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s ease;

  /* Pico overrides */
  --pico-primary: var(--accent-red);
  --pico-primary-hover: var(--accent-red-hover);
  --pico-background-color: var(--bg-base);
  --pico-card-background-color: var(--bg-surface);
  --pico-card-border-color: var(--border-color);
  --pico-color: var(--text-primary);
  --pico-muted-color: var(--text-secondary);
  --pico-form-element-background-color: var(--bg-input);
  --pico-form-element-border-color: var(--border-color);
  --pico-form-element-color: var(--text-primary);
  --pico-form-element-focus-color: var(--accent-red);
}

.hidden { display: none !important; }

/* --- Base --- */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  margin: 0;
}

h1, h2, h3, h4, h5, h6,
.brand-title, .tab-btn, button {
  font-family: 'Titillium Web', 'Inter', system-ui, sans-serif;
}

/* --- Header --- */
header {
  background: var(--bg-surface);
  border-bottom: none;
  padding: 0.75rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.f1-logo {
  background: var(--accent-red);
  color: #fff;
  font-family: 'Titillium Web', sans-serif;
  font-weight: 900;
  font-size: 1.4rem;
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-sm);
  letter-spacing: -0.5px;
  line-height: 1.2;
  user-select: none;
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.2;
}

h1.brand-title {
  margin: 0;
  font-size: 1.35rem;
}

.brand-subtitle {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 400;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--status-green);
  margin-left: 0.5rem;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-green);
  animation: pulse-dot 1.5s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(0, 200, 83, 0.6); }
  50% { opacity: 0.7; box-shadow: 0 0 0 6px rgba(0, 200, 83, 0); }
}

/* Racing stripe */
.racing-stripe {
  height: 3px;
  background: linear-gradient(90deg, var(--accent-red) 0%, var(--accent-red) 50%, var(--accent-teal) 75%, var(--status-yellow) 100%);
}

/* Auth button */
header .auth-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

header .auth-section span {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

header .auth-section button,
header .auth-section #login-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.4rem 1rem;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin: 0;
}

header .auth-section button:hover,
header .auth-section #login-btn:hover {
  border-color: var(--accent-red);
  color: var(--accent-red);
  box-shadow: 0 0 12px var(--accent-red-glow);
}

/* --- Navigation --- */
.tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0.6rem 1.5rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
  align-items: center;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  margin: 0;
  line-height: 1;
}

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  padding: 0.45rem 1rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  white-space: nowrap;
}

.tab-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
  border-color: var(--border-color);
}

.tab-btn.active {
  background: var(--accent-red);
  color: #fff;
  border-color: var(--accent-red);
  box-shadow: 0 0 14px var(--accent-red-glow);
  font-weight: 700;
}

/* --- Tab Content --- */
.tab-content {
  display: none;
  padding: 1rem 1.5rem;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

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

/* --- Stream Grid --- */
.stream-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

/* --- Stream Card --- */
.stream-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
  position: relative;
  width: 280px;
  min-width: 220px;
  cursor: pointer;
}

.stream-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-red), var(--accent-teal));
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.stream-card:hover {
  border-color: var(--accent-red);
  box-shadow: 0 4px 20px rgba(225, 6, 0, 0.15);
}

.stream-card:hover::before {
  opacity: 1;
}

.stream-card .card-body {
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.stream-card .card-icon {
  width: 40px;
  height: 40px;
  color: var(--text-secondary);
}

.stream-card .card-icon svg {
  width: 100%;
  height: 100%;
}

.stream-card .card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  word-break: break-word;
}

.stream-card .card-url {
  font-size: 0.7rem;
  color: var(--text-disabled);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* Loading spinner */
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.stream-card .card-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.75rem;
  gap: 0.5rem;
  flex-shrink: 0;
  border-top: 1px solid var(--border-subtle);
}

.stream-card .card-bar .title {
  font-size: 0.85rem;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  font-weight: 500;
}

.stream-card .card-bar .card-actions {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.card-actions .icon-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  margin: 0;
  transition: all var(--transition-fast);
}

.card-actions .icon-btn svg {
  width: 16px;
  height: 16px;
}

.card-actions .icon-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
  background: var(--bg-elevated);
}

.card-actions .icon-btn.danger:hover {
  color: var(--status-red);
  border-color: var(--status-red);
  background: rgba(255, 61, 61, 0.1);
}

/* --- Submit Form --- */
.submit-form-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1rem;
}

.submit-form {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  margin-bottom: 0;
}

.submit-form input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  font-size: 0.9rem;
  margin-bottom: 0;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.submit-form input::placeholder {
  color: var(--text-disabled);
}

.submit-form input:focus {
  outline: none;
  border-color: var(--accent-red);
  box-shadow: 0 0 0 3px var(--accent-red-glow);
}

.submit-form button {
  white-space: nowrap;
  margin-bottom: 0;
}

/* --- Buttons --- */
button, [type="submit"] {
  font-family: 'Titillium Web', 'Inter', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-primary, .submit-form button, .section-header button {
  background: var(--accent-red);
  border: none;
  color: #fff;
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius-sm);
}

.btn-primary:hover, .submit-form button:hover, .section-header button:hover {
  background: var(--accent-red-hover);
  box-shadow: var(--shadow-glow-red);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.55rem 1.25rem;
}

.btn-secondary:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.btn-danger-sm {
  background: transparent;
  border: 1px solid var(--status-red);
  color: var(--status-red);
  padding: 0.3rem 0.7rem;
  font-size: 0.75rem;
}

.btn-danger-sm:hover {
  background: rgba(255, 61, 61, 0.15);
}

.btn-primary-sm {
  background: var(--accent-red);
  border: none;
  color: #fff;
  padding: 0.3rem 0.7rem;
  font-size: 0.75rem;
}

.btn-primary-sm:hover {
  background: var(--accent-red-hover);
  box-shadow: 0 0 10px var(--accent-red-glow);
}

.btn-secondary-sm {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.3rem 0.7rem;
  font-size: 0.75rem;
}

.btn-secondary-sm:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

/* --- Reddit Links --- */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.section-header h3 {
  margin: 0;
  font-family: 'Titillium Web', sans-serif;
  font-weight: 700;
  color: var(--text-primary);
  font-size: 1.1rem;
}

.section-header button svg {
  width: 16px;
  height: 16px;
  vertical-align: -2px;
  margin-right: 0.3rem;
}

.link-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.link-list li {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  transition: all var(--transition-fast);
  animation: slideIn var(--transition-slow) ease both;
}

.link-list li:hover {
  border-color: var(--accent-teal);
  transform: translateX(4px);
  background: var(--bg-elevated);
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

.link-list li:nth-child(1) { animation-delay: 0s; }
.link-list li:nth-child(2) { animation-delay: 0.04s; }
.link-list li:nth-child(3) { animation-delay: 0.08s; }
.link-list li:nth-child(4) { animation-delay: 0.12s; }
.link-list li:nth-child(5) { animation-delay: 0.16s; }
.link-list li:nth-child(6) { animation-delay: 0.2s; }
.link-list li:nth-child(7) { animation-delay: 0.24s; }
.link-list li:nth-child(8) { animation-delay: 0.28s; }
.link-list li:nth-child(9) { animation-delay: 0.32s; }
.link-list li:nth-child(10) { animation-delay: 0.36s; }

.link-list li .link-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-list li .link-title a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.link-list li .link-title a:hover {
  color: var(--accent-teal);
}

.link-source-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  background: rgba(0, 210, 190, 0.12);
  color: var(--accent-teal);
  white-space: nowrap;
  border: 1px solid rgba(0, 210, 190, 0.25);
}

.link-open-icon {
  color: var(--text-disabled);
  flex-shrink: 0;
  transition: color var(--transition-fast);
}

.link-open-icon-wrap {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.link-list li:hover .link-open-icon,
.link-open-icon-wrap:hover .link-open-icon {
  color: var(--accent-teal);
}

.badge-imported {
  background: rgba(0, 210, 190, 0.15);
  color: var(--accent-teal);
  border: 1px solid rgba(0, 210, 190, 0.3);
}

.btn-import {
  background: var(--accent-teal);
  border: none;
  color: var(--bg-base);
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.btn-import:hover {
  background: #00e8d0;
  box-shadow: 0 0 12px var(--accent-teal-glow);
  transform: translateY(-1px);
}

/* --- Admin --- */
.admin-stats {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  flex: 1;
  text-align: center;
}

.stat-card .stat-number {
  font-family: 'Titillium Web', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.stat-card .stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  margin-top: 0.3rem;
}

.admin-stream {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  gap: 1rem;
  transition: border-color var(--transition-fast);
}

.admin-stream:hover {
  border-color: var(--accent-red);
}

.admin-stream .info {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.published {
  background: var(--status-green);
  box-shadow: 0 0 6px rgba(0, 200, 83, 0.5);
  animation: pulse-dot 1.5s ease-in-out infinite;
}

.status-dot.draft {
  background: var(--status-yellow);
}

.admin-stream .info .stream-details {
  overflow: hidden;
}

.admin-stream .info .stream-title {
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.admin-stream .info .stream-url {
  font-size: 0.8rem;
  color: var(--text-disabled);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-stream .info .stream-submitter {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.admin-stream .actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.badge {
  display: inline-block;
  font-size: 0.65rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-published {
  background: rgba(0, 200, 83, 0.15);
  color: var(--status-green);
  border: 1px solid rgba(0, 200, 83, 0.3);
}

.badge-draft {
  background: rgba(255, 193, 7, 0.15);
  color: var(--status-yellow);
  border: 1px solid rgba(255, 193, 7, 0.3);
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 4rem 1.5rem;
  color: var(--text-secondary);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
}

.empty-state .empty-title {
  font-family: 'Titillium Web', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.empty-state .empty-desc {
  font-size: 0.9rem;
  color: var(--text-disabled);
  max-width: 360px;
  margin: 0 auto;
}

/* --- Auth Dialog --- */
dialog {
  border: none;
  padding: 0;
  background: transparent;
  max-width: 420px;
  width: 90%;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
}

dialog > article {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem 1.5rem;
  position: relative;
  box-shadow: var(--shadow-elevated);
  animation: dialogIn 0.3s ease;
  max-width: none;
}

@keyframes dialogIn {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.dialog-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text-disabled);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  margin: 0;
  border-radius: var(--radius-sm);
  line-height: 1;
  transition: color var(--transition-fast);
}

.dialog-close:hover {
  color: var(--text-primary);
}

.dialog-logo {
  text-align: center;
  margin-bottom: 1rem;
}

.dialog-logo .f1-logo {
  font-size: 1.8rem;
  padding: 0.2rem 0.8rem;
  display: inline-block;
}

dialog .dialog-title {
  text-align: center;
  font-family: 'Titillium Web', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.25rem;
}

dialog .dialog-subtitle {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0 0 1.25rem;
}

/* Segmented control tabs */
dialog .dialog-tabs {
  display: flex;
  background: var(--bg-input);
  border-radius: var(--radius-pill);
  padding: 3px;
  margin-bottom: 1.5rem;
  gap: 0;
}

dialog .dialog-tab-btn {
  flex: 1;
  background: none;
  border: none;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  padding: 0.45rem;
  margin: 0;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  transition: all var(--transition-fast);
}

dialog .dialog-tab-btn.active {
  background: var(--accent-red);
  color: #fff;
  box-shadow: 0 2px 8px var(--accent-red-glow);
}

dialog label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

dialog input[type="text"] {
  width: 100%;
  margin-bottom: 0.25rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
  box-sizing: border-box;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

dialog input[type="text"]:focus {
  outline: none;
  border-color: var(--accent-red);
  box-shadow: 0 0 0 3px var(--accent-red-glow);
}

dialog .error-msg {
  color: var(--status-red);
  font-size: 0.8rem;
  min-height: 1.25rem;
  margin-bottom: 0.75rem;
}

dialog .auth-form-group button {
  width: 100%;
  margin-bottom: 0;
  background: var(--accent-red);
  border: none;
  color: #fff;
  padding: 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

dialog .auth-form-group button:hover {
  background: var(--accent-red-hover);
  box-shadow: var(--shadow-glow-red);
}

dialog .dialog-cancel {
  width: 100%;
  margin-top: 0.75rem;
  margin-bottom: 0;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.55rem;
}

dialog .dialog-cancel:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

/* --- Toast Notifications --- */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
  max-width: 380px;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: var(--shadow-elevated);
  pointer-events: auto;
  animation: toastIn 0.3s ease;
  border-left: 4px solid var(--border-color);
  font-size: 0.9rem;
  color: var(--text-primary);
}

.toast.toast-out {
  animation: toastOut 0.25s ease forwards;
}

.toast.success { border-left-color: var(--status-green); }
.toast.error { border-left-color: var(--status-red); }
.toast.warning { border-left-color: var(--status-yellow); }
.toast.info { border-left-color: var(--accent-teal); }

.toast-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-disabled);
  cursor: pointer;
  padding: 0;
  margin: 0;
  font-size: 1rem;
  line-height: 1;
}

.toast-close:hover {
  color: var(--text-primary);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}

/* --- Confirm Dialog --- */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.confirm-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 360px;
  width: 90%;
  box-shadow: var(--shadow-elevated);
  animation: dialogIn 0.25s ease;
}

.confirm-box .confirm-msg {
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  text-align: center;
}

.confirm-box .confirm-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.confirm-box .confirm-actions button {
  padding: 0.5rem 1.5rem;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  min-width: 90px;
}

/* --- Reddit Viewer Overlay --- */
.reddit-viewer {
  position: fixed;
  top: 90px;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.2s ease;
}

.reddit-viewer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1rem;
  gap: 0.75rem;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.reddit-viewer-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.reddit-viewer-close {
  background: none;
  border: none;
  color: var(--text-disabled);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  margin: 0;
  border-radius: var(--radius-sm);
  line-height: 1;
  transition: color var(--transition-fast);
  flex-shrink: 0;
}

.reddit-viewer-close:hover {
  color: var(--text-primary);
}

.reddit-viewer-content {
  flex: 1;
  overflow: auto;
  position: relative;
}

.reddit-viewer-content .loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  z-index: 2;
}

/* --- Browser Session Viewer Overlay --- */
.browser-viewer {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 120px);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-base);
  margin: 0;
}

.browser-viewer-bar {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  gap: 0.5rem;
  flex-shrink: 0;
  border-bottom: 2px solid var(--border-color);
  background: var(--bg-surface);
}

.browser-url-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text-disabled);
}

.browser-url-bar {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.75rem;
  overflow: hidden;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.browser-url-text {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.browser-viewer-status {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.browser-viewer-status.connected {
  color: var(--status-green);
}

.browser-open-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  text-decoration: none;
}

.browser-open-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
  background: var(--bg-elevated);
}

.browser-open-btn svg {
  width: 16px;
  height: 16px;
}

.browser-viewer-close {
  background: none;
  border: 1px solid var(--accent-red);
  color: var(--accent-red);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.15rem 0.6rem;
  margin: 0;
  border-radius: var(--radius-sm);
  line-height: 1;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  font-weight: 600;
}

.browser-viewer-close:hover {
  background: var(--accent-red);
  color: #fff;
}

.browser-viewer-content {
  flex: 1;
  overflow: hidden;
  position: relative;
  background: #000;
  min-height: calc(100vh - 180px);
}

.browser-video {
  max-width: 100%;
  max-height: 100%;
  cursor: default;
  display: block;
}

.browser-iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

#clappr-player {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
}

.browser-viewer-content .loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  z-index: 2;
}

/* --- Footer --- */
footer {
  text-align: center;
  padding: 1.5rem;
  margin-top: 2rem;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-disabled);
  font-size: 0.8rem;
}

footer p {
  margin: 0;
}

/* --- Responsive --- */
@media (max-width: 640px) {
  .stream-card {
    width: 100%;
  }

  header {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
  }

  .tabs {
    padding: 0.5rem 1rem;
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .hamburger {
    display: flex;
    align-items: center;
  }

  .tabs .tab-btn {
    display: none;
  }

  .tabs.open .tab-btn {
    display: inline-flex;
    width: 100%;
    justify-content: center;
  }

  .submit-form {
    flex-direction: column;
  }

  .submit-form input,
  .submit-form button {
    width: 100%;
  }

  .admin-stream {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .admin-stream .actions {
    width: 100%;
    justify-content: flex-end;
  }

  .admin-stats {
    flex-direction: column;
  }

  .toast-container {
    left: 1rem;
    right: 1rem;
    max-width: none;
  }

  .tab-btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }

  .link-list li {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

@media (max-width: 480px) {
  .brand-subtitle {
    display: none;
  }
}
