/* ============================================================================
   MODERN CHURCH STREAMING INTERFACE - COMPLETE REDESIGN
   ============================================================================ */

:root {
  --sans: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --serif: 'Crimson Text', Georgia, serif;
  
  /* Theme Colors - Professional & Spiritual */
  --primary: #2c3e50;
  --primary-light: #34495e;
  --accent: #e74c3c;
  --accent-soft: #ecf0f1;
  --success: #27ae60;
  --warning: #f39c12;
  --text-primary: #2c3e50;
  --text-secondary: #7f8c8d;
  --text-light: #bdc3c7;
  --bg-light: #f8f9fa;
  --bg-lighter: #ffffff;
  --border-color: #e0e0e0;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
  
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  :root {
    --primary: #ecf0f1;
    --primary-light: #bdc3c7;
    --text-primary: #ecf0f1;
    --text-secondary: #95a5a6;
    --text-light: #7f8c8d;
    --bg-light: #1a1a1a;
    --bg-lighter: #262626;
    --border-color: #3a3a3a;
  }
}

/* ============================================================================
   RESET & BASE STYLES
   ============================================================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--sans);
  color: var(--text-primary);
  background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-lighter) 100%);
  min-height: 100vh;
  line-height: 1.6;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================================
   TYPOGRAPHY
   ============================================================================ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.5px;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p { margin-bottom: var(--spacing-sm); }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* ============================================================================
   LAYOUT & CONTAINER
   ============================================================================ */

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
}

@media (max-width: 768px) {
  .container {
    padding: 0 var(--spacing-md);
  }
}

/* ============================================================================
   NAVBAR / HEADER
   ============================================================================ */

.navbar {
  background: var(--bg-lighter);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
  animation: slideDown 0.5s ease-out;
}

.navbar-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-md) var(--spacing-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  flex: 1;
}

.navbar-logo {
  width: 56px;
  height: 56px;
}

.navbar-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.site-title {
  font-size: 2.8rem;
  color: var(--primary);
  margin: 0;
}

.site-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
}

.navbar-status {
  display: flex;
  gap: var(--spacing-md);
  align-items: center;
}

body[data-admin="1"] {
  background: #f4f6f8;
  color: #1f2933;
}

body[data-admin="1"] .navbar,
body[data-admin="1"] .stats-card,
body[data-admin="1"] .scw-card,
body[data-admin="1"] .info-card,
body[data-admin="1"] .table-wrapper {
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  border-color: #d5dce5;
}

body[data-admin="1"] .site-title {
  font-size: 1.8rem;
  letter-spacing: 0;
}

body[data-admin="1"] .main-content {
  gap: var(--spacing-md);
}

/* ============================================================================
   STATUS BADGE
   ============================================================================ */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  transition: all var(--transition-normal);
}

.status-offline {
  background: #ffe0e0;
  color: #c0392b;
}

.status-offline:hover {
  background: #ffc0c0;
}

.status-online {
  background: #e0ffe0;
  color: #27ae60;
}

.status-online:hover {
  background: #c0ffc0;
}

/* ============================================================================
   MAIN CONTENT
   ============================================================================ */

.main-content {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xl);
  padding: var(--spacing-xl) 0;
}

/* ============================================================================
   HERO PLAYER SECTION
   ============================================================================ */

.hero-section {
  padding: 0;
}

.player-wrapper {
  position: relative;
  width: 100%;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow-lg);
  animation: fadeInScale 0.6s ease-out;
}

.video-container {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 aspect ratio */
  overflow: hidden;
  background: #000;
}

.video-player {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
}

/* ============================================================================
   PLAYER OVERLAYS
   ============================================================================ */

.offline-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(44, 62, 80, 0.95) 0%, rgba(44, 62, 80, 0.88) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  animation: fadeIn 0.3s ease-out;
}

.offline-box {
  text-align: center;
  color: white;
}

.offline-icon {
  width: 64px;
  height: 64px;
  margin-bottom: var(--spacing-lg);
  opacity: 0.8;
}

.offline-box h2 {
  font-size: 1.75rem;
  margin-bottom: var(--spacing-sm);
  color: white;
}

.offline-box p {
  font-size: 1rem;
  opacity: 0.9;
  margin: 0;
}

.offline.hidden,
.unmute-overlay.hidden,
.audio-player.hidden {
  display: none !important;
}

/* ============================================================================
   AUDIO PLAYER & VISUALIZER
   ============================================================================ */

.audio-player {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-lg);
  background: linear-gradient(135deg, rgba(44, 62, 80, 0.92) 0%, rgba(44, 62, 80, 0.88) 100%);
  z-index: 10;
}

.audio-visualizer {
  position: relative;
  width: 100%;
  height: 50px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  padding: 0 20px;
}

.audio-eq {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  width: 100%;
  height: 100%;
  max-width: 300px;
}

.audio-eq span {
  width: 4px;
  background: linear-gradient(to top, #e74c3c, #3498db);
  border-radius: 2px;
  flex: 1;
  opacity: 0.7;
  animation: audioBar 0.6s ease-in-out infinite;
  animation-play-state: paused;
}

.audio-player:not(.hidden) .audio-eq span {
  animation-play-state: running;
}

@keyframes audioBar {
  0%, 100% { height: 30%; }
  50% { height: 100%; }
}

.audio-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md) var(--spacing-lg);
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  backdrop-filter: blur(10px);
}

.audio-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-2px);
}

.audio-icon {
  width: 32px;
  height: 32px;
}

/* ============================================================================
   UNMUTE OVERLAY
   ============================================================================ */

.unmute-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  z-index: 5;
  animation: fadeIn 0.3s ease-out;
}

.unmute-btn {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md) var(--spacing-lg);
  background: white;
  color: var(--primary);
  border: none;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-normal);
}

.unmute-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  background: var(--accent-soft);
}

.unmute-btn svg {
  width: 24px;
  height: 24px;
}

/* ============================================================================
   PLAYER CONTROLS
   ============================================================================ */

.player-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-lg);
  margin-top: var(--spacing-lg);
  flex-wrap: wrap;
}

.control-left {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.control-right {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  flex-wrap: wrap;
}

.viewer-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--accent-soft);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
}

.node-name-tag {
  display: inline-flex;
  align-items: center;
  margin-left: 2px;
  font-size: 0.72em;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  color: var(--text-secondary);
  opacity: 0.6;
  white-space: nowrap;
}

/* ============================================================================
   CONTROL TOGGLES
   ============================================================================ */

.control-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.control-toggle input {
  display: none;
}

.toggle-box {
  position: relative;
  width: 48px;
  height: 26px;
  background: var(--text-light);
  border-radius: 999px;
  transition: background var(--transition-normal);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.toggle-box::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  background: white;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: transform var(--transition-normal);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.control-toggle input:checked + .toggle-box {
  background: var(--success);
}

.control-toggle input:checked + .toggle-box::after {
  transform: translateX(22px);
}

.toggle-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  transition: color var(--transition-normal);
}

.control-toggle input:checked + .toggle-box + .toggle-label {
  color: var(--success);
}

/* ============================================================================
   CONTENT SECTION & CARDS
   ============================================================================ */

.content-section {
  padding: var(--spacing-xl) 0;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-lg);
}

@media (max-width: 800px) {
  .content-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================================
   INFO CARDS
   ============================================================================ */

.info-card {
  background: var(--bg-lighter);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow);
  transition: all var(--transition-normal);
  animation: slideUp 0.6s ease-out;
}

.info-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

.card-primary {
  animation-delay: 0.1s;
}

.card-secondary {
  animation-delay: 0.2s;
}

.card-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--accent) 0%, #3498db 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--spacing-md);
}

.card-icon svg {
  width: 28px;
  height: 28px;
  color: white;
  stroke-width: 2;
}

.card-title {
  font-size: 1.25rem;
  margin-bottom: var(--spacing-md);
  color: var(--primary);
}

.card-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.card-list li {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: var(--spacing-md);
}

.card-icon-inline {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  margin-right: 8px;
  display: inline;
}

.schedule-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.schedule-item {
  padding: var(--spacing-md);
  background: var(--bg-light);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--accent);
  transition: all var(--transition-normal);
}

.schedule-item:hover {
  transform: translateX(4px);
  background: var(--accent-soft);
}

.schedule-item.is-today {
  border-color: var(--success);
  background: #e8f8f5;
}

.schedule-item.is-live {
  border-color: var(--accent);
  background: #fadbd8;
  font-weight: 600;
}

.schedule-date {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.schedule-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.schedule-time {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.schedule-empty {
  text-align: center;
  padding: var(--spacing-lg);
  color: var(--text-secondary);
  font-style: italic;
}

.schedule-tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 700;
  color: var(--accent);
}

.schedule-item.is-live .schedule-tag {
  color: var(--success);
}

.card-footnote {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: var(--spacing-md);
  text-align: center;
}

/* ============================================================================
   DEBUG PANEL
   ============================================================================ */

.debug-panel {
  margin-top: var(--spacing-lg);
  padding: var(--spacing-md);
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: var(--radius-md);
  color: #856404;
  font-size: 0.85rem;
  font-family: monospace;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
  line-height: 1.4;
}

/* ============================================================================
   STATS SECTION
   ============================================================================ */

.stats-section {
  padding: var(--spacing-xl) 0;
  border-top: 1px solid var(--border-color);
}

.stats-card {
  background: var(--bg-lighter);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow);
}

.stats-title {
  margin-bottom: var(--spacing-lg);
  font-size: 1.5rem;
}

.stats-content {
  position: relative;
}

#stats-canvas {
  width: 100%;
  height: auto;
  display: block;
}

.stats-empty {
  text-align: center;
  padding: var(--spacing-xl);
  color: var(--text-secondary);
}

.stats-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: end;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-sm);
}

.stats-controls {
  display: flex;
  gap: var(--spacing-sm);
  align-items: end;
  flex-wrap: wrap;
}

.stats-control {
  display: grid;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stats-control select {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  min-height: 38px;
  padding: 0 12px;
  font: inherit;
  color: var(--text-primary);
  background: var(--bg-light);
}

.admin-summary-card {
  padding: var(--spacing-md);
}

.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--spacing-sm);
}

.admin-kpi {
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.7rem 0.9rem;
}

.admin-kpi-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.admin-kpi strong {
  font-size: 1.05rem;
}

.admin-kpi-value {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  flex-wrap: wrap;
}

/* ============================================================================
   SATELLITES SECTION
   ============================================================================ */

.satellites-section {
  padding: var(--spacing-xl) 0;
  border-top: 1px solid var(--border-color);
}

.section-title {
  margin-bottom: var(--spacing-lg);
  font-size: 1.5rem;
}

.table-wrapper {
  background: var(--bg-lighter);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  padding: var(--spacing-md);
  text-align: left;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table td {
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--border-color);
}

.data-table tbody tr:hover {
  background: var(--bg-light);
}

.data-table tfoot td {
  background: var(--bg-light);
  font-weight: 600;
}

.empty-state {
  text-align: center;
  color: var(--text-secondary);
  font-style: italic;
  padding: var(--spacing-xl) !important;
}

.scw-card {
  display: grid;
  gap: var(--spacing-lg);
  background: var(--bg-lighter);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow);
}

.scw-catalog {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-light);
  overflow: hidden;
}

.scw-catalog-summary {
  cursor: pointer;
  padding: var(--spacing-md) var(--spacing-lg);
  font-weight: 600;
  color: var(--text-primary);
  list-style: none;
}

.scw-catalog-summary::-webkit-details-marker {
  display: none;
}

.scw-catalog-summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.6rem;
  transition: transform 0.18s ease;
}

.scw-catalog[open] .scw-catalog-summary::before {
  transform: rotate(90deg);
}

.scw-catalog .table-wrapper {
  border: 0;
  border-top: 1px solid var(--border-color);
  border-radius: 0;
  box-shadow: none;
}

.scw-copy,
.scw-meta,
.scw-status {
  margin: 0;
  color: var(--text-secondary);
}

.admin-login-card {
  max-width: 32rem;
  margin: 4rem auto 0;
}

.admin-logout-form {
  margin: 0;
}

.scw-status {
  min-height: 1.4em;
}

.scw-status-error {
  color: #dc2626;
}

.scw-total-value {
  white-space: nowrap;
}

.scw-form {
  display: grid;
  gap: var(--spacing-md);
}

.scw-submit-group {
  margin: 0;
  padding: var(--spacing-lg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-light);
}

.scw-submit-legend {
  padding: 0 0.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.scw-choice-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.scw-choice-group {
  display: grid;
  gap: 0.6rem;
}

.scw-choice-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.scw-radio-grid {
  display: grid;
  gap: 0.6rem;
}

.scw-radio-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 48px;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-lighter);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color var(--transition-normal), background var(--transition-normal), box-shadow var(--transition-normal);
}

.scw-radio-option:has(input:checked) {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, var(--bg-lighter));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 30%, transparent);
}

.scw-radio-option input {
  margin: 0;
  accent-color: var(--primary);
}

.scw-field {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.scw-field input,
.scw-field select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-light);
  color: var(--text-primary);
  padding: 0 14px;
  font: inherit;
}

.scw-actions {
  display: flex;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

.scw-button,
.scw-inline-button {
  min-height: 44px;
  border-radius: var(--radius-md);
  padding: 0 16px;
  font-weight: 600;
  transition: transform var(--transition-normal), opacity var(--transition-normal);
}

.scw-button {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
}

.scw-button-secondary {
  background: var(--bg-light);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.scw-inline-button {
  min-height: 34px;
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}

.scw-inline-button:disabled,
.scw-inline-button-pending {
  opacity: 0.7;
  cursor: wait;
}

.scw-external-label {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
}

body[data-admin="1"] .data-table {
  font-size: 0.82rem;
}

body[data-admin="1"] .data-table th,
body[data-admin="1"] .data-table td {
  padding: 0.6rem 0.65rem;
}

body[data-admin="1"] .section-title,
body[data-admin="1"] .card-title {
  font-size: 1.2rem;
}

body[data-admin="1"] .content-section,
body[data-admin="1"] .stats-section,
body[data-admin="1"] .satellites-section {
  padding: var(--spacing-md) 0;
}

body[data-admin="1"] .stats-title {
  margin-bottom: 0;
  font-size: 1.35rem;
}

.scw-button:hover,
.scw-inline-button:hover {
  transform: translateY(-1px);
}

/* ============================================================================
   FOOTER
   ============================================================================ */

.footer {
  background: var(--primary);
  color: white;
  padding: var(--spacing-xl) 0;
  margin-top: var(--spacing-xl);
  text-align: center;
}

.footer-content {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--spacing-md);
  font-size: 0.95rem;
}

.footer-link {
  color: var(--accent-soft);
  font-weight: 600;
  transition: color var(--transition-normal);
}

.footer-link:hover {
  color: white;
}

.footer-sep {
  opacity: 0.6;
}

.footer-text {
  opacity: 0.9;
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 768px) {
  .navbar-container {
    flex-direction: column;
    gap: var(--spacing-md);
    align-items: flex-start;
  }

  .scw-actions {
    flex-direction: column;
  }

  .scw-choice-columns {
    grid-template-columns: 1fr;
  }

  .scw-button,
  .scw-inline-button {
    width: 100%;
  }

  .navbar-status {
    width: 100%;
    justify-content: space-between;
  }

  .site-title {
    font-size: 1.25rem;
  }

  .navbar-logo {
    width: 48px;
    height: 48px;
  }

  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }

  .player-controls {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }

  .control-right {
    width: 100%;
    justify-content: space-between;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .main-content {
    gap: var(--spacing-lg);
    padding: var(--spacing-lg) 0;
  }

  .info-card {
    padding: var(--spacing-md);
  }

  .footer-content {
    flex-direction: column;
    gap: var(--spacing-sm);
  }

  .footer-sep {
    display: none;
  }
}

@media (max-width: 480px) {
  :root {
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
  }

  .site-title {
    font-size: 1rem;
  }

  .site-subtitle {
    display: none;
  }

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  h3 { font-size: 1rem; }

  .card-title {
    font-size: 1rem;
  }

  .navbar-logo {
    width: 40px;
    height: 40px;
  }

  .control-toggle {
    font-size: 0.85rem;
  }

  .viewer-count {
    font-size: 0.8rem;
    padding: 6px 12px;
  }
}

/* ============================================================================
   ACCESSIBILITY & UTILITIES
   ============================================================================ */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.hidden { display: none !important; }

/* ============================================================================
   THEME VARIABLES
   ============================================================================ */

html[data-theme="stephanus"] {
  --ink: #17130f;
  --wine: #8b2b2e;
  --wine-dark: #5f1a1c;
  --sand: #f7f1e7;
  --mist: #f2efe9;
  --stone: #e6ddd0;
  --cloud: #fcfbf8;
  --muted: #6f6760;
  --stroke: rgba(27, 19, 15, 0.12);
  --glass: rgba(255, 255, 255, 0.82);
  --shadow: 0 28px 60px rgba(25, 18, 14, 0.16);
  --shadow-soft: 0 18px 36px rgba(25, 18, 14, 0.12);
  --shadow-lg: 0 32px 80px rgba(25, 18, 14, 0.22);
  --page-bg-top: #fbf7f0;
  --page-bg-bottom: #efe5d6;
  --page-glow-1: rgba(139, 43, 46, 0.18);
  --page-glow-2: rgba(245, 210, 157, 0.25);
  --panel: rgba(255, 255, 255, 0.86);
  --panel-strong: rgba(255, 255, 255, 0.92);
  --panel-solid: #ffffff;
  --switch-track: #d9d1c7;
  --ghost-bg: rgba(255, 255, 255, 0.7);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
}
html[data-theme="ocean"] {
  --ink: #0d1b24;
  --wine: #1b8e7e;
  --wine-dark: #0e5c52;
  --sand: #ecf6f4;
  --mist: #e6f0ee;
  --stone: #d7e7e3;
  --cloud: #f7fbfb;
  --muted: #4d6a6a;
  --stroke: rgba(13, 27, 36, 0.12);
  --glass: rgba(255, 255, 255, 0.84);
  --shadow: 0 28px 60px rgba(10, 30, 36, 0.16);
  --shadow-soft: 0 18px 36px rgba(10, 30, 36, 0.12);
  --shadow-lg: 0 32px 80px rgba(10, 30, 36, 0.22);
  --page-bg-top: #f2fbfb;
  --page-bg-bottom: #d8f1ed;
  --page-glow-1: rgba(27, 142, 126, 0.18);
  --page-glow-2: rgba(94, 211, 196, 0.2);
  --panel: rgba(255, 255, 255, 0.88);
  --panel-strong: rgba(255, 255, 255, 0.94);
  --panel-solid: #ffffff;
  --switch-track: #c9ddd8;
  --ghost-bg: rgba(255, 255, 255, 0.7);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
}
html[data-theme="midnight"] {
  --ink: #e7edf2;
  --wine: #57b8ff;
  --wine-dark: #2d79a5;
  --sand: #101821;
  --mist: #121c27;
  --stone: #1a2532;
  --cloud: #16212e;
  --muted: #a4b2c1;
  --stroke: rgba(231, 237, 242, 0.12);
  --glass: rgba(13, 19, 27, 0.74);
  --shadow: 0 28px 60px rgba(3, 8, 12, 0.55);
  --shadow-soft: 0 18px 36px rgba(3, 8, 12, 0.45);
  --shadow-lg: 0 32px 80px rgba(3, 8, 12, 0.65);
  --page-bg-top: #0a1118;
  --page-bg-bottom: #121b26;
  --page-glow-1: rgba(87, 184, 255, 0.2);
  --page-glow-2: rgba(80, 255, 200, 0.12);
  --panel: rgba(16, 24, 33, 0.9);
  --panel-strong: rgba(20, 29, 39, 0.96);
  --panel-solid: #101b26;
  --switch-track: #2a3a4a;
  --ghost-bg: rgba(17, 27, 38, 0.7);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
}
html[data-theme="bethaus"] {
  --ink: #1f2937;
  --wine: #3b82f6;
  --wine-dark: #14213d;
  --sand: #f5f3ef;
  --mist: #f5f7fb;
  --stone: #e2ecff;
  --cloud: #ffffff;
  --muted: #6b7280;
  --stroke: #d9e2ec;
  --glass: rgba(255, 255, 255, 0.88);
  --shadow: 0 20px 40px rgba(12, 74, 110, 0.16);
  --shadow-soft: 0 12px 30px rgba(12, 74, 110, 0.12);
  --shadow-lg: 0 32px 80px rgba(12, 74, 110, 0.25);
  --page-bg-top: #f5f7fb;
  --page-bg-bottom: #f5f3ef;
  --page-glow-1: rgba(59, 130, 246, 0.2);
  --page-glow-2: rgba(34, 211, 238, 0.18);
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: rgba(255, 255, 255, 0.97);
  --panel-solid: #ffffff;
  --switch-track: #d9e2ec;
  --ghost-bg: rgba(255, 255, 255, 0.78);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

/* ============================================================================
   THEME-AWARE BACKGROUND GLOW
   ============================================================================ */

body::before {
  content: "";
  position: fixed;
  inset: -25% -10% auto -10%;
  height: 70vh;
  background:
    radial-gradient(40% 50% at 20% 30%, var(--page-glow-1), transparent 70%),
    radial-gradient(35% 45% at 80% 20%, var(--page-glow-2), transparent 75%);
  pointer-events: none;
  z-index: -1;
  will-change: transform;
}

/* ============================================================================
   PLAYER LOCK (Tab Deduplication)
   ============================================================================ */

.player-locked {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: #111;
  border: 1px solid rgba(0, 0, 0, 0.12);
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  padding: 24px;
  color: #fff;
  text-align: center;
}

.player-locked-card {
  max-width: 360px;
  padding: 20px 22px;
  border-radius: var(--radius-lg);
  background: rgba(10, 10, 10, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.35);
  display: grid;
  gap: 10px;
  justify-items: center;
}

.player-locked-card h3 {
  margin: 0;
  font-size: 18px;
}

.player-locked-card p {
  margin: 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.78);
}

/* ============================================================================
   AUDIO-ONLY MODE OVERRIDES
   ============================================================================ */

.player-wrapper.audio-only {
  background: linear-gradient(135deg, #0f0d0b 0%, #1d1712 100%);
  min-height: 300px;
}

.player-wrapper.audio-only video { display: none; }
.player-wrapper.audio-only .video-container { display: none; }

/* ============================================================================
   AUDIO ORBIT & EQ ANIMATIONS (Enhanced)
   ============================================================================ */

.audio-orbit {
  --audio-orbit-dash: 12deg;
  --audio-orbit-gap: 12deg;
}

@supports (background: conic-gradient(#fff 0 10deg, transparent 10deg 20deg)) {
  .audio-orbit {
    border: none;
    background: repeating-conic-gradient(
      rgba(255, 255, 255, 0.28) 0 var(--audio-orbit-dash),
      transparent var(--audio-orbit-dash) calc(var(--audio-orbit-dash) + var(--audio-orbit-gap))
    );
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  }
}

.audio-controls.playing .audio-orbit {
  opacity: 0.9;
  animation: slow-rotate 18s linear infinite;
}

.audio-eq span {
  --eq-min: 8px;
  --eq-max: 26px;
  --eq-speed: 0.9s;
  --eq-delay: 0s;
  width: 6px;
  height: var(--eq-min);
  background: rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  animation: eq var(--eq-speed) ease-in-out infinite;
  animation-play-state: paused;
  animation-delay: var(--eq-delay);
}

.audio-eq span:nth-child(1) { --eq-min: 6px; --eq-max: 24px; --eq-speed: 0.78s; --eq-delay: 0s; }
.audio-eq span:nth-child(2) { --eq-min: 8px; --eq-max: 30px; --eq-speed: 1.05s; --eq-delay: -0.12s; }
.audio-eq span:nth-child(3) { --eq-min: 5px; --eq-max: 22px; --eq-speed: 0.9s; --eq-delay: -0.18s; }
.audio-eq span:nth-child(4) { --eq-min: 7px; --eq-max: 28px; --eq-speed: 1.18s; --eq-delay: -0.26s; }
.audio-eq span:nth-child(5) { --eq-min: 6px; --eq-max: 30px; --eq-speed: 0.96s; --eq-delay: -0.32s; }
.audio-eq span:nth-child(6) { --eq-min: 9px; --eq-max: 26px; --eq-speed: 0.84s; --eq-delay: -0.4s; }
.audio-eq span:nth-child(7) { --eq-min: 5px; --eq-max: 29px; --eq-speed: 1.12s; --eq-delay: -0.48s; }
.audio-eq span:nth-child(8) { --eq-min: 8px; --eq-max: 25px; --eq-speed: 0.88s; --eq-delay: -0.58s; }
.audio-eq span:nth-child(9) { --eq-min: 6px; --eq-max: 30px; --eq-speed: 1.24s; --eq-delay: -0.66s; }
.audio-eq span:nth-child(10) { --eq-min: 7px; --eq-max: 23px; --eq-speed: 0.82s; --eq-delay: -0.76s; }
.audio-eq span:nth-child(11) { --eq-min: 5px; --eq-max: 27px; --eq-speed: 1s; --eq-delay: -0.84s; }
.audio-eq span:nth-child(12) { --eq-min: 8px; --eq-max: 30px; --eq-speed: 1.14s; --eq-delay: -0.92s; }
.audio-eq span:nth-child(13) { --eq-min: 6px; --eq-max: 28px; --eq-speed: 0.86s; --eq-delay: -1s; }
.audio-eq span:nth-child(14) { --eq-min: 9px; --eq-max: 30px; --eq-speed: 1.2s; --eq-delay: -1.08s; }
.audio-eq span:nth-child(15) { --eq-min: 5px; --eq-max: 24px; --eq-speed: 0.92s; --eq-delay: -1.16s; }
.audio-eq span:nth-child(16) { --eq-min: 7px; --eq-max: 30px; --eq-speed: 1.08s; --eq-delay: -1.24s; }
.audio-eq span:nth-child(17) { --eq-min: 6px; --eq-max: 29px; --eq-speed: 0.9s; --eq-delay: -1.32s; }
.audio-eq span:nth-child(18) { --eq-min: 8px; --eq-max: 30px; --eq-speed: 1.26s; --eq-delay: -1.4s; }
.audio-eq span:nth-child(19) { --eq-min: 5px; --eq-max: 23px; --eq-speed: 0.82s; --eq-delay: -1.48s; }
.audio-eq span:nth-child(20) { --eq-min: 7px; --eq-max: 30px; --eq-speed: 1.1s; --eq-delay: -1.56s; }

.audio-controls.playing .audio-eq span {
  animation-play-state: running;
}

.audio-controls.playing .audio-eq {
  transform: scaleY(1.75);
}

.audio-controls.idle .audio-eq {
  transform: scaleY(0.35);
  opacity: 0.75;
}

.audio-controls.idle .audio-eq span {
  animation: none;
  height: var(--eq-min, 8px);
  opacity: 0.6;
}

.audio-eq.live span {
  animation: none;
  height: var(--eq-max, 26px);
  opacity: 0.9;
  transform-origin: bottom center;
  transform: scaleY(var(--eq-scale, 0.2));
  will-change: transform;
}

/* ============================================================================
   AUDIO TOGGLE BUTTON (Enhanced)
   ============================================================================ */

.audio-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: inherit;
  padding: var(--spacing-xl, 2rem) 0;
}

.audio-controls button {
  pointer-events: auto;
  width: min(150px, calc(100vw - 3rem));
  min-width: 120px;
  aspect-ratio: 1 / 1;
  flex: 0 0 auto;
  box-sizing: border-box;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: #fff;
  position: relative;
  overflow: visible;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  background:
    radial-gradient(circle at 30% 20%, rgba(180, 180, 180, 0.26), transparent 55%),
    radial-gradient(circle at 70% 80%, rgba(64, 64, 64, 0.4), transparent 60%),
    rgba(18, 13, 10, 0.7);
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.45),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.audio-controls button:hover {
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-2px);
  box-shadow:
    0 24px 68px rgba(0, 0, 0, 0.55),
    inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.audio-controls button:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.75);
}

.audio-toggle-content {
  position: relative;
  z-index: 2;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.audio-toggle-icon {
  width: 55px;
  height: 55px;
  fill: currentColor;
}

/* ============================================================================
   STATS RANGE
   ============================================================================ */

.stats-range {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-secondary);
  font-weight: 600;
}

/* ============================================================================
   SATELLITE TABLE
   ============================================================================ */

.satellite-empty {
  text-align: center;
  color: var(--text-secondary);
  padding: 18px 12px;
  font-style: italic;
}

.sat-health {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.sat-healthy {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
}

.sat-degraded {
  background: rgba(245, 158, 11, 0.18);
  color: #c2410c;
}

.sat-unhealthy {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
}

/* ============================================================================
   ADDITIONAL KEYFRAMES
   ============================================================================ */

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(28, 122, 74, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(28, 122, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(28, 122, 74, 0); }
}

@keyframes eq {
  0%, 100% { height: var(--eq-min, 8px); opacity: 0.6; }
  50% { height: var(--eq-max, 26px); opacity: 1; }
}

@keyframes slow-rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ============================================================================
   STATUS BADGE PULSE
   ============================================================================ */

.status-badge.status-online::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
  animation: pulse 1.6s ease infinite;
}

/* ============================================================================
   OFFLINE SUB TEXT
   ============================================================================ */

.offline-box p {
  font-size: 1rem;
  opacity: 0.9;
  margin: 0;
  color: white;
}
