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

/* Global mobile overflow prevention */
html {
  overflow-x: clip;
  scroll-behavior: smooth;
}

body {
  overflow-x: clip;
}

/* Responsive container utilities */
.container {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

* {
  box-sizing: border-box;
}

*:before,
*:after {
  box-sizing: border-box;
}

:root {
  /* iYUREK Brand - Light Mode */
  --background: 0 0% 100%;
  --foreground: 222.2 84% 4.9%;
  --card: 0 0% 100%;
  --card-foreground: 222.2 84% 4.9%;
  --popover: 0 0% 100%;
  --popover-foreground: 222.2 84% 4.9%;
  
  /* iYUREK Blue - Primary */
  --primary: 221.2 83.2% 53.3%;
  --primary-foreground: 210 40% 98%;
  --primary-glow: 221.2 85% 60%;
  --primary-variant: 221.2 80% 48%;
  
  /* Secondary */
  --secondary: 210 40% 96.1%;
  --secondary-foreground: 222.2 47.4% 11.2%;
  --accent: 210 40% 96.1%;
  --accent-foreground: 222.2 47.4% 11.2%;
  
  /* Neutrals */
  --muted: 210 40% 96.1%;
  --muted-foreground: 215.4 16.3% 46.9%;
  --border: 214.3 31.8% 91.4%;
  --input: 214.3 31.8% 91.4%;
  --ring: 221.2 83.2% 53.3%;
  
  --radius: 0.5rem;
  
  /* Status Colors */
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 210 40% 98%;
  --warning: 38 92% 50%;
  --warning-foreground: 0 0% 100%;
  --success: 142 76% 36%;
  --success-foreground: 0 0% 100%;
  
  /* Gradients */
  --gradient-primary: linear-gradient(135deg, hsl(221.2 83.2% 53.3%), hsl(221.2 80% 60%));
  --gradient-neural: linear-gradient(135deg, hsl(221.2 83.2% 53.3% / 0.08), hsl(210 40% 96.1% / 0.05));
  --gradient-data: linear-gradient(180deg, hsl(221.2 83.2% 53.3% / 0.03), transparent);
  --gradient-card: linear-gradient(180deg, hsl(0 0% 100%), hsl(210 40% 98%));
  --gradient-premium: linear-gradient(135deg, hsl(221.2 83.2% 53.3% / 0.05), transparent);
  --gradient-hero: linear-gradient(180deg, hsl(210 40% 98%) 0%, hsl(0 0% 100%) 50%, hsl(210 40% 98%) 100%);
  
  /* Subtle pattern */
  --neural-pattern: radial-gradient(ellipse 800px 600px at 20% 20%, hsl(221.2 83.2% 53.3% / 0.03) 0%, transparent 70%),
                    radial-gradient(ellipse 600px 400px at 80% 80%, hsl(210 40% 96.1% / 0.02) 0%, transparent 70%);
  
  /* Shadows */
  --shadow-sm: 0 1px 2px hsl(222.2 84% 4.9% / 0.04);
  --shadow-md: 0 4px 12px hsl(222.2 84% 4.9% / 0.06);
  --shadow-lg: 0 8px 30px hsl(222.2 84% 4.9% / 0.08);
  --shadow-xl: 0 20px 60px hsl(222.2 84% 4.9% / 0.10);
  --shadow-premium: 0 1px 2px hsl(222.2 84% 4.9% / 0.03), 0 8px 24px hsl(222.2 84% 4.9% / 0.08);
  --shadow-glow: 0 0 60px hsl(221.2 83.2% 53.3% / 0.15);
  --shadow-neural: 0 4px 20px hsl(221.2 83.2% 53.3% / 0.12);
  --shadow-data: 0 2px 8px hsl(222.2 84% 4.9% / 0.04);
  --shadow-card: 0 1px 3px hsl(222.2 84% 4.9% / 0.02), 0 4px 16px hsl(222.2 84% 4.9% / 0.04);
  
  /* Transitions */
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-premium: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  
  /* Grid pattern */
  --grid-pattern: linear-gradient(hsl(214.3 31.8% 91.4% / 0.5) 1px, transparent 1px),
                  linear-gradient(90deg, hsl(214.3 31.8% 91.4% / 0.5) 1px, transparent 1px);
}

.dark {
  /* iYUREK Brand - Dark Mode */
  --background: 222.2 84% 4.9%;
  --foreground: 210 40% 98%;
  --card: 222.2 84% 4.9%;
  --card-foreground: 210 40% 98%;
  --popover: 222.2 84% 4.9%;
  --popover-foreground: 210 40% 98%;
  
  /* iYUREK Blue - Dark Mode */
  --primary: 217.2 91.2% 59.8%;
  --primary-foreground: 222.2 47.4% 11.2%;
  --primary-glow: 217.2 95% 65%;
  --primary-variant: 217.2 85% 55%;
  
  /* Secondary */
  --secondary: 217.2 32.6% 17.5%;
  --secondary-foreground: 210 40% 98%;
  --accent: 217.2 32.6% 17.5%;
  --accent-foreground: 210 40% 98%;
  
  /* Dark Neutrals */
  --muted: 217.2 32.6% 17.5%;
  --muted-foreground: 215 20.2% 65.1%;
  --border: 217.2 32.6% 17.5%;
  --input: 217.2 32.6% 17.5%;
  --ring: 224.3 76.3% 48%;
  
  /* Status Colors - Dark */
  --destructive: 0 62.8% 30.6%;
  --destructive-foreground: 210 40% 98%;
  --warning: 38 92% 50%;
  --warning-foreground: 0 0% 100%;
  --success: 142 70% 45%;
  --success-foreground: 0 0% 100%;
  
  /* Dark Gradients */
  --gradient-primary: linear-gradient(135deg, hsl(217.2 91.2% 59.8%), hsl(217.2 85% 55%));
  --gradient-neural: linear-gradient(135deg, hsl(217.2 91.2% 59.8% / 0.06), hsl(217.2 32.6% 17.5% / 0.03));
  --gradient-data: linear-gradient(180deg, hsl(217.2 91.2% 59.8% / 0.03), transparent);
  --gradient-card: linear-gradient(180deg, hsl(222.2 84% 4.9%), hsl(222.2 80% 7%));
  --gradient-premium: linear-gradient(135deg, hsl(217.2 91.2% 59.8% / 0.04), transparent);
  --gradient-hero: linear-gradient(180deg, hsl(222.2 84% 3%) 0%, hsl(222.2 84% 4.9%) 50%, hsl(222.2 84% 3%) 100%);
  
  /* Dark pattern */
  --neural-pattern: radial-gradient(ellipse 800px 600px at 20% 20%, hsl(217.2 91.2% 59.8% / 0.03) 0%, transparent 70%),
                    radial-gradient(ellipse 600px 400px at 80% 80%, hsl(217.2 32.6% 17.5% / 0.02) 0%, transparent 70%);
  
  /* Dark shadows */
  --shadow-sm: 0 1px 2px hsl(0 0% 0% / 0.2);
  --shadow-md: 0 4px 12px hsl(0 0% 0% / 0.3);
  --shadow-lg: 0 8px 30px hsl(0 0% 0% / 0.4);
  --shadow-xl: 0 20px 60px hsl(0 0% 0% / 0.5);
  --shadow-premium: 0 1px 2px hsl(0 0% 0% / 0.2), 0 8px 24px hsl(0 0% 0% / 0.35);
  --shadow-glow: 0 0 80px hsl(217.2 91.2% 59.8% / 0.12);
  --shadow-neural: 0 4px 20px hsl(217.2 91.2% 59.8% / 0.1);
  --shadow-data: 0 2px 8px hsl(0 0% 0% / 0.25);
  --shadow-card: 0 1px 3px hsl(0 0% 0% / 0.15), 0 4px 16px hsl(0 0% 0% / 0.25);
  
  /* Dark patterns */
  --grid-pattern: linear-gradient(hsl(217.2 32.6% 17.5% / 0.8) 1px, transparent 1px),
                  linear-gradient(90deg, hsl(217.2 32.6% 17.5% / 0.8) 1px, transparent 1px);
}

@layer base {
  * {
    @apply border-border;
  }
  
  body {
    @apply bg-background text-foreground antialiased;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background-image: var(--neural-pattern);
    background-size: 100% 100%;
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'cv11', 'ss01';
    letter-spacing: -0.011em;
  }
  
  /* Premium Typography - Apple-level refinement */
  h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.1;
    font-feature-settings: 'cv11', 'ss01';
  }
  
  h1 { 
    font-size: clamp(2.75rem, 6vw, 5rem);
    font-weight: 700;
    letter-spacing: -0.035em;
    line-height: 1.05;
  }
  
  h2 { 
    font-size: clamp(2rem, 4vw, 3.5rem);
    letter-spacing: -0.03em;
  }
  
  h3 { 
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    letter-spacing: -0.025em;
  }
  
  p {
    font-weight: 400;
    line-height: 1.7;
    letter-spacing: -0.011em;
  }
  
  /* Premium focus states */
  :focus-visible {
    outline: 2px solid hsl(var(--ring));
    outline-offset: 2px;
  }
}

/* Premium Components */
@layer components {
  /* Hover effects */
  .hover-scale {
    @apply transition-transform duration-300 ease-out;
  }
  
  .hover-scale:hover {
    transform: scale(1.02);
  }
  
  /* Premium Card */
  .premium-card {
    @apply bg-card border border-border/50 rounded-2xl;
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(20px);
    transition: var(--transition-premium);
  }
  
  .premium-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: hsl(var(--border) / 0.8);
    transform: translateY(-2px);
  }
  
  /* Glass effect */
  .glass {
    background: hsl(var(--background) / 0.8);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid hsl(var(--border) / 0.5);
  }
  
  /* AI Badge - Refined */
  .ai-badge {
    @apply px-3 py-1.5 rounded-full text-xs font-medium tracking-wide;
    background: hsl(var(--primary) / 0.08);
    color: hsl(var(--primary));
    border: 1px solid hsl(var(--primary) / 0.15);
  }
  
  /* Neural glow */
  .neural-glow {
    box-shadow: var(--shadow-neural);
  }
  
  /* Premium button */
  .btn-premium {
    @apply px-8 py-4 rounded-xl font-semibold text-base tracking-tight;
    @apply transition-all duration-300 ease-out;
    background: var(--gradient-primary);
    color: hsl(var(--primary-foreground));
    box-shadow: var(--shadow-md), 0 0 0 0 hsl(var(--primary) / 0);
  }
  
  .btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 40px hsl(var(--primary) / 0.25);
  }
  
  .btn-premium:active {
    transform: translateY(0);
  }
  
  /* Professional button variant */
  .btn-professional {
    @apply px-6 py-3 rounded-xl font-medium tracking-tight;
    @apply transition-all duration-200 ease-out;
    background: var(--gradient-primary);
    color: hsl(var(--primary-foreground));
    box-shadow: var(--shadow-sm);
  }
  
  .btn-professional:hover {
    box-shadow: var(--shadow-md), 0 0 30px hsl(var(--primary) / 0.2);
    transform: translateY(-1px);
  }
  
  /* Stat card - Premium */
  .stat-card {
    @apply text-center p-6 rounded-2xl;
    background: hsl(var(--muted) / 0.5);
    border: 1px solid hsl(var(--border) / 0.5);
    transition: var(--transition-base);
  }
  
  .stat-card:hover {
    background: hsl(var(--muted) / 0.8);
    border-color: hsl(var(--border));
    transform: translateY(-2px);
  }
  
  /* Section backgrounds */
  .section-premium {
    background: var(--gradient-hero);
    position: relative;
  }
  
  .section-premium::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--neural-pattern);
    pointer-events: none;
  }
  
  /* Text gradient */
  .text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }
  
  /* Divider */
  .divider-premium {
    height: 1px;
    background: linear-gradient(90deg, transparent, hsl(var(--border)), transparent);
  }
}

/* Mobile Optimizations */
@layer utilities {
  .mobile-optimized {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
  
  .ios-optimized {
    -webkit-overflow-scrolling: touch;
    -webkit-backface-visibility: hidden;
    -webkit-perspective: 1000px;
    transform: translate3d(0, 0, 0);
  }
  
  .touch-target {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .no-tap-highlight {
    -webkit-tap-highlight-color: transparent;
  }
}

/* Premium Animations */
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-15px); }
}

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

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes pulse-glow {
  0%, 100% { 
    opacity: 0.5;
    transform: scale(1);
  }
  50% { 
    opacity: 0.8;
    transform: scale(1.05);
  }
}

@keyframes scroll {
  0% { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

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

.animate-fade-up {
  animation: fade-up 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-shimmer {
  background: linear-gradient(90deg, transparent, hsl(var(--primary) / 0.1), transparent);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

.animate-pulse-glow {
  animation: pulse-glow 4s ease-in-out infinite;
}

.animate-scroll {
  animation: scroll 30s linear infinite;
}

/* Selection styling */
::selection {
  background: hsl(var(--primary) / 0.2);
  color: hsl(var(--foreground));
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: hsl(var(--muted));
}

::-webkit-scrollbar-thumb {
  background: hsl(var(--muted-foreground) / 0.3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: hsl(var(--muted-foreground) / 0.5);
}

/* Grid pattern */
.bg-grid-pattern {
  background-image: var(--grid-pattern);
  background-size: 60px 60px;
}

/* Sparkle burst animation for celebrations */
@keyframes sparkle-burst {
  0% {
    opacity: 1;
    transform: rotate(var(--rotation, 0deg)) translateY(0) scale(1);
  }
  50% {
    opacity: 1;
    transform: rotate(var(--rotation, 0deg)) translateY(-16px) scale(1.5);
  }
  100% {
    opacity: 0;
    transform: rotate(var(--rotation, 0deg)) translateY(-24px) scale(0);
  }
}