/* Global Styles & Animations for Speaga */

body {
  background-color: #f1f5f9;
  color: #0f172a;
  font-family: 'Plus Jakarta Sans', 'sans-serif';
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Noise Texture Overlay for premium feel */
.bg-noise {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  opacity: 0.03;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Animated background blobs */
.bg-blob-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
  background: #f8fafc;
}

.blob {
  position: absolute;
  filter: blur(90px);
  opacity: 0.5;
  animation: blob 25s infinite alternate cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
}

@keyframes blob {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(15vw, -20vh) scale(1.1); }
  50% { transform: translate(-10vw, 15vh) scale(0.9); }
  75% { transform: translate(20vw, 10vh) scale(1.05); }
}

/* Light mode blobs - softer pastel tones */
body:not(.dark) .blob-1 { 
  top: -5%; left: -5%; 
  width: 60vw; height: 60vw; 
  background: #e0e7ff; /* Indigo-100 */
  animation-delay: 0s; 
}

body:not(.dark) .blob-2 { 
  top: 30%; right: -10%; 
  width: 50vw; height: 50vw; 
  background: #f3e8ff; /* Purple-100 */
  animation-delay: 4s; 
}

body:not(.dark) .blob-3 { 
  bottom: -10%; left: 15%; 
  width: 65vw; height: 65vw; 
  background: #fce7f3; /* Pink-100 */
  animation-delay: 7s; 
}

/* Dark mode */
html.dark body {
  background-color: #020617; /* Slate-950 */
  color: #f1f5f9;
}

html.dark .bg-blob-container {
  background: #020617;
}

html.dark .blob-1 { 
  top: -10%; left: -10%; 
  width: 60vw; height: 60vw; 
  background: rgba(49, 46, 129, 0.25); 
  opacity: 0.4; 
}

html.dark .blob-2 { 
  top: 30%; right: -20%; 
  width: 50vw; height: 50vw; 
  background: rgba(88, 28, 135, 0.2); 
  opacity: 0.4;
}

html.dark .blob-3 { 
  bottom: -10%; left: 10%; 
  width: 55vw; height: 55vw; 
  background: rgba(131, 24, 67, 0.2); 
  opacity: 0.4;
}

/* Arabic font */
html[lang="ar"] body {
  font-family: 'IBM Plex Sans Arabic', 'Cairo', 'sans-serif';
}

/* Refined Glassmorphism */
.glass {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.6);
}

html.dark .glass {
  background: rgba(15, 23, 42, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Custom scrollbar - Enhanced */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(241, 245, 249, 0.3);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #818cf8, #6366f1);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
  transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #6366f1, #4f46e5);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

html.dark ::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.3);
}

html.dark ::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #6366f1, #4f46e5);
}

html.dark ::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #818cf8, #6366f1);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

/* Focus styles */
*:focus-visible {
  outline: 3px solid #818cf8;
  outline-offset: 3px;
  border-radius: 8px;
}

/* Enhanced button transitions */
button {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Smooth page transitions */
.page-transition {
  animation: pageIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Popup bounce animation */
@keyframes popupBounce {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(30px) scale(0.8);
  }
  50% {
    transform: translateX(-50%) translateY(-5px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

.animate-popup-bounce {
  animation: popupBounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Mobile Responsive Improvements */
@media (max-width: 768px) {
  body {
    font-size: 14px;
  }
  
  /* Prevent horizontal scroll */
  html, body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
  }
  
  /* Better touch targets */
  button, a, input, select, textarea {
    min-height: 44px;
  }
  
  /* Adjust blob sizes for mobile */
  .blob {
    filter: blur(60px);
  }
  
  body:not(.dark) .blob-1 { width: 80vw; height: 80vw; }
  body:not(.dark) .blob-2 { width: 70vw; height: 70vw; }
  body:not(.dark) .blob-3 { width: 85vw; height: 85vw; }
  
  html.dark .blob-1 { width: 80vw; height: 80vw; }
  html.dark .blob-2 { width: 70vw; height: 70vw; }
  html.dark .blob-3 { width: 75vw; height: 75vw; }
}

/* Small mobile devices */
@media (max-width: 480px) {
  body {
    font-size: 13px;
  }
}
