/* styles.css — Peerly design system
   Variables/tokens at top, components below.
   Every referenced class/state is styled. No dead definitions. */

/* ===== @PROPERTY — enable smooth interpolation of gradient color vars ===== */
@property --bg-base-from {
  syntax: '<color>';
  inherits: true;
  initial-value: #dbeafe;
}
@property --bg-base-via {
  syntax: '<color>';
  inherits: true;
  initial-value: #e0e7ff;
}
@property --bg-base-to {
  syntax: '<color>';
  inherits: true;
  initial-value: #cffafe;
}
@property --bg-aurora-from {
  syntax: '<color>';
  inherits: true;
  initial-value: rgba(147, 197, 253, 0.35);
}
@property --bg-aurora-via {
  syntax: '<color>';
  inherits: true;
  initial-value: rgba(165, 180, 252, 0.25);
}
@property --bg-aurora-to {
  syntax: '<color>';
  inherits: true;
  initial-value: rgba(103, 232, 249, 0.3);
}
@property --bg-glow1-color {
  syntax: '<color>';
  inherits: true;
  initial-value: rgba(96, 165, 250, 0.22);
}
@property --bg-glow2-color {
  syntax: '<color>';
  inherits: true;
  initial-value: rgba(167, 139, 250, 0.18);
}
@property --bg-glow3-color {
  syntax: '<color>';
  inherits: true;
  initial-value: rgba(103, 232, 249, 0.15);
}

/* ===== RESET & BASE ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ===== UTILITIES ===== */
.hidden {
  display: none !important;
}

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

/* ===== DESIGN TOKENS ===== */
:root {
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --secondary: #06b6d4;
  --dark: #0f172a;
  --video-bg: #0f172a;
  --light: #f8fafc;
  --accent: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  
  /* Glassmorphism tokens */
  --glass-bg: rgba(255, 255, 255, 0.15);
  --glass-border: rgba(255, 255, 255, 0.2);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.2);
  --panel-bg: rgba(255, 255, 255, 0.85);
  
  --chat-font-size: 1rem;
  
  /* Animated Gradients */
  --gradient-1: #60a5fa;
  --gradient-2: #818cf8;
  --gradient-3: #a78bfa;
  --gradient-4: #c084fc;
  
  --emoji-hover-bg: rgba(59, 130, 246, 0.12);
  --emoji-hover-rgb: 59, 130, 246;
  --focus-ring: 0 0 0 3px rgba(59, 130, 246, 0.4);
  
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;

  /* ===== AMBIENT BACKGROUND TOKENS ===== */
  --bg-base-from: #dbeafe;
  --bg-base-via: #e0e7ff;
  --bg-base-to: #cffafe;

  --bg-aurora-from: rgba(147, 197, 253, 0.35);
  --bg-aurora-via: rgba(165, 180, 252, 0.25);
  --bg-aurora-to: rgba(103, 232, 249, 0.3);
  --bg-aurora-speed: 25s;

  --bg-glow1-color: rgba(96, 165, 250, 0.22);
  --bg-glow1-size: 45%;
  --bg-glow2-color: rgba(167, 139, 250, 0.18);
  --bg-glow2-size: 40%;
  --bg-glow3-color: rgba(103, 232, 249, 0.15);
  --bg-glow3-size: 35%;
  --bg-glow-speed: 20s;

  --bg-shimmer-opacity: 0.04;
  --bg-shimmer-speed: 12s;

  --bg-vignette-opacity: 0.15;
}

/* ===== SCROLLBARS ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(156, 163, 175, 0.5);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(156, 163, 175, 0.8);
}

/* ===== BODY ===== */
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  background: var(--bg-base-from);
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: --bg-base-from 1.4s ease;
  color: #1e293b;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* ===== COOL MODE — background token overrides ===== */
body.cool-mode {
  --bg-base-from: #c7d2fe;
  --bg-base-via: #ddd6fe;
  --bg-base-to: #a5f3fc;

  --bg-aurora-from: rgba(129, 140, 248, 0.5);
  --bg-aurora-via: rgba(192, 132, 252, 0.4);
  --bg-aurora-to: rgba(34, 211, 238, 0.45);
  --bg-aurora-speed: 18s;

  --bg-glow1-color: rgba(99, 102, 241, 0.35);
  --bg-glow1-size: 50%;
  --bg-glow2-color: rgba(192, 132, 252, 0.3);
  --bg-glow2-size: 45%;
  --bg-glow3-color: rgba(34, 211, 238, 0.28);
  --bg-glow3-size: 42%;
  --bg-glow-speed: 14s;

  --bg-shimmer-opacity: 0.09;
  --bg-shimmer-speed: 8s;

  --bg-vignette-opacity: 0.22;

  --panel-bg: rgba(199, 210, 254, 0.7);
}

/* ===== DARK MODE ===== */
body.dark-mode {
  --gradient-1: #0f172a;
  --gradient-2: #1e293b;
  --gradient-3: #334155;
  --gradient-4: #475569;
  
  --light: #1e293b;
  --dark: #f8fafc;
  
  --glass-bg: rgba(0, 0, 0, 0.3);
  --glass-border: rgba(255, 255, 255, 0.05);
  --panel-bg: rgba(30, 41, 59, 0.85);
  
  --emoji-hover-bg: rgba(255, 255, 255, 0.06);
  --emoji-hover-rgb: 255, 255, 255;
  
  color: #f8fafc;

  --bg-base-from: #0f172a;
  --bg-base-via: #1e1b4b;
  --bg-base-to: #0c4a6e;

  --bg-aurora-from: rgba(59, 130, 246, 0.2);
  --bg-aurora-via: rgba(129, 140, 248, 0.15);
  --bg-aurora-to: rgba(6, 182, 212, 0.18);

  --bg-glow1-color: rgba(59, 130, 246, 0.18);
  --bg-glow2-color: rgba(139, 92, 246, 0.14);
  --bg-glow3-color: rgba(6, 182, 212, 0.12);

  --bg-shimmer-opacity: 0.03;
  --bg-vignette-opacity: 0.3;
}

/* ===== DARK + COOL combined ===== */
body.dark-mode.cool-mode {
  --bg-base-from: #0f0a2e;
  --bg-base-via: #1a0536;
  --bg-base-to: #042f3d;

  --bg-aurora-from: rgba(99, 102, 241, 0.35);
  --bg-aurora-via: rgba(168, 85, 247, 0.3);
  --bg-aurora-to: rgba(34, 211, 238, 0.3);
  --bg-aurora-speed: 16s;

  --bg-glow1-color: rgba(99, 102, 241, 0.3);
  --bg-glow1-size: 50%;
  --bg-glow2-color: rgba(168, 85, 247, 0.25);
  --bg-glow2-size: 48%;
  --bg-glow3-color: rgba(34, 211, 238, 0.22);
  --bg-glow3-size: 42%;
  --bg-glow-speed: 12s;

  --bg-shimmer-opacity: 0.07;
  --bg-shimmer-speed: 7s;

  --bg-vignette-opacity: 0.4;

  --panel-bg: rgba(25, 15, 55, 0.85);
}

/* ===== AMBIENT BACKGROUND SYSTEM ===== */
.bg-system {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.bg-layer {
  position: absolute;
  inset: 0;
  will-change: transform, opacity;
}

/* --- Base gradient layer --- */
.bg-base {
  background: linear-gradient(
    135deg,
    var(--bg-base-from) 0%,
    var(--bg-base-via) 50%,
    var(--bg-base-to) 100%
  );
  transition:
    --bg-base-from 1.4s cubic-bezier(0.4, 0, 0.2, 1),
    --bg-base-via 1.4s cubic-bezier(0.4, 0, 0.2, 1),
    --bg-base-to 1.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Aurora drift layer --- */
.bg-aurora {
  background: linear-gradient(
    160deg,
    var(--bg-aurora-from) 0%,
    transparent 30%,
    var(--bg-aurora-via) 55%,
    transparent 70%,
    var(--bg-aurora-to) 100%
  );
  background-size: 200% 200%;
  animation: auroraShift var(--bg-aurora-speed) ease-in-out infinite alternate;
  opacity: 1;
  transition:
    --bg-aurora-from 1.4s ease,
    --bg-aurora-via 1.4s ease,
    --bg-aurora-to 1.4s ease,
    opacity 1.2s ease;
}

@keyframes auroraShift {
  0%   { background-position: 0% 0%; }
  25%  { background-position: 100% 50%; }
  50%  { background-position: 50% 100%; }
  75%  { background-position: 0% 50%; }
  100% { background-position: 100% 0%; }
}

/* --- Glow orbs (soft radial blooms) --- */
.bg-glow {
  border-radius: 50%;
  filter: blur(80px);
  opacity: 1;
  transition:
    --bg-glow1-color 1.4s ease,
    --bg-glow2-color 1.4s ease,
    --bg-glow3-color 1.4s ease,
    width 1.4s ease,
    height 1.4s ease,
    opacity 1.2s ease;
}

.bg-glow-1 {
  background: var(--bg-glow1-color);
  width: var(--bg-glow1-size);
  height: var(--bg-glow1-size);
  top: -10%;
  left: -5%;
  animation: glowDrift1 var(--bg-glow-speed) ease-in-out infinite alternate;
}

.bg-glow-2 {
  background: var(--bg-glow2-color);
  width: var(--bg-glow2-size);
  height: var(--bg-glow2-size);
  bottom: -15%;
  right: -10%;
  animation: glowDrift2 var(--bg-glow-speed) ease-in-out infinite alternate;
  animation-delay: -7s;
}

.bg-glow-3 {
  background: var(--bg-glow3-color);
  width: var(--bg-glow3-size);
  height: var(--bg-glow3-size);
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: glowDrift3 var(--bg-glow-speed) ease-in-out infinite alternate;
  animation-delay: -13s;
}

@keyframes glowDrift1 {
  0%   { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(8%, 12%) scale(1.08); }
  66%  { transform: translate(-4%, 6%) scale(0.95); }
  100% { transform: translate(12%, -4%) scale(1.05); }
}

@keyframes glowDrift2 {
  0%   { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(-10%, -8%) scale(1.1); }
  66%  { transform: translate(6%, -12%) scale(0.92); }
  100% { transform: translate(-8%, 6%) scale(1.06); }
}

@keyframes glowDrift3 {
  0%   { transform: translate(-50%, -50%) scale(1); }
  33%  { transform: translate(-45%, -55%) scale(1.12); }
  66%  { transform: translate(-55%, -45%) scale(0.9); }
  100% { transform: translate(-50%, -48%) scale(1.08); }
}

/* --- Shimmer / signal interference layer --- */
.bg-shimmer {
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(255, 255, 255, 0.03) 2px,
      rgba(255, 255, 255, 0.03) 4px
    );
  background-size: 100% 8px;
  opacity: var(--bg-shimmer-opacity);
  animation: shimmerScroll var(--bg-shimmer-speed) linear infinite;
  transition: opacity 1.4s ease;
}

@keyframes shimmerScroll {
  0%   { transform: translateY(0); }
  100% { transform: translateY(8px); }
}

/* --- Vignette (soft edge darkening for depth) --- */
.bg-vignette {
  background: radial-gradient(
    ellipse at center,
    transparent 50%,
    rgb(0, 0, 0) 100%
  );
  opacity: var(--bg-vignette-opacity);
  transition: opacity 1.4s ease;
}

/* ===== FOCUS STATES ===== */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
button:focus-visible, input:focus-visible, select:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ===== HEADER ===== */
.header {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  padding: 0.6rem 1.5rem;
  box-shadow: var(--glass-shadow);
  z-index: 1000;
  flex-shrink: 0;
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.logo {
  display: block;
  width: 100px;
  height: auto;
  object-fit: contain;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.4s ease;
  will-change: transform, filter;
}

.logo:hover {
  transform: scale(1.05) rotate(-2deg);
  filter: drop-shadow(0 8px 16px rgba(59, 130, 246, 0.4));
}

/* ===== CONTROLS ===== */
.controls {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

/* ===== BUTTONS ===== */
.btn {
  padding: 0.5rem 1.25rem;
  border: 1px solid transparent;
  border-radius: 9999px;
  background: var(--primary);
  color: white;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.9rem;
  font-weight: 600;
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  filter: brightness(1.1);
}

.btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

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

.btn-icon {
  padding: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.2rem;
}

.btn-secondary { 
  background: var(--glass-bg); 
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  color: inherit;
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}
.dark-mode .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-success { background: var(--success); }
.btn-danger  { background: var(--accent); }
.btn-primary { background: var(--primary); }

/* ===== MUTED BUTTON STATE ===== */
@keyframes pulseDanger {
  0%   { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70%  { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.btn-muted {
  animation: pulseDanger 2s infinite;
  background: var(--accent) !important;
  color: white !important;
}

/* ===== MAIN CONTAINER ===== */
.main-container {
  flex-grow: 1;
  display: flex;
  gap: 1.5rem;
  padding: 1.5rem;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
  min-height: 0;
}

.main-container.split-active {
  max-width: 100%;
  padding-left: 1rem;
}

/* ===== VIDEO SECTION ===== */
.video-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 0;
}

.video-section.split-view {
  flex-direction: row;
  width: calc(100vw - 380px);
  margin: 0;
  padding: 0;
}

.video-section.split-view .video-container {
  width: 50%;
  aspect-ratio: 16 / 9;
}

.video-section.split-view.swapped {
  flex-direction: row-reverse;
}

.video-section.split-view ~ .chat-section {
  width: 320px;
  position: fixed;
  right: 1.5rem;
  top: 5.5rem;
  height: calc(100vh - 7rem);
}

/* ===== VIDEO CONTAINER ===== */
.video-container {
  position: relative;
  background: var(--video-bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--glass-shadow);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
  min-height: 0;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.video-container.cool-mode {
  animation: neonGlow 3s ease-in-out infinite alternate;
  box-shadow: 0 0 30px rgba(6, 182, 212, 0.5);
}

@keyframes neonGlow {
  0%   { box-shadow: 0 0 20px rgba(59, 130, 246, 0.5), 0 0 40px rgba(6, 182, 212, 0.3); }
  100% { box-shadow: 0 0 40px rgba(167, 139, 250, 0.5), 0 0 60px rgba(192, 132, 252, 0.3); }
}

.video-container.loading {
  opacity: 0.85;
}
.video-container.loading::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--secondary), transparent);
  animation: loadingBar 1.5s ease-in-out infinite;
  z-index: 5;
}

@keyframes loadingBar {
  0%   { left: -100%; }
  100% { left: 200%; }
}

.video-container.fullscreen-mode {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  z-index: 1100;
  background: #000;
  margin: 0;
}

/* ===== CAMERA SWITCH ===== */
.camera-switch-container {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  z-index: 10;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  padding: 0.75rem;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.video-container:hover .camera-switch-container {
  opacity: 1;
  transform: translateY(0);
}

.camera-switch-container select {
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.5);
  color: white;
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
}
.camera-switch-container select:hover {
  border-color: rgba(255, 255, 255, 0.4);
}

/* ===== VIDEO ELEMENT ===== */
video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 0.5s ease, transform 0.5s ease;
}

/* ===== VIDEO OVERLAY ===== */
.video-overlay {
  position: absolute;
  bottom: 1.5rem;
  left: 1.5rem;
  right: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  opacity: 0.9;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.video-container:hover .video-overlay {
  opacity: 1;
  transform: translateY(-5px);
}

.video-overlay > * {
  pointer-events: all;
}

.nickname {
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  color: white;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.video-controls {
  display: flex;
  gap: 0.75rem;
  background: rgba(15, 23, 42, 0.4);
  padding: 0.4rem;
  border-radius: 9999px;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===== REMOTE VIDEO CONTROLS ===== */
.remote-video-controls {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  display: flex;
  gap: 0.75rem;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease;
}
.video-container:hover .remote-video-controls {
  opacity: 1;
  transform: translateY(0);
}

.remote-volume-control {
  position: absolute;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.6rem 1rem;
  border-radius: 9999px;
  opacity: 0;
  transform: translateX(10px);
  transition: all 0.3s ease;
}

.video-container:hover .remote-volume-control,
.touch-device .remote-volume-control {
  opacity: 1;
  transform: translateX(0);
}

.volume-slider {
  width: 100px;
  accent-color: var(--secondary);
  cursor: pointer;
}

.remote-capture-btn {
  position: absolute;
  bottom: 4.5rem;
  right: 1.5rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.video-container:hover .remote-capture-btn {
  opacity: 1;
}

/* ===== AUDIO VISUALIZER ===== */
.audio-visualizer {
  position: absolute;
  left: 1.5rem;
  top: 1.5rem;
  bottom: 1.5rem;
  width: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
}

.audio-visualizer-level {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--success);
  height: 0%;
  transition: height 0.08s ease-out;
  box-shadow: 0 0 10px var(--success);
}

/* ===== CHAT SECTION ===== */
.chat-section {
  width: 380px;
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.chat-header {
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.02);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.dark-mode .chat-header {
  background: rgba(255, 255, 255, 0.02);
}

.chat-header h3 {
  color: inherit;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.chat-messages {
  flex: 1;
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scroll-behavior: smooth;
}

/* ===== CHAT MESSAGES ===== */
.chat-message {
  max-width: 85%;
  padding: 0.75rem 1rem;
  border-radius: 18px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  font-size: var(--chat-font-size);
  line-height: 1.4;
  transition: font-size 0.3s ease;
  animation: slideUpFade 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

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

.chat-message a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.chat-message a:hover {
  opacity: 0.8;
}

.chat-message.own {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-message.other {
  align-self: flex-start;
  background: var(--light);
  color: var(--dark);
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(0,0,0,0.05);
}
.dark-mode .chat-message.other {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-color: rgba(255,255,255,0.05);
}

.chat-message.command {
  align-self: center;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.9), rgba(239, 68, 68, 0.9));
  backdrop-filter: blur(8px);
  color: white;
  text-align: center;
  font-weight: 600;
  max-width: 95%;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
  padding: 0.6rem 1.2rem;
  font-size: 0.9em;
  letter-spacing: 0.2px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ===== CHAT INPUT ===== */
.chat-input-container {
  padding: 1.25rem;
  border-top: 1px solid var(--glass-border);
  display: flex;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.01);
}
.dark-mode .chat-input-container {
  background: rgba(255, 255, 255, 0.01);
}

.chat-input {
  flex: 1;
  padding: 0.8rem 1.2rem;
  border: 1px solid var(--glass-border);
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.5);
  color: inherit;
  font-size: 0.95rem;
  transition: all 0.3s ease;
}
.dark-mode .chat-input {
  background: rgba(0, 0, 0, 0.2);
}
.chat-input:focus {
  background: var(--light);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
.dark-mode .chat-input:focus {
  background: rgba(0, 0, 0, 0.4);
}

/* ===== EMOJI PICKER ===== */
.emoji-picker {
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  background: var(--panel-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(0.95);
  transform-origin: bottom right;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 280px;
  z-index: 1200;
}

.emoji-picker.active {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0) scale(1);
}

.emoji-picker-content {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.4rem;
}

.emoji-picker-pagination {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--glass-border);
}

.page-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: inherit;
  transition: all 0.2s ease;
}

.page-btn:hover {
  background: rgba(128, 128, 128, 0.1);
}

.page-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.emoji-btn {
  font-size: 1.6rem;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 8px;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emoji-btn:hover {
  transform: scale(1.2);
  background: var(--emoji-hover-bg);
}

/* ===== CONNECTION PANEL (MODAL) ===== */
.connection-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--panel-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  padding: 2.5rem;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  text-align: center;
  max-width: 480px;
  width: 90%;
  color: inherit;
  animation: panelFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 500;
}

@keyframes panelFadeIn {
  from { opacity: 0; transform: translate(-50%, -45%) scale(0.9); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.connection-panel h2 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.connection-panel input[type="text"] {
  width: 100%;
  padding: 0.8rem 1.2rem;
  margin: 0.8rem 0;
  border: 2px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.5);
  text-align: center;
  font-size: 1rem;
  font-weight: 500;
  color: inherit;
  transition: all 0.3s ease;
}
.dark-mode .connection-panel input[type="text"] {
  background: rgba(0, 0, 0, 0.2);
}
.connection-panel input[type="text"]:focus {
  border-color: var(--primary);
  background: var(--light);
}
.dark-mode .connection-panel input[type="text"]:focus {
  background: rgba(0, 0, 0, 0.4);
}

.link-container {
  margin: 1.2rem 0;
  padding: 1.2rem;
  background: rgba(0, 0, 0, 0.03);
  border: 1px dashed var(--glass-border);
  border-radius: var(--radius-md);
  word-break: break-all;
  font-family: monospace;
  font-size: 0.95rem;
  transition: all 0.3s ease;
}
.dark-mode .link-container {
  background: rgba(255, 255, 255, 0.03);
}

.copy-link-btn {
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 0.8rem 2rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: bold;
  width: 100%;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
}

.copy-link-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}
.copy-link-btn:active {
  transform: translateY(1px);
}

/* ===== NOTIFICATION ===== */
.notification {
  position: fixed;
  top: 5rem;
  right: 2rem;
  background: var(--success);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  z-index: 2000;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ===== MODAL OVERLAY ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  animation: fadeIn 0.3s ease;
}

.qr-code-container {
  background: var(--panel-bg);
  padding: 2.5rem;
  border-radius: var(--radius-lg);
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  color: inherit;
  border: 1px solid var(--glass-border);
}

.qr-code-container h3 { font-size: 1.4rem; margin-bottom: 1.5rem; }
.qr-code-container p  { margin-top: 1.5rem; opacity: 0.8; }

.qr-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.5rem;
}

/* ===== DISCONNECT OVERLAY ===== */
.disconnect-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(239, 68, 68, 0.85);
  backdrop-filter: blur(12px);
  padding: 2.5rem;
  border-radius: var(--radius-lg);
  box-shadow: 0 15px 40px rgba(239, 68, 68, 0.4);
  z-index: 100;
  border: 1px solid rgba(255,255,255,0.2);
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
}

.disconnect-message {
  color: white;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 1px;
  animation: pulse 2s ease-in-out infinite;
}

/* ===== KEYFRAMES: notifications, overlays, general ===== */
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
  from { transform: translateX(0); opacity: 1; }
  to   { transform: translateX(100%); opacity: 0; }
}

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

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

/* ===== COOL MODE — PANEL ENHANCEMENTS ===== */
body.cool-mode .chat-section {
  border-color: rgba(129, 140, 248, 0.3);
  box-shadow: 0 8px 32px rgba(31, 38, 135, 0.25), 0 0 20px rgba(129, 140, 248, 0.15);
}

body.cool-mode .chat-header {
  background: rgba(129, 140, 248, 0.08);
}

body.cool-mode .chat-input-container {
  background: rgba(129, 140, 248, 0.05);
}

body.cool-mode .chat-input {
  background: rgba(224, 231, 255, 0.6);
  border-color: rgba(129, 140, 248, 0.2);
}

body.cool-mode .chat-input:focus {
  border-color: rgba(129, 140, 248, 0.5);
  background: rgba(224, 231, 255, 0.8);
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.2);
}

body.cool-mode .connection-panel {
  border-color: rgba(129, 140, 248, 0.3);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 30px rgba(129, 140, 248, 0.2);
}

body.cool-mode .connection-panel input[type="text"] {
  background: rgba(224, 231, 255, 0.5);
}

body.cool-mode .emoji-picker {
  border-color: rgba(129, 140, 248, 0.3);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2), 0 0 15px rgba(129, 140, 248, 0.15);
}

body.dark-mode.cool-mode .chat-section {
  border-color: rgba(139, 92, 246, 0.25);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 0 25px rgba(139, 92, 246, 0.15);
}

body.dark-mode.cool-mode .chat-header {
  background: rgba(139, 92, 246, 0.1);
}

body.dark-mode.cool-mode .chat-input-container {
  background: rgba(139, 92, 246, 0.06);
}

body.dark-mode.cool-mode .chat-input {
  background: rgba(30, 20, 60, 0.5);
  border-color: rgba(139, 92, 246, 0.2);
}

body.dark-mode.cool-mode .chat-input:focus {
  border-color: rgba(139, 92, 246, 0.5);
  background: rgba(30, 20, 60, 0.7);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

body.dark-mode.cool-mode .connection-panel {
  border-color: rgba(139, 92, 246, 0.25);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 30px rgba(139, 92, 246, 0.2);
}

body.dark-mode.cool-mode .connection-panel input[type="text"] {
  background: rgba(30, 20, 60, 0.4);
}

body.dark-mode.cool-mode .emoji-picker {
  border-color: rgba(139, 92, 246, 0.25);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3), 0 0 15px rgba(139, 92, 246, 0.15);
}

/* ===== VIDEO STATE INDICATORS ===== */
.video-container.video-off::before {
  content: '📹';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 3.5rem;
  opacity: 0.2;
  pointer-events: none;
  z-index: 5;
  filter: grayscale(1) brightness(2);
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .bg-aurora,
  .bg-glow,
  .bg-shimmer {
    animation: none !important;
  }

  .bg-base,
  .bg-aurora,
  .bg-glow,
  .bg-shimmer,
  .bg-vignette {
    transition: none !important;
  }
}

/* ===== RESPONSIVE: TABLET ===== */
@media (max-width: 992px) {
  .main-container {
    flex-direction: column;
    overflow: auto;
    padding: 1rem;
  }

  .chat-section {
    width: 100%;
    height: 400px;
    flex-shrink: 0;
  }

  .video-section.split-view {
    flex-direction: column;
    flex: 1;
    width: 100%;
  }

  .video-section.split-view .video-container {
    width: 100%;
    aspect-ratio: 16/9;
  }

  .video-section.split-view ~ .chat-section {
    width: 100%;
    position: static;
    height: 400px;
  }

  .controls { gap: 0.5rem; }
  .logo     { width: 85px; }
  .btn      { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
  .btn-icon { width: 38px; height: 38px; }

  .remote-volume-control { opacity: 1; transform: none; }
}

/* ===== RESPONSIVE: PHONE ===== */
@media (max-width: 480px) {
  .header { padding: 0.5rem 1rem; }
  .header-content { flex-wrap: wrap; justify-content: center; }
  .controls { width: 100%; justify-content: center; }
  .connection-panel { padding: 1.5rem; }
  .qr-buttons { flex-direction: column; }
}
