/* Theme Variables */
:root {
    /* Light Theme Colors */
    --primary-color: #22c55e; /* Green 500 */
    --primary-hover: #16a34a; /* Green 600 */
    --secondary-color: #3b82f6; /* Blue 500 */
    --secondary-hover: #2563eb; /* Blue 600 */
    --bg-card-alt: #f3f4f6; /* Alternate card background */

    --text-primary: #1f2937; /* Gray 900 */
    --text-secondary: #4b5563; /* Gray 700 */
    --text-muted: #6b7280; /* Gray 500 */
    --text-inverse: #ffffff;

    --bg-primary: #f9fafb; /* Gray 50 */
    --bg-secondary: #ffffff; /* White */
    --bg-tertiary: #e5e7eb; /* Gray 200 */
    --bg-card: #ffffff;
    --bg-input: #ffffff;

    --border-color: #d1d5db; /* Gray 300 */
    --border-focus: #22c55e; /* Green 500 */

    --success-color: #22c55e; /* Green 500 */
    --error-color: #ef4444; /* Red 500 */
    --warning-color: #f59e0b; /* Yellow 500 */
    --info-color: #3b82f6; /* Blue 500 */

    /* Grayscale */
    --grey-50: #f9fafb;
    --grey-100: #f3f4f6;
    --grey-200: #e5e7eb;
    --grey-300: #d1d5db;
    --grey-400: #9ca3af;
    --grey-500: #6b7280;
    --grey-600: #4b5563;
    --grey-700: #374151;
    --grey-800: #1f2937;
    --grey-900: #111827;

    /* Spacing */
    --space-xs: 0.25rem;   /* 4px */
    --space-sm: 0.5rem;    /* 8px */
    --space-md: 0.75rem;   /* 12px */
    --space-lg: 1rem;      /* 16px */
    --space-xl: 1.25rem;   /* 20px */
    --space-2xl: 1.5rem;   /* 24px */
    --space-3xl: 2rem;     /* 32px */
    --space-4xl: 2.5rem;   /* 40px */
    --space-5xl: 3rem;     /* 48px */
    --space-6xl: 4rem;     /* 64px */

    /* 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 */

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

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

    /* Border Radii */
    --radius-none: 0;
    --radius-sm: 0.125rem; /* 2px */
    --radius-md: 0.25rem;  /* 4px */
    --radius-lg: 0.5rem;   /* 8px */
    --radius-xl: 0.75rem;  /* 12px */
    --radius-2xl: 1rem;    /* 16px */
    --radius-3xl: 1.5rem;  /* 24px */
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);

    /* Transitions */
    --transition-fast: all 0.15s ease-in-out;
    --transition-normal: all 0.3s ease-in-out;
    --transition-slow: all 0.5s ease-in-out;
    --transition-bounce: all 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);

    /* Z-index */
    --z-low: 10;
    --z-mid: 100;
    --z-high: 1000;
    --z-tooltip: 10000;
    --z-modal: 20000;
}

/* Dark Theme Colors */
[data-theme="dark"] {
    --primary-color: #60a5fa; /* Blue 400 */
    --primary-hover: #3b82f6; /* Blue 500 */
    --secondary-color: #a78bfa; /* Purple 400 */
    --secondary-hover: #8b5cf6; /* Purple 500 */

    --text-primary: #e5e7eb; /* Gray 200 */
    --text-secondary: #9ca3af; /* Gray 400 */
    --text-muted: #6b7280; /* Gray 500 */
    --text-inverse: #1f2937; /* Gray 900 */

    --bg-primary: #1f2937; /* Gray 900 */
    --bg-secondary: #111827; /* Gray 950 */
    --bg-tertiary: #374151; /* Gray 700 */
    --bg-card: #111827;
    --bg-input: #374151;

    --border-color: #374151; /* Gray 700 */
    --border-focus: #60a5fa; /* Blue 400 */

    --success-color: #34d399; /* Green 400 */
    --error-color: #f87171; /* Red 400 */
    --warning-color: #fbbf24; /* Yellow 400 */
    --info-color: #60a5fa; /* Blue 400 */
}

/* Auto Theme (System Preference) */
@media (prefers-color-scheme: light) {
    [data-theme="auto"] {
        /* Light theme variables */
        --primary-color: #22c55e; /* Green 500 */
        --primary-hover: #16a34a; /* Green 600 */
        --secondary-color: #3b82f6; /* Blue 500 */
        --secondary-hover: #2563eb; /* Blue 600 */

        --text-primary: #1f2937; /* Gray 900 */
        --text-secondary: #4b5563; /* Gray 700 */
        --text-muted: #6b7280; /* Gray 500 */
        --text-inverse: #ffffff;

        --bg-primary: #f9fafb; /* Gray 50 */
        --bg-secondary: #ffffff; /* White */
        --bg-tertiary: #e5e7eb; /* Gray 200 */
        --bg-card: #ffffff;
        --bg-input: #ffffff;

        --border-color: #d1d5db; /* Gray 300 */
        --border-focus: #22c55e; /* Green 500 */

        --success-color: #22c55e; /* Green 500 */
        --error-color: #ef4444; /* Red 500 */
        --warning-color: #f59e0b; /* Yellow 500 */
        --info-color: #3b82f6; /* Blue 500 */
    }
}

@media (prefers-color-scheme: dark) {
    [data-theme="auto"] {
        /* Dark theme variables */
        --primary-color: #60a5fa; /* Blue 400 */
        --primary-hover: #3b82f6; /* Blue 500 */
        --secondary-color: #a78bfa; /* Purple 400 */
        --secondary-hover: #8b5cf6; /* Purple 500 */

        --text-primary: #e5e7eb; /* Gray 200 */
        --text-secondary: #9ca3af; /* Gray 400 */
        --text-muted: #6b7280; /* Gray 500 */
        --text-inverse: #1f2937; /* Gray 900 */

        --bg-primary: #1f2937; /* Gray 900 */
        --bg-secondary: #111827; /* Gray 950 */
        --bg-tertiary: #374151; /* Gray 700 */
        --bg-card: #111827;
        --bg-input: #374151;

        --border-color: #374151; /* Gray 700 */
        --border-focus: #60a5fa; /* Blue 400 */

        --success-color: #34d399; /* Green 400 */
        --error-color: #f87171; /* Red 400 */
        --warning-color: #fbbf24; /* Yellow 400 */
        --info-color: #60a5fa; /* Blue 400 */
    }
}

/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    font-weight: var(--font-normal);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    background-image: radial-gradient(circle at 1px 1px, rgba(0,0,0,0.05) 1px, transparent 0);
    background-size: 20px 20px;
    padding: 0;
    overflow-x: hidden; /* Prevent horizontal scrolling */
}

main {
    padding: var(--space-2xl) var(--space-lg);
}

@media (max-width: 768px) {
    main {
        padding: var(--space-2xl) var(--space-md);
    }
    .container {
        padding: 0 var(--space-md);
    }
}

@media (max-width: 480px) {
    main {
        padding: var(--space-xl) var(--space-sm);
    }
    .container {
        padding: 0 var(--space-sm);
    }
}

/* Screen reader only styles */
.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;
}

.sr-only-focusable:focus {
  position: static;
  width: auto;
  height: auto;
  padding: var(--space-sm) var(--space-md);
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
  background: var(--primary-color);
  color: var(--text-inverse);
  text-decoration: none;
  border-radius: var(--radius-md);
  z-index: var(--z-tooltip);
}

/* Global Messages */
#global-messages {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
}

#global-messages .alert {
    margin-bottom: 10px;
    position: relative;
}

#global-messages .alert button {
    position: absolute;
    top: 5px;
    right: 10px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
}

/* Headings: Nunito, thin/light, small caps */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Nunito', 'Poppins', Arial, sans-serif;
    font-weight: var(--font-light);
    font-variant: small-caps;
    letter-spacing: 0.04em;
    line-height: var(--leading-tight);
    margin-bottom: var(--space-md);
    color: var(--text-primary);
}

h1 {
    font-size: var(--text-5xl);
    font-weight: var(--font-extralight);
    margin-bottom: var(--space-lg);
}

h2 {
    font-size: var(--text-4xl);
    font-weight: var(--font-light);
    margin-bottom: var(--space-lg);
}

h3 {
    font-size: var(--text-3xl);
    font-weight: var(--font-light);
    margin-bottom: var(--space-md);
}

h4 {
    font-size: var(--text-2xl);
    font-weight: var(--font-light);
    margin-bottom: var(--space-md);
}

h5 {
    font-size: var(--text-xl);
    font-weight: var(--font-light);
    margin-bottom: var(--space-sm);
}

h6 {
    font-size: var(--text-lg);
    font-weight: var(--font-light);
    margin-bottom: var(--space-sm);
}

/* ... (rest of your CSS remains unchanged) ... */

/* Responsive Design */
@media (max-width: 900px) {
    .hero-title { font-size: 2.1rem; }
    .features-grid, .stats-grid { gap: 1.5rem; }
    .feature-card, .stat-item { padding: 1.5rem 1rem; }
}
@media (max-width: 600px) {
    .hero-section, .features-section, .stats-section {
        padding: 2.5rem 0 1.5rem 0;
    }
    .hero-title { font-size: 1.4rem; }
    .section-title { font-size: 1.2rem; }
    .features-grid, .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .feature-card, .stat-item {
        padding: 1.1rem 0.7rem;
    }
}
