/* Flying Lavash Angels - CSS */

/* CSS Custom Properties (Variables) */
:root {
  /* Color Palette */
  --sky-dawn: #87CEEB;
  --sky-day: #B0E0E6;
  --sky-evening: #FFB6C1;
  --warm-glow: #ff8c42;
  --clay-brown: #8b4513;
  --lavash-cream: #f4e4bc;
  --text-primary: #2c3e50;
  --text-secondary: #7f8c8d;
  --accent-gold: #ffd700;
  
  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  
  /* Timing */
  --anim-fast: 0.3s;
  --anim-medium: 0.6s;
  --anim-slow: 1.2s;
  
  /* Z-indexes */
  --z-background: 0;
  --z-lavash: 10;
  --z-hearth: 20;
  --z-ui: 100;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --sky-dawn: #2c3e50;
    --sky-day: #34495e;
    --sky-evening: #4a6741;
    --text-primary: #ecf0f1;
    --text-secondary: #bdc3c7;
  }
}

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: 'Arial', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow: hidden; /* Prevent scrollbars for full experience */
}

body {
  background: linear-gradient(
    180deg,
    var(--sky-dawn) 0%,
    var(--sky-day) 50%,
    var(--sky-evening) 100%
  );
  color: var(--text-primary);
  position: relative;
}

/* Scene Container */
.scene-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* Presence Badge */
.presence-badge {
  position: fixed;
  top: var(--spacing-md);
  left: var(--spacing-md);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  z-index: var(--z-ui);
  transition: all var(--anim-fast) ease;
  user-select: none;
}

.presence-badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.presence-icon {
  margin-right: var(--spacing-xs);
}

/* Connection Status */
.connection-status {
  position: fixed;
  top: var(--spacing-md);
  right: var(--spacing-md);
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: 0.8rem;
  color: var(--text-secondary);
  z-index: var(--z-ui);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e74c3c;
  animation: pulse 2s infinite;
}

.connection-status.connected .status-dot {
  background: #27ae60;
  animation: none;
}

.connection-status.reconnecting .status-dot {
  background: #f39c12;
  animation: pulse 1s infinite;
}

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

/* Flying Lavash Container */
.lavash-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: var(--z-lavash);
}

/* Individual Flying Lavash */
.flying-lavash {
  position: absolute;
  width: 60px;
  height: 45px;
  opacity: 0;
  transform: translateZ(0); /* Force hardware acceleration */
  will-change: transform, opacity;
  pointer-events: none;
}

.flying-lavash img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Lavash Animation Variants */
.flying-lavash.variant-1 {
  animation: float-drift-1 8s ease-out forwards;
}

.flying-lavash.variant-2 {
  animation: float-drift-2 7s ease-out forwards;
}

.flying-lavash.variant-3 {
  animation: float-drift-3 9s ease-out forwards;
}

/* Lavash Float Animations */
@keyframes float-drift-1 {
  0% {
    transform: translate(0, 0) rotate(0deg) scale(0.8);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  30% {
    transform: translate(-20px, -100px) rotate(15deg) scale(1);
  }
  60% {
    transform: translate(10px, -250px) rotate(-10deg) scale(1.1);
    opacity: 1;
  }
  90% {
    transform: translate(-30px, -400px) rotate(20deg) scale(0.9);
    opacity: 0.3;
  }
  100% {
    transform: translate(-50px, -500px) rotate(25deg) scale(0.7);
    opacity: 0;
  }
}

@keyframes float-drift-2 {
  0% {
    transform: translate(0, 0) rotate(0deg) scale(0.7);
    opacity: 0;
  }
  8% {
    opacity: 1;
  }
  25% {
    transform: translate(30px, -80px) rotate(-12deg) scale(1);
  }
  55% {
    transform: translate(-15px, -200px) rotate(8deg) scale(1.05);
    opacity: 1;
  }
  85% {
    transform: translate(25px, -350px) rotate(-15deg) scale(0.8);
    opacity: 0.4;
  }
  100% {
    transform: translate(40px, -450px) rotate(-20deg) scale(0.6);
    opacity: 0;
  }
}

@keyframes float-drift-3 {
  0% {
    transform: translate(0, 0) rotate(0deg) scale(0.9);
    opacity: 0;
  }
  12% {
    opacity: 1;
  }
  35% {
    transform: translate(-40px, -120px) rotate(18deg) scale(1.1);
  }
  65% {
    transform: translate(20px, -280px) rotate(-8deg) scale(1);
    opacity: 1;
  }
  88% {
    transform: translate(-10px, -420px) rotate(12deg) scale(0.85);
    opacity: 0.2;
  }
  100% {
    transform: translate(-35px, -550px) rotate(22deg) scale(0.5);
    opacity: 0;
  }
}

/* Hearth Scene */
.hearth-scene {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: var(--spacing-lg);
  z-index: var(--z-hearth);
  padding-bottom: env(safe-area-inset-bottom, var(--spacing-md));
}

.grandma-container {
  display: flex;
  align-items: flex-end;
}

.grandma {
  height: 120px;
  width: auto;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.tonir-container {
  position: relative;
}

.tonir {
  height: 90px;
  width: auto;
  filter: drop-shadow(0 6px 12px rgba(255, 140, 66, 0.3));
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    var(--sky-dawn) 0%,
    var(--sky-day) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity var(--anim-slow) ease, visibility var(--anim-slow) ease;
}

.loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-content {
  text-align: center;
  color: var(--text-primary);
}

.loading-content p {
  margin-top: var(--spacing-md);
  font-size: 1.1rem;
  font-weight: 500;
}

.loading-lavash {
  width: 80px;
  height: 60px;
  animation: loading-float 2s ease-in-out infinite;
}

@keyframes loading-float {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(10deg); }
}

/* Error Message */
.error-message {
  position: fixed;
  bottom: var(--spacing-lg);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(231, 76, 60, 0.9);
  color: white;
  padding: var(--spacing-md) var(--spacing-lg);
  border-radius: 8px;
  font-weight: 500;
  z-index: var(--z-ui);
  backdrop-filter: blur(10px);
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .flying-lavash.variant-1,
  .flying-lavash.variant-2,
  .flying-lavash.variant-3 {
    animation: simple-fade 3s ease-out forwards;
  }
  
  .loading-lavash {
    animation: none;
  }
  
  .status-dot {
    animation: none;
  }
  
  @keyframes simple-fade {
    0% { opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
  }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .presence-badge {
    font-size: 0.8rem;
    padding: var(--spacing-xs) var(--spacing-sm);
  }
  
  .hearth-scene {
    gap: var(--spacing-md);
    transform: translateX(-50%) scale(0.8);
    transform-origin: center bottom;
  }
  
  .grandma {
    height: 100px;
  }
  
  .tonir {
    height: 75px;
  }
  
  .flying-lavash {
    width: 50px;
    height: 38px;
  }
  
  /* Adjust animations for smaller screens */
  @keyframes float-drift-1 {
    0% {
      transform: translate(0, 0) rotate(0deg) scale(0.6);
      opacity: 0;
    }
    10% {
      opacity: 1;
    }
    30% {
      transform: translate(-15px, -80px) rotate(10deg) scale(0.8);
    }
    60% {
      transform: translate(8px, -180px) rotate(-8deg) scale(0.9);
      opacity: 1;
    }
    90% {
      transform: translate(-20px, -280px) rotate(15deg) scale(0.7);
      opacity: 0.3;
    }
    100% {
      transform: translate(-30px, -350px) rotate(18deg) scale(0.5);
      opacity: 0;
    }
  }
  
  @keyframes float-drift-2 {
    0% {
      transform: translate(0, 0) rotate(0deg) scale(0.5);
      opacity: 0;
    }
    8% {
      opacity: 1;
    }
    25% {
      transform: translate(20px, -60px) rotate(-8deg) scale(0.8);
    }
    55% {
      transform: translate(-10px, -150px) rotate(6deg) scale(0.85);
      opacity: 1;
    }
    85% {
      transform: translate(18px, -250px) rotate(-12deg) scale(0.6);
      opacity: 0.4;
    }
    100% {
      transform: translate(25px, -320px) rotate(-15deg) scale(0.4);
      opacity: 0;
    }
  }
  
  @keyframes float-drift-3 {
    0% {
      transform: translate(0, 0) rotate(0deg) scale(0.7);
      opacity: 0;
    }
    12% {
      opacity: 1;
    }
    35% {
      transform: translate(-25px, -90px) rotate(12deg) scale(0.9);
    }
    65% {
      transform: translate(15px, -200px) rotate(-6deg) scale(0.8);
      opacity: 1;
    }
    88% {
      transform: translate(-8px, -300px) rotate(10deg) scale(0.65);
      opacity: 0.2;
    }
    100% {
      transform: translate(-25px, -380px) rotate(16deg) scale(0.4);
      opacity: 0;
    }
  }
}

/* Very small screens */
@media (max-width: 480px) {
  .hearth-scene {
    transform: translateX(-50%) scale(0.7);
  }
  
  .presence-badge {
    font-size: 0.75rem;
    top: var(--spacing-sm);
    left: var(--spacing-sm);
  }
  
  .connection-status {
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    font-size: 0.7rem;
  }
}

/* High contrast support */
@media (prefers-contrast: high) {
  .presence-badge {
    background: white;
    border: 2px solid var(--text-primary);
  }
  
  .connection-status {
    color: var(--text-primary);
    font-weight: bold;
  }
}

/* Print styles (hide interactive elements) */
@media print {
  .presence-badge,
  .connection-status,
  .flying-lavash,
  .loading-overlay,
  .error-message {
    display: none !important;
  }
}