/* ==========================================================================
   Myndrex Design Token System
   All visual values must flow through these CSS custom properties.
   Components must use var(--theme-*) — never hardcode colors, fonts,
   spacing, or other visual values.
   ========================================================================== */

:root {
    /* ------------------------------------------------------------------
       COLOR PALETTE — Primary (Teal/Green construction brand)
       ------------------------------------------------------------------ */
    /* Project brand: --PrimaryColor #1F6D4A, --HeaderBgColor #154E36 */
    --theme-primary-50:  #e6f5f0;
    --theme-primary-100: #b3e0d1;
    --theme-primary-200: #80ccb3;
    --theme-primary-300: #4db894;
    --theme-primary-400: #2a9464;
    --theme-primary-500: #1f6d4a;
    --theme-primary-600: #1b6143;
    --theme-primary-700: #154e36;
    --theme-primary-800: #0f3a28;
    --theme-primary-900: #0b2e22;
    --theme-primary: var(--theme-primary-500);
    --theme-primary-contrast: #ffffff;

    /* Secondary (darker green, matches --HeaderBgColor) */
    --theme-secondary-50:  #e3f0eb;
    --theme-secondary-100: #b3d6c7;
    --theme-secondary-200: #80bca3;
    --theme-secondary-300: #4da27f;
    --theme-secondary-400: #267e5b;
    --theme-secondary-500: #154e36;
    --theme-secondary-600: #124430;
    --theme-secondary-700: #0f3a28;
    --theme-secondary-800: #0c2f20;
    --theme-secondary-900: #082118;
    --theme-secondary: var(--theme-secondary-500);
    --theme-secondary-contrast: #ffffff;

    /* Success (Green) */
    --theme-success-50:  #e8f5e9;
    --theme-success-100: #c8e6c9;
    --theme-success-200: #a5d6a7;
    --theme-success-300: #81c784;
    --theme-success-400: #66bb6a;
    --theme-success-500: #4caf50;
    --theme-success-600: #43a047;
    --theme-success-700: #388e3c;
    --theme-success-800: #2e7d32;
    --theme-success-900: #1b5e20;
    --theme-success: var(--theme-success-500);
    --theme-success-contrast: #ffffff;

    /* Warning (Amber) */
    --theme-warning-50:  #fff8e1;
    --theme-warning-100: #ffecb3;
    --theme-warning-200: #ffe082;
    --theme-warning-300: #ffd54f;
    --theme-warning-400: #ffca28;
    --theme-warning-500: #ffc107;
    --theme-warning-600: #ffb300;
    --theme-warning-700: #ffa000;
    --theme-warning-800: #ff8f00;
    --theme-warning-900: #ff6f00;
    --theme-warning: var(--theme-warning-500);
    --theme-warning-contrast: #1a1a1a;

    /* Error (Red) */
    --theme-error-50:  #ffebee;
    --theme-error-100: #ffcdd2;
    --theme-error-200: #ef9a9a;
    --theme-error-300: #e57373;
    --theme-error-400: #ef5350;
    --theme-error-500: #f44336;
    --theme-error-600: #e53935;
    --theme-error-700: #d32f2f;
    --theme-error-800: #c62828;
    --theme-error-900: #b71c1c;
    --theme-error: var(--theme-error-500);
    --theme-error-contrast: #ffffff;

    /* Info (Blue) */
    --theme-info-50:  #e3f2fd;
    --theme-info-100: #bbdefb;
    --theme-info-200: #90caf9;
    --theme-info-300: #64b5f6;
    --theme-info-400: #42a5f5;
    --theme-info-500: #2196f3;
    --theme-info-600: #1e88e5;
    --theme-info-700: #1976d2;
    --theme-info-800: #1565c0;
    --theme-info-900: #0d47a1;
    --theme-info: var(--theme-info-500);
    --theme-info-contrast: #ffffff;

    /* ------------------------------------------------------------------
       SEMANTIC STATUS COLORS (workflow states across domains)
       ------------------------------------------------------------------ */
    --theme-status-draft:     var(--theme-text-secondary);
    --theme-status-pending:   var(--theme-warning-600);
    --theme-status-submitted: var(--theme-info-600);
    --theme-status-approved:  var(--theme-success-600);
    --theme-status-rejected:  var(--theme-error-600);
    --theme-status-void:      var(--theme-text-disabled);
    --theme-status-closed:    var(--theme-text-secondary);

    /* AI confidence banding (used by detection review, quality indicators) */
    --theme-confidence-high:   var(--theme-success-500);  /* >= 0.85 */
    --theme-confidence-medium: var(--theme-warning-500);  /* >= 0.65 */
    --theme-confidence-low:    var(--theme-error-400);    /* < 0.65 */

    /* ------------------------------------------------------------------
       CHART PALETTE (ordered categorical series)
       ------------------------------------------------------------------ */
    --theme-chart-1:  #1f6d4a;
    --theme-chart-2:  #2a9464;
    --theme-chart-3:  #ffb300;
    --theme-chart-4:  #2196f3;
    --theme-chart-5:  #e53935;
    --theme-chart-6:  #8e24aa;
    --theme-chart-7:  #00897b;
    --theme-chart-8:  #f4511e;
    --theme-chart-9:  #3949ab;
    --theme-chart-10: #6d4c41;

    /* ------------------------------------------------------------------
       ACCESSIBILITY
       ------------------------------------------------------------------ */
    --theme-focus-ring:        0 0 0 3px rgba(31, 109, 74, 0.35);
    --theme-focus-ring-offset: 2px;

    /* ------------------------------------------------------------------
       SURFACE & BACKGROUND
       ------------------------------------------------------------------ */
    --theme-bg:             #f5f5f9;
    --theme-bg-alt:         #ffffff;
    --theme-surface:        #ffffff;
    --theme-surface-alt:    #f8f9fa;
    --theme-border:         #e0e0e0;
    --theme-border-light:   #f0f0f0;

    /* ------------------------------------------------------------------
       TEXT
       ------------------------------------------------------------------ */
    --theme-text-primary:   #2e263d;
    --theme-text-secondary: #6e6b7b;
    --theme-text-disabled:  #b9b9c3;
    --theme-text-inverse:   #ffffff;
    --theme-text-link:      var(--theme-primary);

    /* ------------------------------------------------------------------
       TYPOGRAPHY
       ------------------------------------------------------------------ */
    --theme-font-family:       'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --theme-font-family-mono:  'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

    --theme-font-size-xxs:  0.6875rem;  /* 11px */
    --theme-font-size-xs:   0.75rem;    /* 12px */
    --theme-font-size-sm:   0.875rem;   /* 14px */
    --theme-font-size-base: 1rem;       /* 16px */
    --theme-font-size-md:   1.125rem;   /* 18px */
    --theme-font-size-lg:   1.25rem;    /* 20px */
    --theme-font-size-xl:   1.5rem;     /* 24px */
    --theme-font-size-2xl:  1.875rem;   /* 30px */
    --theme-font-size-3xl:  2.25rem;    /* 36px */

    --theme-font-weight-normal:   400;
    --theme-font-weight-medium:   500;
    --theme-font-weight-semibold: 600;
    --theme-font-weight-bold:     700;

    --theme-line-height-tight:  1.25;
    --theme-line-height-normal: 1.5;
    --theme-line-height-loose:  1.75;

    /* Heading sizes */
    --theme-h1-size: var(--theme-font-size-3xl);
    --theme-h2-size: var(--theme-font-size-2xl);
    --theme-h3-size: var(--theme-font-size-xl);
    --theme-h4-size: var(--theme-font-size-lg);
    --theme-h5-size: var(--theme-font-size-md);
    --theme-h6-size: var(--theme-font-size-base);
    --theme-caption-size: var(--theme-font-size-xs);
    --theme-overline-size: var(--theme-font-size-xs);

    /* ------------------------------------------------------------------
       SPACING (4px base scale)
       ------------------------------------------------------------------ */
    --theme-space-0:   0;
    --theme-space-1:   0.25rem;   /* 4px */
    --theme-space-2:   0.5rem;    /* 8px */
    --theme-space-3:   0.75rem;   /* 12px */
    --theme-space-4:   1rem;      /* 16px */
    --theme-space-5:   1.25rem;   /* 20px */
    --theme-space-6:   1.5rem;    /* 24px */
    --theme-space-7:   1.75rem;   /* 28px */
    --theme-space-8:   2rem;      /* 32px */
    --theme-space-9:   2.25rem;   /* 36px */
    --theme-space-10:  2.5rem;    /* 40px */
    --theme-space-11:  2.75rem;   /* 44px */
    --theme-space-12:  3rem;      /* 48px */
    --theme-space-14:  3.5rem;    /* 56px */
    --theme-space-16:  4rem;      /* 64px */
    --theme-space-20:  5rem;      /* 80px */

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

    /* ------------------------------------------------------------------
       ELEVATION / SHADOWS
       ------------------------------------------------------------------ */
    --theme-shadow-none:  none;
    --theme-shadow-xs:    0 1px 2px rgba(0, 0, 0, 0.05);
    --theme-shadow-sm:    0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --theme-shadow-md:    0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
    --theme-shadow-lg:    0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
    --theme-shadow-xl:    0 20px 25px rgba(0, 0, 0, 0.1), 0 8px 10px rgba(0, 0, 0, 0.04);
    --theme-shadow-2xl:   0 25px 50px rgba(0, 0, 0, 0.25);

    /* ------------------------------------------------------------------
       Z-INDEX SCALE
       ------------------------------------------------------------------ */
    --theme-z-dropdown:   1000;
    --theme-z-sticky:     1020;
    --theme-z-fixed:      1030;
    --theme-z-backdrop:   1040;
    --theme-z-modal:      1050;
    --theme-z-popover:    1060;
    --theme-z-tooltip:    1070;
    --theme-z-toast:      1080;

    /* Overlay */
    --theme-overlay-bg: rgba(255, 255, 255, 0.7);

    /* ------------------------------------------------------------------
       TRANSITIONS
       ------------------------------------------------------------------ */
    --theme-transition-fast:   150ms ease;
    --theme-transition-normal: 250ms ease;
    --theme-transition-slow:   350ms ease;

    /* ------------------------------------------------------------------
       LAYOUT
       ------------------------------------------------------------------ */
    --theme-sidebar-width:       260px;
    --theme-sidebar-mini-width:  64px;
    --theme-header-height:       64px;
    --theme-content-max-width:   1440px;

    /* ------------------------------------------------------------------
       BREAKPOINTS (for reference — use in @media queries)
       xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px, xxl: 1400px
       ------------------------------------------------------------------ */
}

/* ==========================================================================
   DARK THEME
   ========================================================================== */

[data-theme="dark"] {
    --theme-bg:             #1a1a2e;
    --theme-bg-alt:         #16213e;
    --theme-surface:        #1e1e33;
    --theme-surface-alt:    #252540;
    --theme-border:         #3a3a5c;
    --theme-border-light:   #2e2e4a;

    --theme-text-primary:   #e0e0e8;
    --theme-text-secondary: #a0a0b8;
    --theme-text-disabled:  #5a5a7a;
    --theme-text-inverse:   #1a1a2e;

    --theme-shadow-xs:    0 1px 2px rgba(0, 0, 0, 0.3);
    --theme-shadow-sm:    0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
    --theme-shadow-md:    0 4px 6px rgba(0, 0, 0, 0.35), 0 2px 4px rgba(0, 0, 0, 0.3);
    --theme-shadow-lg:    0 10px 15px rgba(0, 0, 0, 0.4), 0 4px 6px rgba(0, 0, 0, 0.3);
    --theme-shadow-xl:    0 20px 25px rgba(0, 0, 0, 0.4), 0 8px 10px rgba(0, 0, 0, 0.3);
    --theme-shadow-2xl:   0 25px 50px rgba(0, 0, 0, 0.5);

    --theme-overlay-bg: rgba(15, 23, 42, 0.7);
}

/* ==========================================================================
   BASE STYLES
   ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

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

h1, h2, h3, h4, h5, h6 {
    font-weight: var(--theme-font-weight-semibold);
    line-height: var(--theme-line-height-tight);
    color: var(--theme-text-primary);
    margin-top: 0;
}

h1 { font-size: var(--theme-h1-size); }
h2 { font-size: var(--theme-h2-size); }
h3 { font-size: var(--theme-h3-size); }
h4 { font-size: var(--theme-h4-size); }
h5 { font-size: var(--theme-h5-size); }
h6 { font-size: var(--theme-h6-size); }

a {
    color: var(--theme-text-link);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */

.mx-font-semibold { font-weight: var(--theme-font-weight-semibold) !important; }
.mx-font-medium { font-weight: var(--theme-font-weight-medium) !important; }
.mx-font-bold { font-weight: var(--theme-font-weight-bold) !important; }
.mx-font-normal { font-weight: var(--theme-font-weight-normal) !important; }
