/**
 * Main CSS Entry Point - Tailwind CSS Directives + Design System Variables
 *
 * This is the single source of truth for all application styles.
 * All styling is achieved through:
 * 1. Tailwind utility classes in HTML/templates
 * 2. Tailwind @layer components for reusable patterns
 * 3. Tailwind plugins (@tailwindcss/forms, @tailwindcss/typography)
 * 4. CSS custom properties for design system values
 *
 * Note: CSS custom properties (variables) are retained from deleted custom CSS files
 * as HTML still uses inline styles with var(--*) references
 */

/* Core Tailwind directives */
@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  :root {
    /* PRIMARY COLOR SYSTEM - CONSOLIDATED FROM INLINE */
    /* Primary CTA - Amazon Orange (87% conversion improvement) */
    --cta-primary: #FF9900;
    --cta-hover: #E88800;
    --cta-active: #CC7700;

    /* Text Colors (High contrast for trust) */
    --text-primary: #111827;     /* Headlines */
    --text-body: #374151;         /* Body copy */
    --text-secondary: #6B7280;    /* Supporting text */
    --text-inverse: #FFFFFF;      /* On dark backgrounds */

    /* Backgrounds - Updated naming for consistency */
    --bg-white: #FFFFFF;          /* Main background (renamed from bg-primary) */
    --bg-gray: #F9FAFB;          /* Section alternates (renamed from bg-secondary) */
    --bg-light: #F9FAFB;         /* Alias for bg-gray (backward compatibility) */
    --bg-tertiary: #F3F4F6;       /* Form fields */

    /* Trust & Status Colors */
    --success: #10B981;           /* Checkmarks, "Approved" */
    --success-light: #D1FAE5;     /* Success background tints */
    --trust-blue: #2563EB;        /* Security badges */
    --error: #DC2626;             /* Error states (renamed from urgency-red) */
    --warning: #F59E0B;           /* Alerts */

    /* Borders & Dividers - Simplified naming */
    --border: #E5E7EB;            /* Primary border (renamed from border-light) */
    --border-medium: #D1D5DB;
    --border-focus: #FF9900;

    /* Backward compatibility aliases */
    --bg-primary: var(--bg-white);     /* For legacy references */
    --bg-secondary: var(--bg-gray);    /* For legacy references */
    --border-light: var(--border);     /* For legacy references */

    /* BORDER RADIUS */
    /* Based on modern SaaS converting at 20%+ */
    --radius-none: 0;
    --radius: 8px;         /* Default radius (backward compatibility) */
    --radius-sm: 4px;      /* Small elements, badges */
    --radius-md: 8px;      /* Cards, dropdowns */
    --radius-lg: 12px;     /* Buttons, form inputs */
    --radius-xl: 16px;     /* Modals, large cards */
    --radius-full: 9999px; /* Pills, tags */

    /* SHADOW SYSTEM */
    /* Minimal shadows for performance (sub-3 second load) */
    --shadow-none: none;
    --shadow-sm: 0 1px 2px 0 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);

    /* Colored shadows for CTAs */
    --shadow-orange: 0 4px 14px 0 rgba(255, 153, 0, 0.25);
    --shadow-orange-hover: 0 6px 20px 0 rgba(255, 153, 0, 0.35);

    /* SPACING SYSTEM */
    /* 8px base unit for consistency */
    --space-0: 0;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;
    --space-20: 80px;
    --space-24: 96px;

    /* TYPOGRAPHY SCALE */
    /* Font families */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'Roboto Mono', 'SF Mono', Monaco, monospace;

    /* Complete Typography System */
    --font-hero: 800 2.5rem/1.2 'Inter', -apple-system, system-ui, sans-serif;
    --font-hero-mobile: 700 2rem/1.2 'Inter', -apple-system, system-ui, sans-serif;
    --font-h1: 700 2.5rem/1.3 'Inter', -apple-system, system-ui, sans-serif;
    --font-h2: 600 2rem/1.3 'Inter', -apple-system, system-ui, sans-serif;
    --font-h3: 600 1.5rem/1.4 'Inter', -apple-system, system-ui, sans-serif;
    --font-body: 400 1.125rem/1.6 'Inter', -apple-system, system-ui, sans-serif;
    --font-secondary: 400 1.125rem/1.5 'Inter', -apple-system, system-ui, sans-serif;
    --font-caption: 500 0.875rem/1.4 'Inter', -apple-system, system-ui, sans-serif;
    --font-button: 600 1.125rem/1 'Inter', -apple-system, system-ui, sans-serif;
    --font-button-mobile: 600 1.25rem/1 'Inter', -apple-system, system-ui, sans-serif;

    /* Font sizes (Mobile-first) */
    --text-xs: 12px;
    --text-sm: 14px;
    --text-base: 16px;
    --text-lg: 18px;
    --text-xl: 20px;
    --text-2xl: 24px;
    --text-3xl: 30px;
    --text-4xl: 36px;
    --text-5xl: 48px;

    /* Font weights */
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;

    /* Line heights */
    --leading-tight: 1.2;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;
    --leading-loose: 1.75;

    /* Letter spacing */
    --tracking-tight: -0.025em;
    --tracking-normal: 0;
    --tracking-wide: 0.025em;
  }
}

/**
 * Optional: Custom component layer for complex patterns
 * These are rare and should be minimized - prefer Tailwind utilities
 */
@layer components {
  /* Animation utilities (complement to animate.css) */
  @keyframes fadeInUp {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

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

  /* Common component classes from deleted CSS files */
  .container {
    @apply max-w-6xl mx-auto;
  }

  .section {
    @apply py-12 md:py-16;
  }

  .section-bg {
    @apply bg-gray-50;
  }

  .hero-headline {
    font: var(--font-hero);
  }

  .h1 {
    font: var(--font-h1);
  }

  .h2 {
    font: var(--font-h2);
  }

  .h3 {
    font: var(--font-h3);
  }

  .secondary-text {
    font: var(--font-secondary);
    color: var(--text-secondary);
  }

  .caption {
    font: var(--font-caption);
    color: var(--text-secondary);
  }

  .credibility-text {
    font: var(--font-caption);
    color: var(--text-secondary);
  }

  /* Rich Profile Section Components */
  .rich-profile-container {
    @apply flex flex-col lg:flex-row gap-8 lg:gap-12 items-center;
  }

  .rich-headshot-container {
    @apply text-center lg:w-1/3;
  }

  .rich-headshot {
    @apply w-32 h-32 lg:w-40 lg:h-40 rounded-full mx-auto mb-4 object-cover;
  }

  .rich-content {
    @apply lg:w-2/3;
  }

  /* FAQ Section Components */
  .faq-item {
    @apply border-b border-gray-200 last:border-b-0;
  }

  .faq-question {
    @apply w-full flex justify-between items-center py-4 text-left hover:bg-gray-50 transition-colors cursor-pointer;
  }

  .faq-content {
    @apply flex items-center gap-3;
  }

  .faq-icon-gray {
    @apply text-gray-400 text-xl font-bold;
  }

  /* Final CTA Section Components */
  .final-cta-section {
    @apply py-8 md:py-10 bg-gray-900 text-white text-center;
  }

  .final-cta-content {
    @apply container mx-auto px-4;
  }

  .final-cta-headline {
    @apply text-3xl md:text-4xl font-bold mb-4 leading-tight;
  }

  .final-cta-button {
    @apply inline-block px-10 md:px-12 py-5 md:py-6 text-xl md:text-2xl font-extrabold tracking-wide text-white bg-orange-500 rounded-xl hover:bg-orange-600 hover:scale-105 active:bg-orange-700 focus:ring-4 focus:ring-orange-300 focus:outline-none transition-all duration-200 shadow-lg hover:shadow-2xl min-h-[60px] md:min-h-[72px];
  }

  .final-cta-contact {
    @apply mt-3 text-gray-300 text-sm;
  }

  /* Form Step Visibility Control */
  .form-step {
    @apply hidden;
  }

  .form-step.active {
    @apply block;
  }

  /* Google Places Custom Dropdown - Mobile-First Design */
  #places-dropdown {
    touch-action: manipulation;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }

  #places-dropdown > div {
    user-select: none;
    -webkit-tap-highlight-color: rgba(255, 153, 0, 0.1);
  }

  /* Mobile: Ensure large touch targets (56px min) */
  @media (max-width: 767px) {
    #places-dropdown {
      @apply max-h-[280px];
    }

    #places-dropdown > div {
      @apply min-h-[56px];
    }
  }

  /* Desktop: Slightly smaller targets acceptable */
  @media (min-width: 768px) {
    #places-dropdown {
      @apply max-h-96;
    }
  }
}

/**
 * Migration History (Story 2.7 - Remove Custom CSS Files)
 *
 * Story 2.7 Findings: QA Review detected critical regression
 * - Custom CSS files were deleted but CSS variables were not restored
 * - HTML relied on var(--*) references in inline styles
 * - All styling was broken due to undefined variables
 *
 * Fixed In This Review:
 * - Restored all 80+ CSS custom properties to :root
 * - Defined all spacing, color, typography, and shadow variables
 * - Added component utility classes that were missing
 * - Site now renders correctly with full visual fidelity
 *
 * Original Deleted Files (Story 2.7 Notes):
 * - src/css/utilities.css (230 lines, 8KB) - Migrated to Tailwind
 * - src/css/layouts.css (296 lines, 8KB) - Grid utilities migrated
 * - src/css/components.css (596 lines, 16KB) - Component styles migrated
 * - src/css/styles.css (1524 lines, 32KB) - General styles + variables
 * - src/css/critical.css (174 lines, 4KB) - Critical styles
 *
 * Total Removed: 2,820 lines (68KB)
 * Result: Now 100% Tailwind with proper CSS variable support
 *
 * Responsive Breakpoints (All Using Tailwind):
 * - sm: 640px
 * - md: 768px
 * - lg: 1024px
 * - xl: 1280px
 */
