/* WatchToo - Complete Stylesheet */

/* CSS Variables - Cinematic Grey Theme */
:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #141414;
  --bg-tertiary: #1f1f1f;
  --bg-quaternary: #2a2a2a;
  --text-primary: #e5e5e5;
  --text-secondary: #a0a0a0;
  --text-muted: #6b6b6b;
  --border: #2a2a2a;
  --border-hover: #3a3a3a;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --gradient-create: linear-gradient(135deg, #00d4ff 0%, #090979 35%, #ff00c7 100%);
  --gradient-join: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --gradient-1: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);
  --gradient-2: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-cinematic: 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  /* Cinematic background effect */
  background-image: 
    radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(236, 72, 153, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 40% 20%, rgba(139, 92, 246, 0.04) 0%, transparent 50%);
  background-attachment: fixed;
}

/* Utility: hidden (works on any element) */
.hidden {
  display: none !important;
}

/* Screens */
.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.screen.hidden {
  display: none;
}

/* Landing Screen */
.landing-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.landing-content::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
  animation: cinematicFloat 25s ease-in-out infinite;
  pointer-events: none;
}

@keyframes cinematicFloat {
  0%, 100% { transform: translate(0, 0) rotate(0deg) scale(1); }
  25% { transform: translate(30px, -40px) rotate(90deg) scale(1.1); }
  50% { transform: translate(-20px, 30px) rotate(180deg) scale(0.95); }
  75% { transform: translate(40px, 20px) rotate(270deg) scale(1.05); }
}

.logo-container {
  margin-bottom: 3rem;
  position: relative;
  z-index: 1;
}

.logo {
  font-size: 4.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 50%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
  letter-spacing: -0.03em;
  text-shadow: 0 0 80px rgba(99, 102, 241, 0.3);
  animation: cinematicGlow 4s ease-in-out infinite alternate;
}

@keyframes cinematicGlow {
  0% { filter: brightness(1) contrast(1); }
  50% { filter: brightness(1.1) contrast(1.1); }
  100% { filter: brightness(1.2) contrast(1.2); }
}

.tagline {
  font-size: 1.2rem;
  color: var(--text-muted);
  font-weight: 300;
}

/* Form Elements */
.join-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
  max-width: 450px;
  margin-bottom: 3rem;
  position: relative;
  z-index: 1;
}

.input-field {
  background: rgba(26, 26, 26, 0.8);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  color: var(--text-primary);
  font-size: 1rem;
  transition: all var(--transition-cinematic);
  width: 100%;
  backdrop-filter: blur(20px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.input-field:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15), 0 8px 30px rgba(99, 102, 241, 0.2);
  transform: translateY(-2px);
}

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

/* Room Options */
.room-options {
  background: rgba(26, 26, 26, 0.9);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  backdrop-filter: blur(20px);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
}

.option-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  padding: 1.25rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-cinematic);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  font-weight: 600;
  font-size: 0.95rem;
  position: relative;
  letter-spacing: 0.02em;
}

.tab-btn::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform var(--transition-base);
}

.tab-btn.active::before {
  transform: scaleX(1);
}

.tab-btn.active {
  color: var(--text-primary);
  background: rgba(31, 31, 31, 0.8);
  text-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
}

.tab-btn:hover:not(.active) {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
  transform: translateY(-1px);
}

.tab-icon {
  font-size: 1.1rem;
}

.tab-content {
  padding: 2rem;
}

.tab-pane {
  display: none;
  animation: fadeIn var(--transition-base);
}

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

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

.tab-description {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.room-code-input {
  margin-bottom: 1.5rem;
  text-align: center;
  font-size: 1.2rem;
  letter-spacing: 0.1em;
  font-weight: 500;
  text-transform: uppercase;
}

/* Colorful Create Button */
#create-room-btn {
  background: var(--gradient-create);
  background-size: 200% 200%;
  border: none;
  border-radius: 16px;
  padding: 1.25rem 2.5rem;
  color: white;
  font-weight: 700;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all var(--transition-cinematic);
  position: relative;
  overflow: hidden;
  animation: createGradientShift 4s ease-in-out infinite;
  width: 100%;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 8px 30px rgba(0, 212, 255, 0.3);
}

@keyframes createGradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

#create-room-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.6s;
}

#create-room-btn:hover::before {
  left: 100%;
}

#create-room-btn:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 12px 40px rgba(0, 212, 255, 0.5);
}

#create-room-btn:active {
  transform: translateY(-2px) scale(1.01);
}

/* Colorful Join Button */
#join-room-btn {
  background: var(--gradient-join);
  background-size: 200% 200%;
  border: none;
  border-radius: 16px;
  padding: 1.25rem 2.5rem;
  color: white;
  font-weight: 700;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all var(--transition-cinematic);
  position: relative;
  overflow: hidden;
  animation: joinGradientShift 4s ease-in-out infinite;
  width: 100%;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 8px 30px rgba(240, 147, 251, 0.3);
}

@keyframes joinGradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

#join-room-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.6s;
}

#join-room-btn:hover::before {
  left: 100%;
}

#join-room-btn:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 12px 40px rgba(240, 147, 251, 0.5);
}

#join-room-btn:active {
  transform: translateY(-2px) scale(1.01);
}

.btn-text {
  position: relative;
  z-index: 1;
}

.btn-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.gradient-btn:active .btn-glow {
  width: 300px;
  height: 300px;
}

/* Buttons */
.primary-btn, .secondary-btn, .control-btn, .send-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  color: var(--text-primary);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.9rem;
}

.primary-btn {
  background: var(--accent);
  border-color: var(--accent);
}

.primary-btn:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.secondary-btn:hover, .control-btn:hover, .send-btn:hover {
  background: var(--bg-quaternary);
  border-color: var(--border-hover);
}

/* Features */
.features {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 2rem;
  position: relative;
  z-index: 1;
}

.feature {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  background: rgba(26, 26, 26, 0.8);
  padding: 1rem 1.5rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  transition: all var(--transition-cinematic);
  backdrop-filter: blur(20px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.feature:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: var(--accent);
  box-shadow: 0 12px 30px rgba(99, 102, 241, 0.3);
  color: var(--text-primary);
  background: rgba(31, 31, 31, 0.9);
}

.feature-icon {
  font-size: 1.3rem;
  animation: bounce 2s ease-in-out infinite;
}

.feature:nth-child(2) .feature-icon {
  animation-delay: 0.2s;
}

.feature:nth-child(3) .feature-icon {
  animation-delay: 0.4s;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-5px); }
  60% { transform: translateY(-3px); }
}

/* Watch Room */
.room-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.room-info h2 {
  font-size: 1.2rem;
  font-weight: 600;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
}

.status-indicator.connecting {
  background: var(--warning);
  animation: pulse 2s infinite;
}

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

.status-indicator.error {
  background: var(--error);
}

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

.room-controls {
  display: flex;
  gap: 1rem;
}

/* Room Content */
.room-content {
  flex: 1;
  display: flex;
  height: calc(100vh - 80px);
}

/* Video Section */
.video-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}

.video-container {
  flex: 1;
  position: relative;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.video-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  padding: 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.video-container:hover .video-controls {
  opacity: 1;
}

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

.controls-center {
  flex: 1;
}

.progress-slider {
  flex: 1;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

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

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

/* Video Loading */
.video-loading {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
}

.loading-content {
  text-align: center;
  max-width: 500px;
  padding: 2rem;
}

.loading-content h3 {
  margin-bottom: 2rem;
  color: var(--text-primary);
}

.video-source-tabs {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
}

.source-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.source-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.video-input-section {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.video-input-section[data-source="file"] {
  flex-direction: column;
  gap: 1rem;
  padding: 1rem 0;
}

.video-input-section[data-source="file"] .tab-description {
  margin-bottom: 0;
}

.video-input-section .input-field {
  flex: 1;
}

#browse-file {
  width: 100%;
}

/* Resize handle */
.resize-handle {
  width: 6px;
  cursor: col-resize;
  background: var(--border);
  flex-shrink: 0;
  transition: background var(--transition-fast);
  position: relative;
  z-index: 10;
}

.resize-handle:hover,
.resize-handle:active {
  background: var(--accent);
}

/* Drag-drop overlay */
.drop-overlay {
  display: none;
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(99, 102, 241, 0.15);
  border: 3px dashed var(--accent);
  border-radius: 12px;
  z-index: 100;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.video-container.drag-over .drop-overlay {
  display: flex;
}

.drop-text {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(0, 0, 0, 0.7);
  padding: 1rem 2rem;
  border-radius: 12px;
}

/* Local file label */
.local-file-label {
  display: none;
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.75);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  z-index: 50;
  pointer-events: none;
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
}

/* Sidebar */
.sidebar {
  width: 350px;
  min-width: 250px;
  max-width: 600px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.panel-section {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

/* Reactions */
.reactions-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 1000;
}

.floating-reaction {
  position: absolute;
  font-size: 3rem;
  animation: floatUp 3s ease-out forwards;
  pointer-events: none;
}

@keyframes floatUp {
  0% {
    transform: translateY(0) scale(0);
    opacity: 0;
  }
  20% {
    transform: translateY(-20px) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(-200px) scale(0.5);
    opacity: 0;
  }
}

.reaction-buttons {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.reaction-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.reaction-btn:hover {
  transform: scale(1.1);
  border-color: var(--accent);
}

/* Chat section toggle */
#chat-section.collapsed {
  display: none;
}

/* Muted state for video chat buttons */
#toggle-camera.muted,
#toggle-mic.muted {
  opacity: 0.5;
  background: var(--bg-quaternary);
}

/* YouTube player container */
#youtube-player {
  width: 100%;
  height: 100%;
}

#youtube-player.hidden {
  display: none;
}

/* Chat */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 1rem;
  padding: 0.5rem;
  background: var(--bg-tertiary);
  border-radius: 8px;
  max-height: 300px;
}

.chat-message {
  margin-bottom: 0.75rem;
  padding: 0.5rem;
  border-radius: 6px;
  background: var(--bg-secondary);
}

.chat-message.system {
  background: var(--bg-quaternary);
  font-style: italic;
  color: var(--text-muted);
}

.username {
  font-weight: 600;
  color: var(--accent);
  margin-right: 0.5rem;
}

.message {
  color: var(--text-primary);
}

.timestamp {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
}

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

.chat-input {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.chat-input:focus {
  outline: none;
  border-color: var(--accent);
}

.send-btn {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

/* Users List */
.users-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.user-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-tertiary);
  border-radius: 8px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: white;
}

.user-info {
  flex: 1;
}

.user-name {
  font-weight: 500;
  color: var(--text-primary);
}

.user-status {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.user-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

/* Video Chat */
.video-chat {
  position: fixed;
  top: 80px;
  right: 20px;
  width: 300px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  z-index: 100;
}

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

.video-chat-header {
  padding: 1rem;
  background: var(--bg-tertiary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.video-chat-controls {
  display: flex;
  gap: 0.5rem;
}

.video-grid {
  padding: 1rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.video-tile {
  position: relative;
  background: var(--bg-tertiary);
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 16/9;
}

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

.video-label {
  position: absolute;
  bottom: 0.5rem;
  left: 0.5rem;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

.local-video {
  grid-column: span 2;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .landing-content {
    padding: 1rem;
  }
  
  .logo {
    font-size: 3rem;
  }
  
  .features {
    flex-direction: column;
    gap: 1rem;
  }
  
  .room-content {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
  }
  
  .video-chat {
    width: 100%;
    right: 0;
    left: 0;
    top: auto;
    bottom: 0;
  }
  
  .video-grid {
    grid-template-columns: 1fr;
  }
  
  .local-video {
    grid-column: span 1;
  }
  
  .video-input-section {
    flex-direction: column;
  }
  
  .reaction-buttons {
    grid-template-columns: repeat(3, 1fr);
  }
}
