/**
 * SOURCE OF TRUTH: Helios V2 Architecture Document (v2.7.0, Invariants H.1, H.3, H.4, H.9, H.13)
 * STATUS: PRODUCTION READY / UNIFIED DUAL-ENGINE TOKENS, WCAG 2.1 AA & LTR/RTL GOVERNANCE
 * Single Source of Truth for Helios Presentation Layer (Section H)
 */

:root {
    /* -------------------------------------------------------------------------
     * 1. Layout Direction & Internationalization Readiness (Invariant H.13)
     * ------------------------------------------------------------------------- */
    --helios-direction: ltr;

    /* -------------------------------------------------------------------------
     * 2. Brand Core & Contrast Governance Tokens (Invariants H.1, H.4)
     * ------------------------------------------------------------------------- */
    --helios-brand-primary: #0d6efd;
    --helios-brand-primary-rgb: 13, 110, 253;
    --helios-brand-primary-hover: #0b5ed7;
    --helios-brand-primary-text: #ffffff;
    --helios-brand-contrast-ratio: 4.54;

    --helios-brand-secondary: #6c757d;
    --helios-brand-secondary-rgb: 108, 117, 125;
    --helios-brand-success: #198754;
    --helios-brand-info: #0dcaf0;
    --helios-brand-warning: #ffc107;
    --helios-brand-danger: #dc3545;
  
    /* -------------------------------------------------------------------------
     * 3. Base Surfaces & Luminance Tokens (Light Mode Default)
     * ------------------------------------------------------------------------- */
    --helios-surface-ground: #f4f6f9;
    --helios-surface-card: #ffffff;
    --helios-surface-alt: #f8f9fa;
    --helios-surface-border: #e2e8f0;
    --helios-surface-header: #ffffff;
    --helios-surface-sidebar: #ffffff;
    
    /* -------------------------------------------------------------------------
     * 4. Semantic Text Tokens (Light Mode Default - Contrast >= 4.5:1)
     * ------------------------------------------------------------------------- */
    --helios-text-primary: #1e293b;
    --helios-text-muted: #64748b;
    --helios-text-body-emphasis: #0f172a;
    
    /* -------------------------------------------------------------------------
     * 5. Typography Tokens
     * ------------------------------------------------------------------------- */
    --helios-font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    --helios-font-mono: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  
    /* -------------------------------------------------------------------------
     * 6. AI Thought Stream & Reasoning Tokens (Invariants H.8, H.10)
     * ------------------------------------------------------------------------- */
    --helios-thought-bg: #f8fafc;
    --helios-thought-border: #cbd5e1;
    --helios-thought-text: #475569;
    --helios-thought-accent: #6366f1;
    --helios-chat-height: 60vh;
  
    /* -------------------------------------------------------------------------
     * 7. Layout, Spacing & CSS Logical Dimensions
     * ------------------------------------------------------------------------- */
    --helios-radius-sm: 0.25rem;
    --helios-radius-md: 0.5rem;
    --helios-radius-lg: 0.75rem;
    --helios-spacing-sm: 0.5rem;
    --helios-spacing-md: 1rem;
    --helios-spacing-lg: 1.5rem;
    
    /* -------------------------------------------------------------------------
     * 8. Shadows & Transitions
     * ------------------------------------------------------------------------- */
    --helios-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --helios-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --helios-transition-theme: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, color 0.15s ease-in-out;
}

/* =============================================================================
 * BIDIRECTIONAL READINESS (Invariant H.13 - RTL Locales)
 * ============================================================================= */
[dir="rtl"] {
    --helios-direction: rtl;
}

/* =============================================================================
 * DUAL-ENGINE THEMING: BOOTSTRAP 5 DARK MODE INTEGRATION (Luminance Layer)
 * Automatically adapts all Helios semantic surfaces when data-bs-theme="dark"
 * ============================================================================= */
[data-bs-theme="dark"] {
    --helios-surface-ground: #0f172a;
    --helios-surface-card: #1e293b;
    --helios-surface-alt: #0f172a;
    --helios-surface-border: #334155;
    --helios-surface-header: #1e293b;
    --helios-surface-sidebar: #1e293b;

    --helios-text-primary: #f8fafc;
    --helios-text-muted: #94a3b8;
    --helios-text-body-emphasis: #ffffff;

    --helios-thought-bg: #111827;
    --helios-thought-border: #374151;
    --helios-thought-text: #9ca3af;
    --helios-thought-accent: #818cf8;

    --helios-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.5);
    --helios-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.6);
}

/* =============================================================================
 * MULTI-TENANT THEMING ISOLATION & BRAND PRESETS (Invariant H.3)
 * Controlled via data-helios-tenant="..." attribute
 * ============================================================================= */

/* Corporate Preset: Sleeker radii & executive brand primary */
[data-helios-tenant="corporate"] {
    --helios-brand-primary: #1e3a8a;
    --helios-brand-primary-rgb: 30, 58, 138;
    --helios-radius-md: 0.125rem;
    --helios-radius-lg: 0.25rem;
}

/* Dark Enterprise Preset: Deep slate enterprise layout */
[data-helios-tenant="dark"] {
    --helios-surface-ground: #0f172a;
    --helios-surface-card: #1e293b;
    --helios-surface-alt: #0f172a;
    --helios-surface-border: #334155;
    --helios-surface-header: #1e293b;
    --helios-surface-sidebar: #1e293b;
    --helios-text-primary: #f8fafc;
    --helios-text-muted: #94a3b8;
    --helios-thought-bg: #111827;
    --helios-thought-border: #374151;
    --helios-thought-text: #9ca3af;
}

/* Compact Preset: High density information display */
[data-helios-tenant="compact"] {
    --helios-spacing-md: 0.75rem;
    --helios-spacing-lg: 1rem;
    --helios-radius-md: 0.25rem;
}

/* =============================================================================
 * CORE COMPONENT CLASSES & CSS LOGICAL PROPERTIES (Invariants H.5, H.8, H.11)
 * ============================================================================= */

/* Universal Layout Surface Helpers */
body {
    transition: var(--helios-transition-theme);
}

.sidebar {
    background-color: var(--helios-surface-sidebar);
    border-inline-end: 1px solid var(--helios-surface-border);
    transition: var(--helios-transition-theme);
}

.main-content {
    background-color: var(--helios-surface-ground);
    transition: var(--helios-transition-theme);
}

/* AI Thought Stream Reasoning Accordion (Invariants H.8 & H.10) */
.helios-thought-accordion,
.helios-thought-container {
    background-color: var(--helios-thought-bg);
    border: 1px solid var(--helios-thought-border);
    border-inline-start: 4px solid var(--helios-thought-accent) !important;
    border-radius: var(--helios-radius-md);
    margin-block-end: var(--helios-spacing-md);
    transition: var(--helios-transition-theme);
}

.helios-thought-header {
    cursor: pointer;
    padding-block: var(--helios-spacing-sm);
    padding-inline: var(--helios-spacing-md);
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--helios-thought-text);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.helios-thought-content {
    padding-block: var(--helios-spacing-sm);
    padding-inline: var(--helios-spacing-md);
    font-family: var(--helios-font-mono);
    font-size: 0.8rem;
    color: var(--helios-thought-text);
    max-height: 250px;
    overflow-y: auto;
    border-block-start: 1px dashed var(--helios-thought-border);
    white-space: pre-wrap;
}

/* Universal Toast Container Layer (Invariant H.11 - Fixed Overlay, Zero CLS) */
.helios-toast-container {
    position: fixed;
    inset-block-start: 1rem;
    inset-inline-end: 1rem;
    z-index: 1090;
}