@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  /* Color Palette */
  --bg-darker: #08070d;
  --bg-dark: #0f0e17;
  --bg-card: rgba(22, 21, 35, 0.65);
  --bg-card-hover: rgba(28, 26, 44, 0.8);
  
  --accent-cyan: #00f0ff;
  --accent-cyan-glow: rgba(0, 240, 255, 0.4);
  --accent-pink: #ff0055;
  --accent-pink-glow: rgba(255, 0, 85, 0.4);
  --accent-purple: #8b5cf6;
  --accent-purple-glow: rgba(139, 92, 246, 0.4);
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-active: rgba(0, 240, 255, 0.3);
  
  /* Fonts */
  --font-header: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  
  /* System */
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;
  --glow-shadow: 0 0 20px var(--accent-cyan-glow);
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-darker);
  background-image: 
    radial-gradient(at 10% 10%, rgba(139, 92, 246, 0.12) 0px, transparent 40%),
    radial-gradient(at 90% 85%, rgba(0, 240, 255, 0.08) 0px, transparent 40%);
  color: var(--text-primary);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-header);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Layout Containers */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 1920px;
  margin: 0 auto;
}

/* Glassmorphism Card */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  transition: var(--transition-smooth);
}

.glass-panel:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

/* Navigation Header */
.app-header {
  height: 70px;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-glass);
  background: rgba(15, 14, 23, 0.8);
  backdrop-filter: blur(8px);
  z-index: 100;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--bg-darker);
  font-size: 1.1rem;
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.3);
}

.logo-text {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(to right, #ffffff, #d1d5db);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.03em;
}

.logo-text span {
  background: linear-gradient(to right, var(--accent-cyan), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-status {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Interactive Components */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-smooth);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  color: var(--bg-darker);
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(0, 240, 255, 0.2);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 240, 255, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-glass);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.btn-danger {
  background: rgba(255, 0, 85, 0.1);
  border-color: rgba(255, 0, 85, 0.3);
  color: #ff4d79;
}

.btn-danger:hover {
  background: var(--accent-pink);
  color: var(--text-primary);
  box-shadow: 0 4px 15px var(--accent-pink-glow);
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn-icon-only {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
}

.input-field {
  width: 100%;
  padding: 0.85rem 1.2rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: var(--transition-smooth);
}

.input-field:focus {
  outline: none;
  border-color: var(--accent-cyan);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.15);
}

/* Badges & Indicators */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 0, 85, 0.12);
  border: 1px solid rgba(255, 0, 85, 0.3);
  color: #ff4d79;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.live-badge .pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-pink);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-pink);
  animation: pulse 1.5s infinite;
}

.offline-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.offline-badge .dot {
  width: 8px;
  height: 8px;
  background-color: var(--text-muted);
  border-radius: 50%;
}

/* Landing Page Specific */
.landing-hero {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.lobby-card {
  width: 100%;
  max-width: 480px;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.lobby-header {
  text-align: center;
}

.lobby-header h2 {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #ffffff 30%, var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.lobby-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.tab-nav {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-md);
  padding: 4px;
  border: 1px solid var(--border-glass);
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.tab-btn.active {
  background: var(--bg-card);
  color: var(--accent-cyan);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.lobby-tab-content {
  display: none;
  flex-direction: column;
  gap: 1.25rem;
}

.lobby-tab-content.active {
  display: flex;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

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

/* Dashboard Workspace (Host & Viewer grids) */
.workspace-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1.5rem;
  padding: 1.5rem;
  height: calc(100vh - 70px);
  overflow: hidden;
}

@media (max-width: 1024px) {
  .workspace-grid {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
    overflow-y: auto;
    height: auto;
  }
}

.main-stage {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 100%;
  min-height: 0; /* Important for flex child sizing */
}

/* Video Stage Area */
.video-stage {
  flex: 1;
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background-color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-glass);
}

.stream-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: radial-gradient(circle, #171526 0%, #08070d 100%);
  color: var(--text-secondary);
  z-index: 10;
  text-align: center;
  padding: 2rem;
}

.video-placeholder-icon {
  font-size: 4rem;
  animation: float 4s ease-in-out infinite;
}

/* Custom Video Controls */
.video-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(8, 7, 13, 0.95));
  padding: 1.5rem 1rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 20;
}

.video-stage:hover .video-controls,
.video-stage:focus-within .video-controls {
  opacity: 1;
}

.controls-progress {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
}

.controls-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent-cyan);
  border-radius: 3px;
  position: absolute;
}

.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.controls-left, .controls-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.volume-slider {
  width: 80px;
  height: 4px;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-value-now {
  background: var(--accent-cyan);
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-cyan);
  cursor: pointer;
}

/* Control Panel Card underneath Stage */
.control-card {
  padding: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.stream-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stream-title-text {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.stream-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.host-action-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Stats Overlay Grid on Streamer Panel */
.stats-strip {
  display: flex;
  gap: 1.5rem;
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-val {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.stat-lbl {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

/* Sidebar (Chat Panel) */
.sidebar-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.sidebar-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-title {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-title-badge {
  background: rgba(255, 255, 255, 0.08);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Chat Messages Box */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 0;
}

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

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

.chat-bubble {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  animation: slideIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-bubble-meta {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.chat-bubble-user {
  font-size: 0.85rem;
  font-weight: 700;
}

.chat-bubble-user.is-host {
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.chat-bubble-user.is-host::after {
  content: 'HOST';
  font-size: 0.6rem;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  color: var(--bg-darker);
  padding: 0.05rem 0.25rem;
  border-radius: 3px;
  font-weight: 800;
}

.chat-bubble-time {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.chat-bubble-text {
  font-size: 0.9rem;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
  padding: 0.6rem 0.85rem;
  border-radius: 0 var(--radius-md) var(--radius-md) var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.04);
  word-break: break-word;
}

.chat-bubble-system {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: center;
  font-style: italic;
  padding: 0.25rem 0.5rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 4px;
}

/* Chat Input Bar */
.chat-footer {
  padding: 1rem;
  border-top: 1px solid var(--border-glass);
}

.chat-input-form {
  display: flex;
  gap: 0.5rem;
}

/* Username modal overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(8, 7, 13, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.25s ease;
}

.modal-content {
  width: 100%;
  max-width: 400px;
  padding: 2.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Copy Link Popups */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(15, 14, 23, 0.9);
  border: 1px solid var(--accent-cyan);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.5rem;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 10px 25px rgba(0, 240, 255, 0.15);
  z-index: 2000;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* Canvas Audio Visualizer style */
.visualizer-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 24px;
  width: 120px;
  background: rgba(255, 255, 255, 0.03);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
}

.visualizer-canvas {
  width: 100%;
  height: 100%;
}

/* Animations */
@keyframes pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(255, 0, 85, 0.7);
  }
  70% {
    transform: scale(1.1);
    box-shadow: 0 0 0 8px rgba(255, 0, 85, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(255, 0, 85, 0);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-8px);
  }
}

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

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