/* Live From New York AI - Midnight Broadcast Design System */

/* ============================================
   CSS Custom Properties
   ============================================ */
:root {
  /* Background Colors */
  --broadcast-void: #050505;
  --broadcast-glass: #09090b;
  --broadcast-border: #27272a;
  
  /* Primary Accent: Electric Blue */
  --electric: #29F0FF;
  --electric-dim: rgba(41, 240, 255, 0.1);
  --electric-glow: rgba(41, 240, 255, 0.5);
  
  /* Secondary Accent: Live Red */
  --live: #FF0055;
  --live-dim: rgba(255, 0, 85, 0.1);
  --live-glow: rgba(255, 0, 85, 0.5);
  
  /* Status Colors */
  --signal-success: #00FF94;
  --signal-warning: #FFB800;
  --signal-error: #FF0055;
  
  /* Typography */
  --font-sans: 'Inter Tight', system-ui, sans-serif;
  --font-mono: 'Geist Mono', 'SF Mono', monospace;
}

/* ============================================
   Base Styles
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background-color: var(--broadcast-void);
  color: #fafafa;
  min-height: 100vh;
  overflow-x: hidden;
}

::selection {
  background-color: var(--electric);
  color: #000;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--broadcast-glass);
}

::-webkit-scrollbar-thumb {
  background: #3f3f46;
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--electric-glow);
}

/* ============================================
   Utility Classes
   ============================================ */
.bg-broadcast-void { background-color: var(--broadcast-void); }
.bg-broadcast-glass { background-color: var(--broadcast-glass); }
.text-electric { color: var(--electric); }
.text-live { color: var(--live); }
.text-signal-success { color: var(--signal-success); }
.text-signal-warning { color: var(--signal-warning); }

.font-mono { font-family: var(--font-mono); }
.font-sans { font-family: var(--font-sans); }

/* Text Glow Effects */
.text-glow-blue {
  text-shadow: 0 0 10px var(--electric-glow), 0 0 20px var(--electric-dim);
}

.text-glow-red {
  text-shadow: 0 0 10px var(--live-glow), 0 0 20px var(--live-dim);
}

/* Glass Panel */
.glass-panel {
  background: rgba(9, 9, 11, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ============================================
   CRT Scanline Overlay
   ============================================ */
.crt-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: 0.3;
  mix-blend-mode: overlay;
  background: 
    linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
    linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
  background-size: 100% 2px, 3px 100%;
}

/* ============================================
   Animations
   ============================================ */

/* On Air Tally Light Pulse */
@keyframes pulse-live {
  0%, 100% {
    box-shadow: 0 0 5px var(--live), 0 0 10px var(--live);
  }
  50% {
    box-shadow: 0 0 2px var(--live), 0 0 5px var(--live);
  }
}

.animate-pulse-live {
  animation: pulse-live 2s ease-in-out infinite;
}

/* Thinking Wave Animation */
@keyframes thinking-wave {
  0% { transform: scaleY(0.1); }
  50% { transform: scaleY(1); }
  100% { transform: scaleY(0.1); }
}

.animate-thinking-wave {
  animation: thinking-wave 1.2s ease-in-out infinite;
}

/* CRT Flicker */
@keyframes crt-flicker {
  0% { opacity: 0.97; }
  5% { opacity: 0.95; }
  10% { opacity: 0.9; }
  15% { opacity: 0.95; }
  20% { opacity: 1; }
  50% { opacity: 0.98; }
  80% { opacity: 0.95; }
  100% { opacity: 0.9; }
}

.animate-crt-flicker {
  animation: crt-flicker 0.15s infinite;
}

/* Teleprompter Scroll */
@keyframes scroll-up {
  0% { transform: translateY(100%); }
  100% { transform: translateY(-100%); }
}

.animate-teleprompter {
  animation: scroll-up 20s linear infinite;
}

/* Spin Animation */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.animate-spin {
  animation: spin 2s linear infinite;
}

/* Pulse Animation */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

/* Fade In Up */
@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in-up {
  animation: fade-in-up 0.5s ease-out forwards;
}

/* ============================================
   Layout Components
   ============================================ */
.dashboard-container {
  min-height: 100vh;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.ambient-glow {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 500px;
  background: var(--electric-dim);
  filter: blur(120px);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.2;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 1.5rem;
  height: calc(100vh - 140px);
}

/* ============================================
   Header Styles
   ============================================ */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  z-index: 10;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-icon {
  padding: 0.5rem;
  background: var(--broadcast-glass);
  border: 1px solid var(--broadcast-border);
  border-radius: 0.5rem;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.logo-icon svg {
  width: 24px;
  height: 24px;
  color: var(--electric);
}

.logo-text h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: -0.02em;
}

.logo-text h1 span {
  color: var(--electric);
}

.version-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #71717a;
}

.version-dot {
  width: 4px;
  height: 4px;
  background: #52525b;
  border-radius: 50%;
}

/* Status Indicators */
.status-container {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.system-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.status-label {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #71717a;
  font-family: var(--font-mono);
}

.status-value {
  font-size: 0.875rem;
  font-weight: 700;
  color: #a1a1aa;
}

.status-value.thinking {
  color: var(--electric);
}

/* Tally Light */
.tally-light {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  border: 1px solid var(--broadcast-border);
  background: var(--broadcast-glass);
  color: #52525b;
  transition: all 0.5s ease;
}

.tally-light.on-air {
  background: var(--live-dim);
  border-color: var(--live);
  color: var(--live);
  box-shadow: 0 0 20px var(--live-glow);
}

.tally-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #3f3f46;
}

.tally-light.on-air .tally-dot {
  background: var(--live);
}

.tally-text {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

/* ============================================
   Panel Styles
   ============================================ */
.panel {
  border-radius: 0.75rem;
  overflow: hidden;
}

.panel-header {
  background: rgba(0, 0, 0, 0.4);
  padding: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #a1a1aa;
}

.panel-title svg {
  width: 12px;
  height: 12px;
}

.panel-content {
  padding: 1rem;
}

/* ============================================
   Topic Card
   ============================================ */
.topic-card {
  padding: 1.25rem;
  border-radius: 0.75rem;
  border-left: 4px solid var(--electric);
}

.topic-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--electric);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}

.topic-headline {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.topic-summary {
  font-size: 0.875rem;
  color: #a1a1aa;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================
   Terminal Logs
   ============================================ */
.terminal {
  display: flex;
  flex-direction: column;
  max-height: 300px;
  overflow: hidden;
}

.terminal-logs {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  max-height: 260px;
  scroll-behavior: smooth;
}

.log-entry {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.log-timestamp {
  color: #52525b;
  flex-shrink: 0;
}

.log-message {
  color: #71717a;
}

.log-entry.thinking .log-message {
  color: var(--electric);
  opacity: 0.8;
}

.log-entry.success .log-message {
  color: var(--signal-success);
}

.log-entry.warning .log-message {
  color: var(--live);
}

/* ============================================
   Stage / Script View
   ============================================ */
.stage {
  background: #000;
  border-radius: 0.75rem;
  border: 1px solid var(--broadcast-border);
  position: relative;
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.stage-content {
  position: relative;
  flex: 1;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  text-align: center;
  z-index: 10;
  overflow-y: auto;
  overflow-x: hidden;
}

.viewport-meta {
  position: absolute;
  top: 1rem;
  left: 1rem;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: #52525b;
  z-index: 30;
  line-height: 1.5;
}

/* Thinking State */
.thinking-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.thinking-ring {
  position: relative;
  width: 96px;
  height: 96px;
}

.thinking-ring-bg {
  width: 100%;
  height: 100%;
  border: 2px solid var(--electric-dim);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thinking-ring-bg svg {
  width: 40px;
  height: 40px;
  color: var(--electric);
}

.thinking-ring-spinner {
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  border-top-color: var(--electric);
  border-radius: 50%;
}

.thinking-text {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--electric);
}

/* Script Lines */
.script-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  max-height: 100%;
}

.script-line {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: #fff;
  opacity: 0;
  transform: translateY(20px);
}

.script-line.visible {
  opacity: 1;
  transform: translateY(0);
  transition: all 0.5s ease;
}

.script-line.direction {
  font-size: 0.875rem;
  font-family: var(--font-mono);
  font-weight: 500;
  color: #71717a;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}

.script-line.closing {
  font-size: 2.5rem;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--live);
  margin-top: 2rem;
}

/* ============================================
   Cognitive Load Visualizer
   ============================================ */
.cognitive-load {
  height: auto;
  min-height: 60px;
  max-height: 80px;
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem;
  flex-shrink: 0;
}

.cognitive-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.cognitive-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #a1a1aa;
}

.cognitive-title svg {
  width: 12px;
  height: 12px;
}

.cognitive-value {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--electric);
}

.waveform {
  height: 24px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 3px;
  padding: 0 0.25rem;
}

.waveform-bar {
  flex: 1;
  background: var(--electric-dim);
  border-radius: 2px 2px 0 0;
  height: 5%;
  transition: all 0.3s ease;
  transform-origin: bottom;
}

.waveform-bar.active {
  background: var(--electric);
}

/* ============================================
   Model Config Panel
   ============================================ */
.model-config {
  flex-shrink: 0;
  padding: 1rem;
}

.config-title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: #a1a1aa;
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.config-header:hover {
  background: rgba(41, 240, 255, 0.05);
  border-radius: 0.25rem;
  margin: -0.25rem;
  padding: 0.25rem;
  padding-bottom: 0.75rem;
  margin-bottom: 0.5rem;
}

#configContent {
  transition: max-height 0.3s ease-out, opacity 0.2s ease-out;
}

.config-item {
  margin-bottom: 1rem;
}

.config-label {
  font-size: 0.625rem;
  text-transform: uppercase;
  color: #71717a;
  margin-bottom: 0.25rem;
}

.config-value {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: #fff;
}

.config-progress {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: var(--broadcast-border);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--electric);
  border-radius: 9999px;
  box-shadow: 0 0 10px var(--electric);
}

.progress-value {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--electric);
}

.config-footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.config-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #a1a1aa;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.config-status svg {
  width: 16px;
  height: 16px;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--electric);
  color: #000;
}

.btn-primary:hover {
  background: #5ff3ff;
  box-shadow: 0 0 20px var(--electric-glow);
}

.btn-secondary {
  background: transparent;
  color: #a1a1aa;
  border: 1px solid var(--broadcast-border);
}

.btn-secondary:hover {
  border-color: var(--electric);
  color: var(--electric);
}

.btn-danger {
  background: var(--live);
  color: #fff;
}

.btn-danger:hover {
  background: #ff3377;
  box-shadow: 0 0 20px var(--live-glow);
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: 1fr 1.5fr 1fr;
  }
}

@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
    height: auto;
  }
  
  .dashboard-grid > * {
    min-height: 300px;
  }
}

@media (max-width: 768px) {
  .header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  
  .status-container {
    width: 100%;
    justify-content: space-between;
  }
  
  .script-line {
    font-size: 1.25rem;
  }
  
  .script-line.closing {
    font-size: 1.75rem;
  }
}
