/* ==============================================
   PetFi Global Styles
   Variables CSS, reset, y utilidades globales
   ============================================== */

/* Base typography - Roboto to match Flutter Web's CanvasKit rendering */
html, body {
  font-family: 'Roboto', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

:root {
  /* Brand Colors */
  --petfi-purple-50: #f5f3ff;
  --petfi-purple-100: #ede9fe;
  --petfi-purple-200: #ddd6fe;
  --petfi-purple-300: #c4b5fd;
  --petfi-purple-400: #a78bfa;
  --petfi-purple-500: #8b5cf6;
  --petfi-purple-600: #7c3aed;
  --petfi-purple-700: #6d28d9;
  --petfi-purple-800: #5b21b6;
  --petfi-purple-900: #4c1d95;
  
  /* Accent Colors */
  --petfi-orange: #F97316;
  --petfi-green: #10B981;
  --petfi-red: #EF4444;
  
  /* Neutral Colors */
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;
  
  /* Gradients */
  --gradient-purple: linear-gradient(135deg, #9638EB 0%, #7C3AED 100%);
  --gradient-purple-dark: linear-gradient(135deg, #7C3AED 0%, #5B21B6 100%);
  --gradient-purple-light: linear-gradient(135deg, #EDE9FE 0%, #F3E8FF 100%);
  --gradient-dark: linear-gradient(135deg, #1F2937 0%, #111827 100%);
  --gradient-hero-overlay: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.4) 40%, transparent 70%);
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --shadow-purple: 0 4px 12px rgba(150, 56, 235, 0.3);
  --shadow-purple-lg: 0 10px 40px rgba(124, 58, 237, 0.3);
  
  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-2xl: 48px;
  
  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;
  --radius-full: 9999px;
  
  /* Typography */
  --font-sans: 'Roboto', system-ui, sans-serif;
  --font-size-xs: 12px;
  --font-size-sm: 14px;
  --font-size-base: 16px;
  --font-size-lg: 18px;
  --font-size-xl: 20px;
  --font-size-2xl: 24px;
  --font-size-3xl: 30px;
  --font-size-4xl: 36px;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
}

/* ==============================================
   Utility Classes
   ============================================== */

/* Hide scrollbar but keep functionality */
.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* Glass effect */
.glass {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.glass-dark {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Gradient backgrounds */
.bg-gradient-purple {
  background: var(--gradient-purple);
}

.bg-gradient-purple-dark {
  background: var(--gradient-purple-dark);
}

.bg-gradient-purple-light {
  background: var(--gradient-purple-light);
}

.bg-gradient-dark {
  background: var(--gradient-dark);
}

/* Text gradient */
.text-gradient-purple {
  background: var(--gradient-purple);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Shadow utilities */
.shadow-purple {
  box-shadow: var(--shadow-purple);
}

.shadow-purple-lg {
  box-shadow: var(--shadow-purple-lg);
}

/* Animation utilities */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

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

.animate-fade-in {
  animation: fadeIn var(--transition-base) ease-out;
}

.animate-slide-up {
  animation: slideUp var(--transition-slow) ease-out;
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Focus states */
.focus-ring:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--petfi-purple-200);
}

/* Line clamp */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Quiz page - gradient on html/body so it covers everything */
html:has(#quiz-app),
body:has(#quiz-app) {
  background: linear-gradient(135deg, #7C3AED 0%, #9638EB 50%, #A855F7 100%) !important;
  background-attachment: fixed !important;
  min-height: 100vh;
  min-height: 100dvh;
}

#quiz-app {
  background: transparent;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: 40px;
}

/* Quiz results - mobile optimizations */
@media (max-width: 767px) {
  #match-image-container {
    min-height: 180px !important;
    max-height: 220px !important;
  }
  #match-image-container img {
    max-height: 220px !important;
  }
  #match-name {
    font-size: 24px !important;
  }
  #match-statement {
    font-size: 15px !important;
  }
  #match-description {
    font-size: 13px !important;
    -webkit-line-clamp: 3;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  #match-reasons {
    gap: 6px !important;
  }
  #match-reasons > div {
    padding: 4px 8px !important;
    font-size: 10px !important;
  }
  #other-matches-section p {
    font-size: 13px !important;
  }
}

/* Quiz results - desktop optimizations */
@media (min-width: 768px) {
  #match-image-container {
    min-height: 300px !important;
    max-height: 400px !important;
  }
  #match-image-container img {
    max-height: 400px !important;
  }
}

/* Quiz carousel - hide scrollbar */
#other-matches::-webkit-scrollbar {
  display: none;
}

/* Filter chips container - hide scrollbar for cleaner mobile UI */
#filter-chips-container {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
#filter-chips-container::-webkit-scrollbar {
  display: none;
}

#other-matches a:hover > div {
  transform: scale(1.03);
}

/* Fallback for browsers without :has() support */
@supports not selector(:has(*)) {
  #quiz-app {
    background: linear-gradient(135deg, #7C3AED 0%, #9638EB 50%, #A855F7 100%);
    background-attachment: fixed;
  }
}

/* Match badge pulse animation */
@keyframes matchPulse {
  0%, 100% {
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.5);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 6px 24px rgba(16, 185, 129, 0.7);
    transform: scale(1.03);
  }
}

.match-badge-pulse {
  animation: matchPulse 2s ease-in-out infinite;
}

/* FAQ Chevron rotation */
details[open] .faq-chevron {
  transform: rotate(180deg);
}

details summary::-webkit-details-marker {
  display: none;
}

/* ==============================================
   Navigation Splash Screen
   Shows while SSR pages are loading
   Matches Flutter Web redirect splash exactly
   ============================================== */
#nav-splash {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99999;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #7C3AED 0%, #9638EB 50%, #A855F7 100%);
  opacity: 0;
  transition: opacity 0.2s ease-out;
  overflow: hidden;
}

#nav-splash.nav-splash--visible {
  display: flex;
  opacity: 1;
}

#nav-splash.nav-splash--hiding {
  opacity: 0;
}

/* Floating paws background */
.nav-splash__paw {
  position: absolute;
  font-family: 'Material Symbols Rounded';
  color: white;
  opacity: 0.15;
  animation: navFloat 3s ease-in-out infinite;
  pointer-events: none;
}

@keyframes navFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}

/* Logo container with glassmorphism - matching Flutter */
.nav-splash__logo {
  width: 120px;
  height: 120px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.15);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: navLogoIn 0.8s ease-out forwards;
  margin-bottom: 32px;
}

.nav-splash__logo-icon {
  font-size: 60px;
  color: rgba(255, 255, 255, 0.95);
}

@keyframes navLogoIn {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Brand name - matching Flutter's 56px semi-bold */
.nav-splash__brand {
  font-family: var(--font-sans);
  font-size: 56px;
  font-weight: 600;
  color: white;
  letter-spacing: 1.2px;
  margin-bottom: 16px;
  animation: navTextSlideIn 0.6s ease-out 0.3s forwards;
  opacity: 0;
  transform: translateY(20px);
}

@keyframes navTextSlideIn {
  0% { transform: translateY(20px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* Tagline - matches Flutter's AnimatedSplashScreen tagline */
.nav-splash__tagline {
  font-family: var(--font-sans);
  font-size: 16px;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.5px;
  text-align: center;
  max-width: 320px;
  margin-bottom: 48px;
  animation: navFadeIn 0.6s ease-out 0.5s forwards;
  opacity: 0;
}

@keyframes navFadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

/* Spinner - matching Flutter AnimatedSplashScreen */
.nav-splash__spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: navSpin 1s linear infinite, navFadeIn 0.6s ease-out 0.7s forwards;
  opacity: 0;
}

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

/* Loading text below spinner */
.nav-splash__loading-text {
  font-family: var(--font-sans);
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  letter-spacing: 0.5px;
  margin-top: 16px;
  animation: navFadeIn 0.6s ease-out 0.9s forwards;
  opacity: 0;
}
