/**
 * CSS Custom Properties (Variables)
 * 
 * LEARN: CSS Custom Properties allow you to define values once and use them everywhere.
 * To change the entire site's colors for a client, you only edit this ONE file.
 *
 * @package Codevall
 */

:root {
    /* =========================================================================
     * BRAND COLORS
     * Change these to customize for different clients
     * ========================================================================= */
    --color-primary: #0066FF;        /* Electric Blue */
    --color-primary-rgb: 0, 102, 255; /* RGB triplet for rgba() usage */
    --color-primary-hover: #0052CC;  /* Darker for hover states */
    --color-primary-dark: #0052CC;   /* Alias for hover (used in some components) */
    --color-primary-light: #E6F0FF;  /* Light tint for backgrounds */
    
    --color-secondary: #84CC16;      /* Electric Lime */
    --color-secondary-hover: #65A30D; /* Darker for hover states */
    --color-secondary-light: #F0FDF4; /* Light tint for backgrounds */

    /* =========================================================================
     * LIGHT MODE COLORS (Default)
     * ========================================================================= */
    --color-text: #1a1a1a;
    --color-text-muted: #6b7280;
    --color-text-light: #9ca3af;
    
    --color-background: #ffffff;
    --color-background-alt: #f9fafb;
    --color-surface: #ffffff;
    --color-surface-elevated: #ffffff;
    
    --color-border: #e5e7eb;
    --color-border-light: #f3f4f6;

    /* =========================================================================
     * SEMANTIC COLORS
     * ========================================================================= */
    --color-error: #ef4444;
    --color-error-light: #fef2f2;
    --color-success: #22c55e;
    --color-success-light: #f0fdf4;
    --color-warning: #f59e0b;
    --color-warning-light: #fffbeb;
    --color-info: #3b82f6;
    --color-info-light: #eff6ff;

    /* =========================================================================
     * TYPOGRAPHY
     * ========================================================================= */
    --font-heading: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'Fira Code', 'Consolas', monospace;

    /* Font Sizes - Using a modular scale (1.25 ratio) */
    --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-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    --font-extrabold: 800;

    /* Line Heights */
    --leading-none: 1;
    --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;

    /* =========================================================================
     * SPACING
     * Based on 4px grid (0.25rem)
     * ========================================================================= */
    --space-0: 0;
    --space-1: 0.25rem;      /* 4px */
    --space-1-5: 0.375rem;   /* 6px - half step */
    --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 */

    /* =========================================================================
     * BORDERS & RADIUS
     * ========================================================================= */
    --radius-none: 0;
    --radius-sm: 0.125rem;   /* 2px */
    --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;   /* Fully rounded */

    --border-width: 1px;
    --border-width-2: 2px;

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

    /* Colored shadows for buttons/cards */
    --shadow-primary: 0 4px 14px 0 rgb(0 102 255 / 0.3);
    --shadow-secondary: 0 4px 14px 0 rgb(132 204 22 / 0.3);

    /* =========================================================================
     * TRANSITIONS
     * ========================================================================= */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
    --transition-slower: 500ms ease;

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

    /* =========================================================================
     * Z-INDEX SCALE
     * ========================================================================= */
    --z-negative: -1;
    --z-0: 0;
    --z-10: 10;
    --z-20: 20;
    --z-30: 30;
    --z-40: 40;
    --z-50: 50;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal-backdrop: 400;
    --z-modal: 500;
    --z-popover: 600;
    --z-tooltip: 700;

    /* =========================================================================
     * LAYOUT
     * ========================================================================= */
    --container-sm: 640px;
    --container-md: 768px;
    --container-lg: 1024px;
    --container-xl: 1280px;
    --container-2xl: 1440px;

    --header-height: 80px;
    --header-height-scrolled: 64px;

    /* =========================================================================
     * BREAKPOINTS (Reference - can't use in media queries)
     * sm: 640px
     * md: 768px
     * lg: 1024px
     * xl: 1280px
     * 2xl: 1536px
     * ========================================================================= */
}

/* =============================================================================
 * DARK MODE OVERRIDES
 * 
 * LEARN: The [data-theme="dark"] selector targets the HTML element when
 * dark mode is active. JavaScript toggles this attribute.
 * ============================================================================= */
[data-theme="dark"] {
    --color-text: #f9fafb;
    --color-text-muted: #9ca3af;
    --color-text-light: #6b7280;
    
    --color-background: #0f172a;
    --color-background-alt: #1e293b;
    --color-surface: #1e293b;
    --color-surface-elevated: #334155;
    
    --color-border: #334155;
    --color-border-light: #475569;

    /* Adjusted shadows for dark mode */
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.3), 0 1px 2px -1px rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.4);

    /* Primary color adjustments for dark mode */
    --color-primary-light: #1e3a5f;
    --color-secondary-light: #1a2e05;
}

/* =============================================================================
 * SYSTEM PREFERENCE DETECTION
 * 
 * LEARN: This automatically applies dark mode if the user's OS is set to dark
 * mode AND they haven't manually chosen a preference on the site.
 * ============================================================================= */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --color-text: #f9fafb;
        --color-text-muted: #9ca3af;
        --color-text-light: #6b7280;
        
        --color-background: #0f172a;
        --color-background-alt: #1e293b;
        --color-surface: #1e293b;
        --color-surface-elevated: #334155;
        
        --color-border: #334155;
        --color-border-light: #475569;

        --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.3), 0 1px 2px -1px rgb(0 0 0 / 0.3);
        --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
        --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.4);

        --color-primary-light: #1e3a5f;
        --color-secondary-light: #1a2e05;
    }
}
