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

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

@layer base {
  :root {
    /* ========================================
       BRAND COLORS
       ======================================== */
    --color-primary: #0d1883;
    --color-primary-50: #f0f1fc;
    --color-primary-100: #e4e5f9;
    --color-primary-200: #cdd0f5;
    --color-primary-300: #abb0ee;
    --color-primary-400: #8286e5;
    --color-primary-500: #6164da;
    --color-primary-600: #4b47cb;
    --color-primary-700: #3d36b0;
    --color-primary-800: #342f8f;
    --color-primary-900: #0d1883;
    --color-primary-950: #0a1260;

    --color-secondary: #0d9c53;
    --color-secondary-50: #f0fdf5;
    --color-secondary-100: #dcfce8;
    --color-secondary-200: #bbf7d1;
    --color-secondary-300: #86efac;
    --color-secondary-400: #4ade80;
    --color-secondary-500: #0d9c53;
    --color-secondary-600: #0b8545;
    --color-secondary-700: #0a6b39;
    --color-secondary-800: #085530;
    --color-secondary-900: #064526;
    --color-secondary-950: #032513;

    /* ========================================
       NEUTRAL COLORS
       ======================================== */
    --color-neutral-50: #fafafa;
    --color-neutral-100: #f5f5f5;
    --color-neutral-200: #e5e5e5;
    --color-neutral-300: #d4d4d4;
    --color-neutral-400: #a3a3a3;
    --color-neutral-500: #737373;
    --color-neutral-600: #525252;
    --color-neutral-700: #404040;
    --color-neutral-800: #262626;
    --color-neutral-900: #171717;
    --color-neutral-950: #0a0a0a;

    /* ========================================
       SEMANTIC COLORS
       ======================================== */
    --color-success: #10b981;
    --color-success-light: #d1fae5;
    --color-success-dark: #065f46;

    --color-warning: #f59e0b;
    --color-warning-light: #fef3c7;
    --color-warning-dark: #92400e;

    --color-error: #ef4444;
    --color-error-light: #fee2e2;
    --color-error-dark: #991b1b;

    --color-info: #3b82f6;
    --color-info-light: #dbeafe;
    --color-info-dark: #1e40af;

    /* ========================================
       TYPOGRAPHY
       ======================================== */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'Menlo', 'Monaco', 'Courier New', monospace;

    /* Font Sizes */
    --text-xs: 0.75rem;      /* 12px */
    --text-sm: 0.875rem;     /* 14px */
    --text-base: 1rem;       /* 16px */
    --text-lg: 1.125rem;     /* 18px */
    --text-xl: 1.25rem;      /* 20px */
    --text-2xl: 1.5rem;      /* 24px */
    --text-3xl: 1.875rem;    /* 30px */
    --text-4xl: 2.25rem;     /* 36px */
    --text-5xl: 3rem;        /* 48px */
    --text-6xl: 3.75rem;     /* 60px */
    --text-7xl: 4.5rem;      /* 72px */

    /* Font Weights */
    --font-light: 300;
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    --font-extrabold: 800;
    --font-black: 900;

    /* Line Heights */
    --leading-tight: 1.25;
    --leading-snug: 1.375;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;
    --leading-loose: 2;

    /* Letter Spacing */
    --tracking-tighter: -0.05em;
    --tracking-tight: -0.025em;
    --tracking-normal: 0;
    --tracking-wide: 0.025em;
    --tracking-wider: 0.05em;
    --tracking-widest: 0.1em;

    /* ========================================
       SPACING SCALE
       ======================================== */
    --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-8: 2rem;         /* 32px */
    --space-10: 2.5rem;      /* 40px */
    --space-12: 3rem;        /* 48px */
    --space-16: 4rem;        /* 64px */
    --space-20: 5rem;        /* 80px */
    --space-24: 6rem;        /* 96px */
    --space-32: 8rem;        /* 128px */

    /* ========================================
       BORDER RADIUS
       ======================================== */
    --radius-none: 0;
    --radius-sm: 0.125rem;   /* 2px */
    --radius-base: 0.25rem;  /* 4px */
    --radius-md: 0.375rem;   /* 6px */
    --radius-lg: 0.5rem;     /* 8px */
    --radius-xl: 0.75rem;    /* 12px */
    --radius-2xl: 1rem;      /* 16px */
    --radius-3xl: 1.5rem;    /* 24px */
    --radius-full: 9999px;

    /* ========================================
       SHADOWS
       ======================================== */
    --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);

    /* Brand Shadows */
    --shadow-primary: 0 10px 30px -10px rgba(13, 24, 131, 0.3);
    --shadow-secondary: 0 10px 30px -10px rgba(13, 156, 83, 0.3);

    /* ========================================
       TRANSITIONS
       ======================================== */
    --transition-fast: 150ms;
    --transition-base: 200ms;
    --transition-slow: 300ms;
    --transition-slower: 500ms;

    --ease-in: cubic-bezier(0.4, 0, 1, 1);
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);

    /* ========================================
       Z-INDEX SCALE
       ======================================== */
    --z-base: 0;
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-overlay: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
    --z-notification: 1080;

    /* ========================================
       BREAKPOINTS (for reference)
       ======================================== */
    --breakpoint-sm: 640px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 1024px;
    --breakpoint-xl: 1280px;
    --breakpoint-2xl: 1536px;

    /* ========================================
       OPACITY SCALE
       ======================================== */
    --opacity-0: 0;
    --opacity-5: 0.05;
    --opacity-10: 0.1;
    --opacity-20: 0.2;
    --opacity-30: 0.3;
    --opacity-40: 0.4;
    --opacity-50: 0.5;
    --opacity-60: 0.6;
    --opacity-70: 0.7;
    --opacity-80: 0.8;
    --opacity-90: 0.9;
    --opacity-95: 0.95;
    --opacity-100: 1;

    /* ========================================
       GRADIENTS
       ======================================== */
    --gradient-primary: linear-gradient(135deg, var(--color-primary-600) 0%, var(--color-primary-900) 100%);
    --gradient-secondary: linear-gradient(135deg, var(--color-secondary-400) 0%, var(--color-secondary-700) 100%);
    --gradient-brand: linear-gradient(135deg, var(--color-primary-600) 0%, var(--color-secondary-500) 100%);
    --gradient-sunset: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-ocean: linear-gradient(135deg, #667eea 0%, #0d9c53 100%);
  }

  /* ========================================
     DARK MODE OVERRIDES
     ======================================== */
  @media (prefers-color-scheme: dark) {
    :root {
      --color-neutral-50: #171717;
      --color-neutral-100: #262626;
      --color-neutral-200: #404040;
      --color-neutral-300: #525252;
      --color-neutral-400: #737373;
      --color-neutral-500: #a3a3a3;
      --color-neutral-600: #d4d4d4;
      --color-neutral-700: #e5e5e5;
      --color-neutral-800: #f5f5f5;
      --color-neutral-900: #fafafa;
      --color-neutral-950: #ffffff;
    }
  }

  /* ========================================
     BASE STYLES
     ======================================== */
  * {
    @apply border-border;
  }

  body {
    font-family: var(--font-primary);
    font-size: var(--text-base);
    font-weight: var(--font-normal);
    line-height: var(--leading-normal);
    color: var(--color-neutral-900);
    background-color: var(--color-neutral-50);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-bold);
    line-height: var(--leading-tight);
    color: var(--color-neutral-950);
  }

  h1 { font-size: var(--text-5xl); }
  h2 { font-size: var(--text-4xl); }
  h3 { font-size: var(--text-3xl); }
  h4 { font-size: var(--text-2xl); }
  h5 { font-size: var(--text-xl); }
  h6 { font-size: var(--text-lg); }

  a {
    color: var(--color-primary);
    transition: color var(--transition-base) var(--ease-out);
  }

  a:hover {
    color: var(--color-primary-700);
  }

  code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    padding: 0.125rem 0.25rem;
    background-color: var(--color-neutral-100);
    border-radius: var(--radius-base);
  }
}

@layer components {
  /* ========================================
     BUTTON COMPONENTS
     ======================================== */
  .btn {
    @apply inline-flex items-center justify-center font-medium rounded-lg transition-all duration-200;
    @apply focus:outline-none focus:ring-2 focus:ring-offset-2;
    @apply disabled:opacity-50 disabled:cursor-not-allowed;
  }

  .btn-primary {
    background-color: var(--color-primary);
    color: white;
    box-shadow: var(--shadow-primary);
  }

  .btn-primary:hover:not(:disabled) {
    background-color: var(--color-primary-800);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
  }

  .btn-secondary {
    background-color: var(--color-secondary);
    color: white;
    box-shadow: var(--shadow-secondary);
  }

  .btn-secondary:hover:not(:disabled) {
    background-color: var(--color-secondary-600);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
  }

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

  .btn-outline:hover:not(:disabled) {
    background-color: var(--color-primary);
    color: white;
  }

  .btn-ghost {
    color: var(--color-neutral-700);
    background-color: transparent;
  }

  .btn-ghost:hover:not(:disabled) {
    background-color: var(--color-neutral-100);
  }

  /* Button Sizes */
  .btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
  }

  .btn-md {
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-base);
  }

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

  /* ========================================
     CARD COMPONENTS
     ======================================== */
  .card {
    background-color: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-base);
    padding: var(--space-6);
    transition: box-shadow var(--transition-base) var(--ease-out);
  }

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

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

  .card-flat {
    box-shadow: none;
    border: 1px solid var(--color-neutral-200);
  }

  /* ========================================
     INPUT COMPONENTS
     ======================================== */
  .input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-base);
    border: 1px solid var(--color-neutral-300);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base) var(--ease-out);
    background-color: white;
  }

  .input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(13, 24, 131, 0.1);
  }

  .input:disabled {
    background-color: var(--color-neutral-100);
    cursor: not-allowed;
  }

  .input-error {
    border-color: var(--color-error);
  }

  .input-error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
  }

  /* ========================================
     BADGE COMPONENTS
     ======================================== */
  .badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    border-radius: var(--radius-full);
  }

  .badge-primary {
    background-color: var(--color-primary-100);
    color: var(--color-primary-900);
  }

  .badge-secondary {
    background-color: var(--color-secondary-100);
    color: var(--color-secondary-900);
  }

  .badge-success {
    background-color: var(--color-success-light);
    color: var(--color-success-dark);
  }

  .badge-warning {
    background-color: var(--color-warning-light);
    color: var(--color-warning-dark);
  }

  .badge-error {
    background-color: var(--color-error-light);
    color: var(--color-error-dark);
  }
}

@layer utilities {
  /* ========================================
     CUSTOM UTILITIES
     ======================================== */
  .text-gradient-primary {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }

  .text-gradient-brand {
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }

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

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

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

  .glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
  }

  .glass-dark {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }
}

/* ============================================================
   TravelWheel Design System - browser-safe global layer
   ============================================================ */
:root {
  --tw-font-sans: 'Open Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --tw-brand: #303191;
  --tw-brand-hover: #252675;
  --tw-accent: #009933;
  --tw-ink: #111827;
  --tw-text: #1f2937;
  --tw-muted: #667085;
  --tw-subtle: #98a2b3;
  --tw-line: #e6e8ee;
  --tw-line-strong: #d9dde7;
  --tw-surface: #ffffff;
  --tw-surface-soft: #f8f9fc;
  --tw-surface-muted: #f2f4f7;

  --tw-text-xs: 0.75rem;
  --tw-text-sm: 0.8125rem;
  --tw-text-md: 0.875rem;
  --tw-text-base: 0.9375rem;
  --tw-text-lg: 1.0625rem;
  --tw-text-xl: 1.25rem;
  --tw-text-2xl: 1.5rem;
  --tw-text-3xl: 1.875rem;
  --tw-text-4xl: 2.25rem;
  --tw-text-5xl: 3rem;

  --tw-leading-tight: 1.15;
  --tw-leading-snug: 1.3;
  --tw-leading-body: 1.55;

  --tw-radius-sm: 6px;
  --tw-radius-md: 8px;
  --tw-radius-lg: 12px;
  --tw-radius-xl: 16px;
  --tw-radius-panel: 22px;

  --tw-shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --tw-shadow-md: 0 8px 24px rgba(16, 24, 40, .07);
  --tw-shadow-lg: 0 16px 40px rgba(16, 24, 40, .10);

  --font-primary: var(--tw-font-sans);
  --color-primary: var(--tw-brand);
  --color-secondary: var(--tw-accent);
  --text-xs: var(--tw-text-xs);
  --text-sm: var(--tw-text-sm);
  --text-base: var(--tw-text-base);
  --text-lg: var(--tw-text-lg);
  --text-xl: var(--tw-text-xl);
  --text-2xl: var(--tw-text-2xl);
  --text-3xl: var(--tw-text-3xl);
  --text-4xl: var(--tw-text-4xl);
  --text-5xl: var(--tw-text-5xl);
}

html {
  font-family: var(--tw-font-sans);
  color: var(--tw-text);
  background: var(--tw-surface);
}

body {
  font-family: var(--tw-font-sans) !important;
  font-size: var(--tw-text-base);
  line-height: var(--tw-leading-body);
  color: var(--tw-text);
  background: var(--tw-surface);
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--tw-font-sans);
  color: var(--tw-ink);
  letter-spacing: 0;
  line-height: var(--tw-leading-tight);
}

h1 { font-size: var(--tw-text-5xl); font-weight: 800; }
h2 { font-size: var(--tw-text-4xl); font-weight: 800; }
h3 { font-size: var(--tw-text-3xl); font-weight: 700; }
h4 { font-size: var(--tw-text-2xl); font-weight: 700; }
h5 { font-size: var(--tw-text-xl); font-weight: 700; }
h6 { font-size: var(--tw-text-lg); font-weight: 650; }

.tw-container {
  width: min(100% - 40px, 1280px);
  margin-inline: auto;
}

.tw-section-title {
  margin: 0;
  color: var(--tw-brand) !important;
  font-family: var(--tw-font-sans);
  font-size: var(--tw-text-3xl);
  font-weight: 800;
  line-height: var(--tw-leading-tight);
}

.tw-section-copy {
  color: var(--tw-muted) !important;
  font-size: var(--tw-text-base);
  line-height: var(--tw-leading-body);
}

.tw-panel {
  background: var(--tw-surface);
  border: 1px solid var(--tw-line);
  border-radius: var(--tw-radius-panel);
  box-shadow: var(--tw-shadow-md);
}

.tw-card {
  background: var(--tw-surface);
  border: 1px solid var(--tw-line);
  border-radius: var(--tw-radius-lg);
  box-shadow: var(--tw-shadow-sm);
}

.tw-button-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid var(--tw-brand);
  border-radius: var(--tw-radius-md);
  background: var(--tw-brand);
  color: #fff !important;
  font-size: var(--tw-text-md);
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(48, 49, 145, .18);
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.tw-button-primary:hover {
  background: var(--tw-brand-hover);
  border-color: var(--tw-brand-hover);
  color: #fff !important;
  box-shadow: 0 14px 28px rgba(48, 49, 145, .22);
  transform: translateY(-1px);
}

@media (max-width: 768px) {
  :root {
    --tw-text-base: 0.875rem;
    --tw-text-lg: 1rem;
    --tw-text-xl: 1.125rem;
    --tw-text-2xl: 1.25rem;
    --tw-text-3xl: 1.5rem;
    --tw-text-4xl: 1.875rem;
    --tw-text-5xl: 2.25rem;
  }

  .tw-container {
    width: min(100% - 28px, 1280px);
  }
}
