/* ========================================
   LiveKit Video Call - Modern UI Styles
   ======================================== */

:root {
  /* Colors - Cyberpunk-inspired palette */
  --primary: #00D9FF;
  --primary-glow: rgba(0, 217, 255, 0.3);
  --accent: #7C3AED;
  --accent-glow: rgba(124, 58, 237, 0.3);
  --danger: #FF3B5C;
  --danger-glow: rgba(255, 59, 92, 0.4);
  --success: #00FF94;
  
  /* Backgrounds */
  --bg-dark: #0A0A0F;
  --bg-card: rgba(15, 15, 25, 0.85);
  --bg-elevated: rgba(25, 25, 40, 0.9);
  --bg-input: rgba(30, 30, 50, 0.8);
  
  /* Text */
  --text-primary: #FFFFFF;
  --text-secondary: rgba(255, 255, 255, 0.6);
  --text-muted: rgba(255, 255, 255, 0.4);
  
  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(0, 217, 255, 0.5);
  
  /* Shadows */
  --shadow-card: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px var(--primary-glow);
  
  /* Spacing & Sizing */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
}

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

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ========================================
   Animated Background
   ======================================== */

.app-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.bg-gradient {
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(ellipse 80% 50% at 20% 40%, var(--primary-glow) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 60%, var(--accent-glow) 0%, transparent 50%),
    radial-gradient(ellipse 100% 100% at 50% 100%, rgba(124, 58, 237, 0.15) 0%, transparent 50%);
  animation: gradientShift 15s ease-in-out infinite;
}

@keyframes gradientShift {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.1); }
}

.bg-grid {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black, transparent);
}

/* ========================================
   Screen States
   ======================================== */

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.screen.active {
  opacity: 1;
  visibility: visible;
}

/* ========================================
   Join Screen
   ======================================== */

.join-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 48px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-card);
  animation: cardFloat 0.6s ease-out;
}

@keyframes cardFloat {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}

.logo h1 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 36px;
  font-weight: 300;
}

/* Form Styles */
.input-group {
  margin-bottom: 24px;
}

.input-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-group input {
  width: 100%;
  padding: 16px 20px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 16px;
  font-family: inherit;
  transition: all 0.3s ease;
}

.input-group input::placeholder {
  color: var(--text-muted);
}

.input-group input:focus {
  outline: none;
  border-color: var(--border-active);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.input-hint {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Primary Button */
.btn-primary {
  width: 100%;
  padding: 18px 24px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px -10px var(--primary-glow), 0 10px 30px -10px var(--accent-glow);
}

.btn-primary:hover::before {
  opacity: 1;
}

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

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Error Message */
.error-message {
  background: rgba(255, 59, 92, 0.15);
  border: 1px solid rgba(255, 59, 92, 0.3);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-top: 20px;
  color: var(--danger);
  font-size: 14px;
  animation: shake 0.4s ease;
}

.error-message.hidden {
  display: none;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Features */
.features {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
}

.feature {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.feature svg {
  color: var(--primary);
}

/* ========================================
   Call Screen
   ======================================== */

#call-screen {
  flex-direction: column;
  padding: 20px;
}

/* Call Header */
.call-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0 10px;
  margin-bottom: 20px;
  z-index: 10;
}

.room-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.room-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  padding: 10px 16px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border-subtle);
}

.room-badge svg {
  color: var(--primary);
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: pulse 2s infinite;
}

.connection-status.connected .status-dot {
  background: var(--success);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.call-timer {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  background: var(--bg-elevated);
  padding: 10px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

/* Video Container */
.video-container {
  flex: 1;
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
}

/* Video Wrappers */
.video-wrapper {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: linear-gradient(180deg, rgba(20, 20, 35, 1), rgba(10, 10, 20, 1));
}

.video-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-wrapper.remote {
  position: absolute;
  inset: 0;
  border-radius: 0;
}

.video-wrapper.local {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 200px;
  height: 150px;
  border: 3px solid var(--bg-dark);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  z-index: 10;
  transition: all 0.3s ease;
}

.video-wrapper.local:hover {
  transform: scale(1.05);
}

/* Video Placeholder */
.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: linear-gradient(180deg, rgba(30, 30, 50, 0.9), rgba(15, 15, 30, 0.9));
}

.video-placeholder.hidden {
  display: none;
}

.avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-glow), var(--accent-glow));
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border-subtle);
}

.avatar svg {
  color: var(--text-secondary);
}

.video-placeholder p {
  color: var(--text-secondary);
  font-size: 15px;
  animation: pulse 2s infinite;
}

/* Video Labels */
.video-label {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

/* ========================================
   Controls Bar
   ======================================== */

.controls-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
  padding: 16px 24px;
  background: var(--bg-elevated);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
}

.controls-group {
  display: flex;
  gap: 12px;
}

.control-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--bg-input);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  position: relative;
}

.control-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.08);
}

.control-btn:active {
  transform: scale(0.95);
}

.control-btn.muted {
  background: rgba(255, 59, 92, 0.2);
  color: var(--danger);
}

.control-btn.muted:hover {
  background: rgba(255, 59, 92, 0.3);
}

.control-btn.active {
  background: var(--primary);
  color: var(--bg-dark);
}

.control-btn .icon-off.hidden,
.control-btn.muted .icon-on {
  display: none;
}

.control-btn.muted .icon-off {
  display: block;
}

.control-btn.muted .icon-off.hidden {
  display: block;
}

/* End Call Button */
.control-btn.end-call {
  width: 64px;
  height: 56px;
  border-radius: var(--radius-lg);
  background: var(--danger);
  margin-left: 20px;
}

.control-btn.end-call:hover {
  background: #FF5C75;
  box-shadow: 0 0 30px var(--danger-glow);
}

/* Volume Control */
.volume-control {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--text-secondary);
}

.volume-slider {
  width: 80px;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--bg-input);
  border-radius: 3px;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.volume-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
  .join-card {
    margin: 20px;
    padding: 32px 24px;
  }
  
  .features {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }
  
  .video-wrapper.local {
    width: 120px;
    height: 90px;
    bottom: 10px;
    right: 10px;
  }
  
  .controls-bar {
    padding: 12px 16px;
    gap: 8px;
  }
  
  .control-btn {
    width: 48px;
    height: 48px;
  }
  
  .control-btn.end-call {
    width: 56px;
    height: 48px;
    margin-left: 12px;
  }
  
  .call-header {
    flex-direction: column;
    gap: 12px;
  }
  
  .room-info {
    flex-direction: column;
    gap: 8px;
  }
}

/* ========================================
   Utilities
   ======================================== */

.hidden {
  display: none !important;
}

/* Loading State */
.btn-primary.loading .btn-text {
  opacity: 0;
}

.btn-primary.loading::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  border: 3px solid transparent;
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

