/* ============================================
   THEMES — CSS Custom Properties
   Dark (default) + Light mode
   ============================================ */

:root {
    /* Background */
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-header: #404040;
    --bg-card: #363636;
    --bg-input: #2d2d2d;
    --bg-hover: #444444;

    /* Text */
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-muted: #888888;
    --text-link: #4fc3f7;
    --text-link-hover: #81d4fa;

    /* Borders */
    --border-color: #555555;
    --border-focus: #4fc3f7;

    /* Status */
    --color-live: #4caf50;
    --color-offline: #f44336;
    --color-warn: #ff9800;
    --color-stale: #ef5350;

    /* Tier badges */
    --tier1-bg: #2e7d32;
    --tier1-text: #ffffff;
    --tier2-bg: #1565c0;
    --tier2-text: #ffffff;
    --tier3-bg: #6a1b9a;
    --tier3-text: #ffffff;

    /* Provider type dots (map legend) */
    --dot-direct: #4caf50;
    --dot-indirect: #42a5f5;
    --dot-government: #ab47bc;
    --dot-law-enforcement: #ff9800;

    /* Metric cards */
    --metric-bg: #2d2d2d;
    --metric-border: #444444;
    --metric-value: #ffffff;

    /* Hero nearest card */
    --hero-card-bg: #1a2a3a;
    --hero-card-border: #2c3e50;

    /* Quick exit */
    --exit-bg: #d32f2f;
    --exit-text: #ffffff;

    /* Buttons */
    --btn-primary-bg: #0097a7;
    --btn-primary-text: #ffffff;
    --btn-primary-hover: #00acc1;
    --btn-save-bg: #2d2d2d;
    --btn-save-text: #e0e0e0;
    --btn-save-border: #555555;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.5);

    /* Spacing scale */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-md: 1rem;
    --font-size-lg: 1.25rem;
    --font-size-xl: 1.5rem;
    --font-size-2xl: 2rem;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-bold: 700;

    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
}

/* ============================================
   LIGHT THEME
   ============================================ */

[data-theme="light"] {
    /* Background */
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-header: #2c3e50;
    --bg-card: #f8f8f8;
    --bg-input: #ffffff;
    --bg-hover: #eeeeee;

    /* Text */
    --text-primary: #1a1a1a;
    --text-secondary: #333333;
    --text-muted: #666666;
    --text-link: #0277bd;
    --text-link-hover: #01579b;

    /* Borders */
    --border-color: #cccccc;
    --border-focus: #0277bd;

    /* Metric cards */
    --metric-bg: #ffffff;
    --metric-border: #dddddd;
    --metric-value: #1a1a1a;

    /* Hero nearest card */
    --hero-card-bg: #1a2a3a;
    --hero-card-border: #2c3e50;

    /* Buttons */
    --btn-save-bg: #ffffff;
    --btn-save-text: #333333;
    --btn-save-border: #cccccc;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* ============================================
   AUTO THEME — follows OS preference
   ============================================ */

@media (prefers-color-scheme: light) {
    :root:not([data-theme]) {
        --bg-primary: #f5f5f5;
        --bg-secondary: #ffffff;
        --bg-header: #2c3e50;
        --bg-card: #f8f8f8;
        --bg-input: #ffffff;
        --bg-hover: #eeeeee;
        --text-primary: #1a1a1a;
        --text-secondary: #333333;
        --text-muted: #666666;
        --text-link: #0277bd;
        --text-link-hover: #01579b;
        --border-color: #cccccc;
        --border-focus: #0277bd;
        --metric-bg: #ffffff;
        --metric-border: #dddddd;
        --metric-value: #1a1a1a;
        --hero-card-bg: #1a2a3a;
        --hero-card-border: #2c3e50;
        --btn-save-bg: #ffffff;
        --btn-save-text: #333333;
        --btn-save-border: #cccccc;
        --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
        --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.12);
        --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
    }
}
