@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Playfair+Display:wght@400;600;700&family=Poppins:wght@300;400;500;600;700&display=swap');

/* ✅ UNIVERSAL SAFE AREA FOR iOS & Android with Fallbacks */
:root {
  /* Modern iOS 11.2+ and Android */
  --sat: env(safe-area-inset-top);
  --sab: env(safe-area-inset-bottom);
  --sal: env(safe-area-inset-left);
  --sar: env(safe-area-inset-right);
  
  /* Fallback for iOS 11.0-11.1 */
  --sat: constant(safe-area-inset-top);
  --sab: constant(safe-area-inset-bottom);
  --sal: constant(safe-area-inset-left);
  --sar: constant(safe-area-inset-right);
}

/* ✅ Prevent iOS bouncing and movement */
html, body {
  width: 100%;
  height: 100%;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  position: fixed;
  touch-action: pan-y pinch-zoom;
  -webkit-overflow-scrolling: touch;
}

/* ✅ Root container with safe area padding */
#root {
  min-height: 100vh;
  min-height: -webkit-fill-available;
  width: 100%;
  height: 100%;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  padding-top: env(safe-area-inset-top);
  display: flex;
  flex-direction: column;
}

/* iOS-specific header spacing */
.app-header, ion-header {
  padding-top: var(--sat);
}

/* Safe area utility classes */
.safe-area-top {
  padding-top: var(--sat);
}

.safe-area-bottom {
  padding-bottom: max(var(--sab), 16px);
}

.safe-area-pb {
  padding-bottom: max(var(--sab), 16px);
}

/* Pages with full height - respects safe areas */
.min-h-screen {
  min-height: calc(100dvh - var(--sat) - var(--sab));
}

/* Prevent content jump/movement on empty pages */
.page-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: env(safe-area-inset-bottom);
}

/* Empty state containers - static positioning */
.empty-state {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 400px;
  text-align: center;
}

@tailwind base;
@tailwind components;
@tailwind utilities;

/* Definition of the design system. All colors, gradients, fonts, etc should be defined here. 
All colors MUST be HSL.
*/

@layer base {
  :root {
    /* Pomaa Go Brand Colors */
    --background: 0 0% 98%;
    --foreground: 210 60% 12%;

    --card: 0 0% 100%;
    --card-foreground: 210 60% 12%;

    --popover: 0 0% 100%;
    --popover-foreground: 210 60% 12%;

    /* Vibrant Orange Primary */
    --primary: 24 95% 53%;
    --primary-foreground: 0 0% 100%;
    --primary-glow: 24 95% 63%;
    --primary-muted: 24 85% 95%;

    /* Clean White Secondary */
    --secondary: 0 0% 96%;
    --secondary-foreground: 210 60% 12%;

    --muted: 210 40% 96%;
    --muted-foreground: 215.4 16.3% 46.9%;

    /* Deep Blue Accent */
    --accent: 210 60% 12%;
    --accent-foreground: 0 0% 100%;
    --accent-light: 210 60% 25%;

    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 0 0% 100%;

    --border: 210 20% 90%;
    --input: 210 20% 90%;
    --ring: 24 95% 53%;

    --radius: 0.75rem;

    /* Beautiful Gradients */
    --gradient-primary: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--primary-glow)));
    --gradient-hero: linear-gradient(135deg, hsl(var(--primary) / 0.1), hsl(var(--accent) / 0.05));
    --gradient-card: linear-gradient(135deg, hsl(var(--card)), hsl(var(--card) / 0.9));
    --gradient-subtle: linear-gradient(180deg, hsl(var(--background)), hsl(var(--muted) / 0.3));

    /* Elegant Shadows */
    --shadow-elegant: 0 10px 30px -10px hsl(var(--primary) / 0.15);
    --shadow-glow: 0 0 40px hsl(var(--primary-glow) / 0.2);
    --shadow-card: 0 4px 20px -4px hsl(var(--foreground) / 0.1);
    --shadow-elevated: 0 20px 40px -10px hsl(var(--foreground) / 0.15);

    /* Smooth Animations */
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);

    --sidebar-background: 0 0% 98%;

    --sidebar-foreground: 240 5.3% 26.1%;

    --sidebar-primary: 240 5.9% 10%;

    --sidebar-primary-foreground: 0 0% 98%;

    --sidebar-accent: 240 4.8% 95.9%;

    --sidebar-accent-foreground: 240 5.9% 10%;

    --sidebar-border: 220 13% 91%;

    --sidebar-ring: 217.2 91.2% 59.8%;
  }

  .dark {
    /* Pomaa Go Dark Mode */
    --background: 210 60% 8%;
    --foreground: 0 0% 95%;

    --card: 210 50% 10%;
    --card-foreground: 0 0% 95%;

    --popover: 210 50% 10%;
    --popover-foreground: 0 0% 95%;

    /* Orange stays vibrant in dark */
    --primary: 24 95% 53%;
    --primary-foreground: 210 60% 8%;

    --secondary: 210 40% 15%;
    --secondary-foreground: 0 0% 95%;

    --muted: 210 40% 15%;
    --muted-foreground: 215 20.2% 65.1%;

    /* Lighter blue accent for dark mode */
    --accent: 210 80% 25%;
    --accent-foreground: 0 0% 95%;

    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 0 0% 95%;

    --border: 210 40% 20%;
    --input: 210 40% 20%;
    --ring: 24 95% 53%;
    --sidebar-background: 240 5.9% 10%;
    --sidebar-foreground: 240 4.8% 95.9%;
    --sidebar-primary: 224.3 76.3% 48%;
    --sidebar-primary-foreground: 0 0% 100%;
    --sidebar-accent: 240 3.7% 15.9%;
    --sidebar-accent-foreground: 240 4.8% 95.9%;
    --sidebar-border: 240 3.7% 15.9%;
    --sidebar-ring: 217.2 91.2% 59.8%;
  }
}

@layer base {
  * {
    @apply border-border;
  }

  body {
    @apply bg-background text-foreground font-inter;
    background: linear-gradient(135deg, hsl(var(--background)), hsl(var(--muted) / 0.3));
    background-attachment: scroll;
    font-size: 14px;
  }

  /* Consistent font sizing across all pages */
  h1 {
    @apply text-lg font-bold;
  }

  h2 {
    @apply text-base font-semibold;
  }

  h3 {
    @apply text-sm font-semibold;
  }

  p, span, div {
    @apply text-sm;
  }

  button {
    @apply text-xs font-semibold;
  }

  input, textarea, select {
    @apply text-sm;
  }

  /* Beautiful Typography */
  .font-display {
    font-family: 'Playfair Display', serif;
  }
  
  .font-brand {
    font-family: 'Poppins', sans-serif;
  }
  
  .font-inter {
    font-family: 'Inter', sans-serif;
  }

  /* Enhanced animations */
  .btn-glow {
    position: relative;
    overflow: hidden;
    transition: var(--transition-smooth);
  }

  .btn-glow::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 ease-out;
  }

  .btn-glow:hover::before {
    left: 100%;
  }

  .btn-ripple {
    position: relative;
    overflow: hidden;
  }

  .btn-ripple::after {
    content: '';
    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.3s ease-out, height 0.3s ease-out;
  }

  .btn-ripple:active::after {
    width: 300px;
    height: 300px;
  }

  /* Enhanced animations */
  .hover-scale {
    @apply transition-all duration-300 hover:scale-105;
  }

  .hover-glow {
    @apply transition-all duration-300;
  }

  .hover-glow:hover {
    box-shadow: var(--shadow-glow);
  }

  .animate-float {
    animation: float 3s ease-in-out infinite;
  }

  .animate-slide-up {
    animation: slide-up 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  }

  .animate-fade-in-delayed {
    animation: fade-in 0.8s ease-out 0.3s both;
  }

  .glass-effect {
    @apply backdrop-blur-lg bg-white/80 border border-white/30 shadow-lg;
  }

  .dark .glass-effect {
    @apply backdrop-blur-lg bg-gray-900/80 border border-gray-700/30;
  }

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

  @keyframes slide-up {
    from {
      opacity: 0;
      transform: translateY(30px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

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

  /* Enhanced card styles */
  .card-enhanced {
    background: var(--gradient-card);
    border: 1px solid hsl(var(--border) / 0.5);
    box-shadow: var(--shadow-card);
    transition: var(--transition-smooth);
  }

  .card-enhanced:hover {
    box-shadow: var(--shadow-elevated);
    transform: translateY(-4px);
  }

  /* Enhanced animations for auth pages */
  @keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
  }

  @keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
  }

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

  @keyframes scale-in {
    from { 
      opacity: 0;
      transform: scale(0.95);
    }
    to { 
      opacity: 1;
      transform: scale(1);
    }
  }

  @keyframes bounce-slow {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
  }

  .animate-float {
    animation: float 6s ease-in-out infinite;
  }

  .animate-fade-in {
    animation: fade-in 0.6s ease-out;
  }

  .animate-slide-up {
    animation: slide-up 0.5s ease-out;
  }

  .animate-scale-in {
    animation: scale-in 0.4s ease-out;
  }

  .animate-bounce-slow {
    animation: bounce-slow 2s ease-in-out infinite;
  }

  .hover-scale {
    transition: transform 0.3s ease;
  }

  .hover-scale:hover {
    transform: scale(1.05);
  }

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

  /* Smooth transitions for interactive elements */
  .smooth-transition {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* Touch-friendly button press effect */
  .button-press {
    transition: transform 0.1s ease;
  }

  .button-press:active {
    transform: scale(0.95);
  }

  /* Mobile-optimized safe area padding */
  @supports (padding: env(safe-area-inset-bottom)) {
    .safe-bottom {
      padding-bottom: env(safe-area-inset-bottom);
    }
  }

  /* Responsive grid improvements */
  @media (max-width: 640px) {
    .responsive-grid {
      grid-template-columns: 1fr;
    }
  }

  @media (min-width: 641px) and (max-width: 1024px) {
    .responsive-grid {
      grid-template-columns: repeat(2, 1fr);
    }
  }

  @media (min-width: 1025px) {
    .responsive-grid {
      grid-template-columns: repeat(3, 1fr);
    }
  }
}
