/* ===================================
   ARCADIA - DESIGN SYSTEM 2025
   Material Design 3 + iOS 17 Inspired
   =================================== */

/* Modern Background Gradients */
.hero-bg {
  background: linear-gradient(135deg, 
    #0ea5e9 0%, 
    #0369a1 25%, 
    #0c4a6e 50%, 
    #1e293b 100%
  );
  background-attachment: fixed;
  position: relative;
}

.hero-bg::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 20%, rgba(14, 165, 233, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(3, 105, 161, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 40% 60%, rgba(12, 74, 110, 0.2) 0%, transparent 50%);
  opacity: 0.8;
}

.hero-bg::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
  opacity: 0.3;
}

.features-bg {
  background: linear-gradient(145deg, 
    #f8fafc 0%, 
    #f1f5f9 25%, 
    #e2e8f0 50%, 
    #cbd5e1 100%
  );
  position: relative;
}

.features-bg::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 30% 30%, rgba(14, 165, 233, 0.1) 0%, transparent 60%),
    radial-gradient(circle at 70% 70%, rgba(59, 130, 246, 0.08) 0%, transparent 60%);
  opacity: 0.6;
}

.modern-gradient-1 {
  background: linear-gradient(135deg, 
    #667eea 0%, 
    #764ba2 100%
  );
}

.modern-gradient-2 {
  background: linear-gradient(135deg, 
    #f093fb 0%, 
    #f5576c 100%
  );
}

.modern-gradient-3 {
  background: linear-gradient(135deg, 
    #4facfe 0%, 
    #00f2fe 100%
  );
}

/* CSS Custom Properties - Modern Design Tokens */
:root {
  /* Primary Brand Colors - Sophisticated Blue Palette */
  --primary-50: #f0f9ff;
  --primary-100: #e0f2fe;
  --primary-200: #bae6fd;
  --primary-300: #7dd3fc;
  --primary-400: #38bdf8;
  --primary-500: #0ea5e9;    /* Main brand color */
  --primary-600: #0284c7;
  --primary-700: #0369a1;
  --primary-800: #075985;
  --primary-900: #0c4a6e;
  
  /* Secondary Colors - Warm Accent */
  --secondary-50: #fef7f0;
  --secondary-100: #fdeee0;
  --secondary-200: #fbdcc2;
  --secondary-300: #f8c394;
  --secondary-400: #f4a261;
  --secondary-500: #f08030;    /* Warm orange accent */
  --secondary-600: #e56f20;
  --secondary-700: #c05621;
  --secondary-800: #9a4822;
  --secondary-900: #7d3c1f;
  
  /* Neutral Colors - High Contrast for Readability */
  --neutral-0: #ffffff;
  --neutral-25: #fcfcfc;
  --neutral-50: #f8fafc;
  --neutral-100: #f1f5f9;
  --neutral-200: #e2e8f0;
  --neutral-300: #cbd5e1;
  --neutral-400: #94a3b8;    /* Accessible light text */
  --neutral-500: #64748b;    /* Body text secondary */
  --neutral-600: #475569;    /* Body text primary */
  --neutral-700: #334155;    /* Headings secondary */
  --neutral-800: #1e293b;    /* Headings primary */
  --neutral-900: #0f172a;    /* High emphasis text */
  --neutral-950: #020617;    /* Maximum contrast */
  
  /* Success Colors */
  --success-50: #f0fdf4;
  --success-100: #dcfce7;
  --success-200: #bbf7d0;
  --success-300: #86efac;
  --success-400: #4ade80;
  --success-500: #22c55e;    /* Main success */
  --success-600: #16a34a;
  --success-700: #15803d;
  --success-800: #166534;
  --success-900: #14532d;
  
  /* Warning Colors */
  --warning-50: #fffbeb;
  --warning-100: #fef3c7;
  --warning-200: #fde68a;
  --warning-300: #fcd34d;
  --warning-400: #fbbf24;
  --warning-500: #f59e0b;    /* Main warning */
  --warning-600: #d97706;
  --warning-700: #b45309;
  --warning-800: #92400e;
  --warning-900: #78350f;
  
  /* Error Colors */
  --error-50: #fef2f2;
  --error-100: #fee2e2;
  --error-200: #fecaca;
  --error-300: #fca5a5;
  --error-400: #f87171;
  --error-500: #ef4444;      /* Main error */
  --error-600: #dc2626;
  --error-700: #b91c1c;
  --error-800: #991b1b;
  --error-900: #7f1d1d;
  
  /* Gradients - Modern and Subtle */
  --gradient-primary: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  --gradient-secondary: linear-gradient(135deg, #f4a261 0%, #e56f20 100%);
  --gradient-success: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  --gradient-warm: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  --gradient-hero: linear-gradient(135deg, #0ea5e9 0%, #0284c7 50%, #075985 100%);
  --gradient-card: linear-gradient(145deg, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.6) 100%);
  --gradient-glass: linear-gradient(145deg, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0.1) 100%);
  
  /* Typography - Perfect Readability */
  --font-family-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-family-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-family-mono: 'JetBrains Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Fira Code', monospace;
  
  /* Font Sizes - Modular Scale */
  --font-size-xs: 0.75rem;      /* 12px */
  --font-size-sm: 0.875rem;     /* 14px */
  --font-size-base: 1rem;       /* 16px */
  --font-size-lg: 1.125rem;     /* 18px */
  --font-size-xl: 1.25rem;      /* 20px */
  --font-size-2xl: 1.5rem;      /* 24px */
  --font-size-3xl: 1.875rem;    /* 30px */
  --font-size-4xl: 2.25rem;     /* 36px */
  --font-size-5xl: 3rem;        /* 48px */
  --font-size-6xl: 3.75rem;     /* 60px */
  --font-size-7xl: 4.5rem;      /* 72px */
  
  /* Font Weights */
  --font-weight-light: 300;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;
  --font-weight-black: 900;
  
  /* Line Heights - Optimized for Readability */
  --line-height-tight: 1.25;
  --line-height-snug: 1.375;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.625;
  --line-height-loose: 2;
  
  /* Spacing Scale - Perfect Rhythm */
  --space-0: 0;
  --space-1: 0.25rem;    /* 4px */
  --space-2: 0.5rem;     /* 8px */
  --space-3: 0.75rem;    /* 12px */
  --space-4: 1rem;       /* 16px */
  --space-5: 1.25rem;    /* 20px */
  --space-6: 1.5rem;     /* 24px */
  --space-7: 1.75rem;    /* 28px */
  --space-8: 2rem;       /* 32px */
  --space-9: 2.25rem;    /* 36px */
  --space-10: 2.5rem;    /* 40px */
  --space-11: 2.75rem;   /* 44px */
  --space-12: 3rem;      /* 48px */
  --space-14: 3.5rem;    /* 56px */
  --space-16: 4rem;      /* 64px */
  --space-20: 5rem;      /* 80px */
  --space-24: 6rem;      /* 96px */
  --space-28: 7rem;      /* 112px */
  --space-32: 8rem;      /* 128px */
  --space-36: 9rem;      /* 144px */
  --space-40: 10rem;     /* 160px */
  --space-44: 11rem;     /* 176px */
  --space-48: 12rem;     /* 192px */
  --space-52: 13rem;     /* 208px */
  --space-56: 14rem;     /* 224px */
  --space-60: 15rem;     /* 240px */
  --space-64: 16rem;     /* 256px */
  
  /* Border Radius - Material Design 3 */
  --radius-none: 0;
  --radius-xs: 0.125rem;     /* 2px */
  --radius-sm: 0.25rem;      /* 4px */
  --radius-base: 0.375rem;   /* 6px */
  --radius-md: 0.5rem;       /* 8px */
  --radius-lg: 0.75rem;      /* 12px */
  --radius-xl: 1rem;         /* 16px */
  --radius-2xl: 1.5rem;      /* 24px */
  --radius-3xl: 2rem;        /* 32px */
  --radius-full: 9999px;
  
  /* Z-index Scale for proper layering */
  --z-base: 0;
  --z-header: 1000;
  --z-dropdown: 1010;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  
  /* Shadows - Material Design 3 Elevation */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-base: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);
  
  /* Surface Colors - Material Design 3 */
  --surface-0: var(--neutral-0);      /* Primary surface */
  --surface-1: var(--neutral-25);     /* Elevated surface */
  --surface-2: var(--neutral-50);     /* Higher elevation */
  --surface-3: var(--neutral-100);    /* Highest elevation */
  --surface-dim: var(--neutral-200);  /* Dimmed surface */
  
  /* Glass Morphism Effects */
  --backdrop-blur-xs: blur(2px);
  --backdrop-blur-sm: blur(4px);
  --backdrop-blur-base: blur(8px);
  --backdrop-blur-md: blur(12px);
  --backdrop-blur-lg: blur(16px);
  --backdrop-blur-xl: blur(24px);
  --backdrop-blur-2xl: blur(40px);
  --backdrop-blur-3xl: blur(64px);
  
  /* Transitions - Smooth and Natural */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 500ms cubic-bezier(0.175, 0.885, 0.32, 1.275);
  
  /* Z-Index Scale */
  --z-hide: -1;
  --z-auto: auto;
  --z-base: 0;
  --z-docked: 10;
  --z-dropdown: 1000;
  --z-sticky: 1100;
  --z-banner: 1200;
  --z-overlay: 1300;
  --z-modal: 1400;
  --z-popover: 1500;
  --z-skiplink: 1600;
  --z-toast: 1700;
  --z-tooltip: 1800;
}

/* Global Reset & Base Styles */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
  scroll-padding-top: 5rem;
}

body {
  font-family: var(--font-family-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-relaxed);
  color: var(--neutral-800);
  background-color: var(--surface-0);
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Enhanced Focus Management */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Modern Grid System */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.container-sm { max-width: 640px; }
.container-md { max-width: 768px; }
.container-lg { max-width: 1024px; }
.container-xl { max-width: 1280px; }
.container-2xl { max-width: 1536px; }

.grid {
  display: grid;
  gap: var(--space-6);
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

/* Enhanced Typography System */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-display);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  color: var(--neutral-900);
  margin-bottom: var(--space-4);
  letter-spacing: -0.025em;
}

h1 {
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-extrabold);
}

h2 {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
}

h3 {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-semibold);
}

h4 {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
}

h5 {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-medium);
}

h6 {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
}

p {
  margin-bottom: var(--space-4);
  color: var(--neutral-600);
  line-height: var(--line-height-relaxed);
}

.lead {
  font-size: var(--font-size-lg);
  color: var(--neutral-700);
  line-height: var(--line-height-relaxed);
}

.small {
  font-size: var(--font-size-sm);
  color: var(--neutral-500);
}

/* Modern Button System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-family-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  line-height: 1;
  text-align: center;
  text-decoration: none;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  z-index: var(--z-base);
}

/* Better icon handling in buttons */
.btn svg {
  flex-shrink: 0;
  z-index: 2;
  position: relative;
}

/* Remove problematic pseudo-elements that cover icons */
.btn::before {
  display: none !important;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--gradient-primary);
  color: var(--neutral-0);
  box-shadow: var(--shadow-base);
  border: 1px solid var(--primary-600);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  background: linear-gradient(135deg, #0284c7 0%, #075985 100%);
}

.btn-secondary {
  background: var(--surface-0);
  color: var(--neutral-700);
  border: 2px solid var(--neutral-300);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--surface-1);
  border-color: var(--neutral-400);
  transform: translateY(-1px);
  box-shadow: var(--shadow-base);
}

.btn-outline {
  background: transparent;
  color: var(--primary-600);
  border: 2px solid var(--primary-600);
}

.btn-outline:hover {
  background: var(--primary-50);
  color: var(--primary-700);
  border-color: var(--primary-700);
}

.btn-ghost {
  background: transparent;
  color: var(--neutral-600);
  border: 2px solid transparent;
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--neutral-800);
  border-color: var(--neutral-200);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--font-size-lg);
  border-radius: var(--radius-xl);
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
  border-radius: var(--radius-md);
}

.btn-xs {
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-xs);
  border-radius: var(--radius-base);
}

/* Material Design Cards */
.card {
  background: var(--surface-0);
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: all var(--transition-base);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--neutral-300);
}

.card-elevated {
  background: var(--surface-1);
  box-shadow: var(--shadow-base);
}

.card-elevated:hover {
  box-shadow: var(--shadow-lg);
}

.card-body {
  padding: var(--space-6);
}

.card-header {
  padding: var(--space-6) var(--space-6) 0;
}

.card-footer {
  padding: 0 var(--space-6) var(--space-6);
}

/* Modern Form Elements */
.form-group {
  margin-bottom: var(--space-6);
}

.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--neutral-700);
  margin-bottom: var(--space-2);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-4);
  font-family: var(--font-family-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  color: var(--neutral-800);
  background: var(--surface-0);
  border: 2px solid var(--neutral-300);
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
  appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.1);
  background: var(--surface-0);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--neutral-400);
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }

.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

::-webkit-scrollbar-track {
  background: var(--surface-2);
}

::-webkit-scrollbar-thumb {
  background: var(--neutral-400);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--neutral-500);
}

/* Selection */
::selection {
  background: var(--primary-200);
  color: var(--primary-900);
}

::-moz-selection {
  background: var(--primary-200);
  color: var(--primary-900);
}

/* Responsive Typography */
@media (min-width: 640px) {
  .container { padding: 0 var(--space-6); }
  
  h1 { font-size: var(--font-size-5xl); }
  h2 { font-size: var(--font-size-4xl); }
  h3 { font-size: var(--font-size-3xl); }
}

@media (min-width: 768px) {
  .container { padding: 0 var(--space-8); }
  
  h1 { font-size: var(--font-size-6xl); }
  h2 { font-size: var(--font-size-5xl); }
  h3 { font-size: var(--font-size-4xl); }
}

@media (min-width: 1024px) {
  h1 { font-size: var(--font-size-7xl); }
  h2 { font-size: var(--font-size-6xl); }
  h3 { font-size: var(--font-size-5xl); }
}

/* Animations for Enhanced UX */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

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

/* Logged-in User Adjustments */
.main-content.logged-in {
  padding-bottom: var(--space-4);
}

.main-content.logged-in + .modern-footer {
  margin-top: var(--space-6);
  padding-top: var(--space-8);
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (prefers-contrast: high) {
  :root {
    --neutral-600: var(--neutral-700);
    --neutral-500: var(--neutral-600);
    --neutral-400: var(--neutral-500);
  }
}