/**
 * SIBERTEX CSS/Branding Source of Truth (SOT)
 * CANONICAL_SYSTEM_RULES_AND_SOT.md §10.1.4
 * 
 * This file defines the single source of truth for all branding,
 * colors, typography, spacing, and component styling.
 * 
 * ALL STYLING MUST REFERENCE THESE VARIABLES.
 * AD-HOC INLINE STYLES ARE PROHIBITED EXCEPT FOR DOCUMENTED UTILITIES.
 */

:root {
    /* ==========================================================================
       COLOR PALETTE - PRIMARY BRAND COLORS
       ========================================================================== */
    
    /* Primary brand color (SIBERTEX blue) */
    --sib-primary: #4154f1;
    --sib-primary-hover: #3a4ad9;
    --sib-primary-light: #e8ebff;
    --sib-primary-dark: #2c3ab8;
    
    /* Secondary brand color */
    --sib-secondary: #6c757d;
    --sib-secondary-hover: #5a6268;
    --sib-secondary-light: #e9ecef;
    
    /* ==========================================================================
       SEMANTIC COLORS
       ========================================================================== */
    
    /* Success (green) */
    --sib-success: #28a745;
    --sib-success-hover: #218838;
    --sib-success-light: #d4edda;
    --sib-success-bg: #e8f5e9;
    
    /* Danger (red) */
    --sib-danger: #dc3545;
    --sib-danger-hover: #c82333;
    --sib-danger-light: #f8d7da;
    --sib-danger-bg: #ffebee;
    
    /* Warning (yellow/orange) */
    --sib-warning: #ffc107;
    --sib-warning-hover: #e0a800;
    --sib-warning-light: #fff3cd;
    --sib-warning-bg: #fff8e1;
    
    /* Info (cyan/blue) */
    --sib-info: #17a2b8;
    --sib-info-hover: #138496;
    --sib-info-light: #d1ecf1;
    --sib-info-bg: #e3f2fd;
    
    /* ==========================================================================
       BACKGROUND COLORS
       ========================================================================== */
    
    --sib-bg-body: #f6f9ff;
    --sib-bg-white: #ffffff;
    --sib-bg-light: #f8f9fa;
    --sib-bg-dark: #0f2744;
    --sib-bg-darker: #0b1727;
    --sib-bg-card: #ffffff;
    
    /* ==========================================================================
       TEXT COLORS
       ========================================================================== */
    
    --sib-text-primary: #012970;
    --sib-text-secondary: #444444;
    --sib-text-muted: #6c757d;
    --sib-text-light: #e5e7eb;
    --sib-text-white: #ffffff;
    
    /* ==========================================================================
       BORDER COLORS
       ========================================================================== */
    
    --sib-border-color: #e9ecef;
    --sib-border-light: #f1f3f5;
    --sib-border-dark: rgba(255, 255, 255, 0.08);
    
    /* ==========================================================================
       TYPOGRAPHY
       ========================================================================== */
    
    --sib-font-primary: 'Open Sans', sans-serif;
    --sib-font-heading: 'Nunito', sans-serif;
    --sib-font-accent: 'Poppins', sans-serif;
    
    --sib-font-size-base: 1rem;
    --sib-font-size-sm: 0.875rem;
    --sib-font-size-xs: 0.75rem;
    --sib-font-size-lg: 1.125rem;
    --sib-font-size-xl: 1.25rem;
    --sib-font-size-xxl: 1.5rem;
    
    --sib-font-weight-normal: 400;
    --sib-font-weight-medium: 500;
    --sib-font-weight-semibold: 600;
    --sib-font-weight-bold: 700;
    
    --sib-line-height-base: 1.5;
    --sib-line-height-tight: 1.25;
    --sib-line-height-loose: 1.75;
    
    /* ==========================================================================
       SPACING
       ========================================================================== */
    
    --sib-spacing-xs: 0.25rem;    /* 4px */
    --sib-spacing-sm: 0.5rem;     /* 8px */
    --sib-spacing-md: 1rem;       /* 16px */
    --sib-spacing-lg: 1.5rem;     /* 24px */
    --sib-spacing-xl: 2rem;       /* 32px */
    --sib-spacing-xxl: 3rem;      /* 48px */
    
    /* ==========================================================================
       BORDER RADIUS
       ========================================================================== */
    
    --sib-radius-sm: 4px;
    --sib-radius-md: 8px;
    --sib-radius-lg: 12px;
    --sib-radius-xl: 16px;
    --sib-radius-pill: 999px;
    
    /* ==========================================================================
       SHADOWS
       ========================================================================== */
    
    --sib-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --sib-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --sib-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --sib-shadow-xl: 0 12px 48px rgba(0, 0, 0, 0.15);
    
    /* ==========================================================================
       TRANSITIONS
       ========================================================================== */
    
    --sib-transition-fast: 0.15s ease;
    --sib-transition-base: 0.2s ease;
    --sib-transition-slow: 0.3s ease;
    
    /* ==========================================================================
       Z-INDEX LAYERS
       ========================================================================== */
    
    --sib-z-dropdown: 1000;
    --sib-z-sticky: 1020;
    --sib-z-fixed: 1030;
    --sib-z-modal-backdrop: 1040;
    --sib-z-modal: 1050;
    --sib-z-popover: 1060;
    --sib-z-tooltip: 1070;
    --sib-z-toast: 1080;
    --sib-z-spinner: 9999;
    
    /* ==========================================================================
       SKELETON LOADING
       ========================================================================== */
    
    --sib-skeleton-base: #e9ecef;
    --sib-skeleton-shine: #f8f9fa;
    --sib-skeleton-header: #dee2e6;
    
    /* ==========================================================================
       COMPONENT-SPECIFIC TOKENS
       ========================================================================== */
    
    /* Cards */
    --sib-card-bg: var(--sib-bg-card);
    --sib-card-border: var(--sib-border-color);
    --sib-card-shadow: var(--sib-shadow-sm);
    --sib-card-radius: var(--sib-radius-lg);
    --sib-card-padding: var(--sib-spacing-lg);
    
    /* Buttons */
    --sib-btn-padding-x: 1rem;
    --sib-btn-padding-y: 0.5rem;
    --sib-btn-radius: var(--sib-radius-sm);
    --sib-btn-font-weight: var(--sib-font-weight-medium);
    
    /* Inputs */
    --sib-input-border: var(--sib-border-color);
    --sib-input-focus-border: var(--sib-primary);
    --sib-input-focus-shadow: 0 0 0 0.25rem rgba(65, 84, 241, 0.25);
    --sib-input-radius: var(--sib-radius-sm);
    --sib-input-padding: 0.625rem 0.875rem;
    
    /* Tables */
    --sib-table-header-bg: var(--sib-bg-light);
    --sib-table-border: var(--sib-border-color);
    --sib-table-hover-bg: rgba(65, 84, 241, 0.04);
    --sib-table-stripe-bg: rgba(0, 0, 0, 0.02);
    
    /* Sidebar */
    --sib-sidebar-width: 300px;
    --sib-sidebar-bg: var(--sib-bg-white);
    --sib-sidebar-border: var(--sib-border-color);
    
    /* Header */
    --sib-header-height: 60px;
    --sib-header-bg: var(--sib-bg-darker);
}

/* ==========================================================================
   DARK MODE OVERRIDES (future-proof)
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    :root.sib-dark-mode {
        --sib-bg-body: #1a1a2e;
        --sib-bg-white: #16213e;
        --sib-bg-card: #1f4068;
        --sib-text-primary: #e5e7eb;
        --sib-text-secondary: #d1d5db;
        --sib-border-color: #374151;
    }
}

/* ==========================================================================
   UTILITY CLASSES (ALLOWED INLINE ALTERNATIVES)
   ========================================================================== */

/* These utility classes are ALLOWED as alternatives to inline styles */

.sib-text-primary { color: var(--sib-text-primary) !important; }
.sib-text-muted { color: var(--sib-text-muted) !important; }
.sib-text-success { color: var(--sib-success) !important; }
.sib-text-danger { color: var(--sib-danger) !important; }
.sib-text-warning { color: var(--sib-warning) !important; }
.sib-text-info { color: var(--sib-info) !important; }

.sib-bg-primary { background-color: var(--sib-primary) !important; }
.sib-bg-success { background-color: var(--sib-success-bg) !important; }
.sib-bg-danger { background-color: var(--sib-danger-bg) !important; }
.sib-bg-warning { background-color: var(--sib-warning-bg) !important; }
.sib-bg-info { background-color: var(--sib-info-bg) !important; }

.sib-border { border: 1px solid var(--sib-border-color) !important; }
.sib-border-primary { border-color: var(--sib-primary) !important; }
.sib-border-success { border-color: var(--sib-success) !important; }
.sib-border-danger { border-color: var(--sib-danger) !important; }

.sib-rounded { border-radius: var(--sib-radius-md) !important; }
.sib-rounded-lg { border-radius: var(--sib-radius-lg) !important; }
.sib-rounded-pill { border-radius: var(--sib-radius-pill) !important; }

.sib-shadow { box-shadow: var(--sib-shadow-md) !important; }
.sib-shadow-lg { box-shadow: var(--sib-shadow-lg) !important; }

/* ==========================================================================
   CONTA CORRENTE UTILITY CLASSES (SOT §10.1.4.1)
   ========================================================================== */

/* Balance status indicators */
.sib-balance-devedor { color: var(--sib-danger) !important; font-weight: var(--sib-font-weight-bold) !important; }
.sib-balance-credor { color: var(--sib-success) !important; }
.sib-balance-nulo { color: var(--sib-text-muted) !important; }

/* Days overdue indicators */
.sib-days-critical { color: var(--sib-danger) !important; font-weight: var(--sib-font-weight-bold) !important; }
.sib-days-warning { color: var(--sib-warning) !important; }
.sib-days-ok { color: var(--sib-text-muted) !important; }

/* Status badges */
.sib-status-regularizado { background-color: var(--sib-success-light) !important; color: var(--sib-success) !important; }
.sib-status-divida { background-color: var(--sib-danger-light) !important; color: var(--sib-danger) !important; }
.sib-status-credito { background-color: var(--sib-info-light) !important; color: var(--sib-info) !important; }

/* Filter bar styling */
.sib-filter-bar { 
    background: var(--sib-bg-light); 
    padding: var(--sib-spacing-md); 
    border-radius: var(--sib-radius-md); 
}

/* Table container */
.sib-table-container { min-height: 400px; }

/* Caption text */
.sib-caption { 
    font-size: var(--sib-font-size-sm); 
    color: var(--sib-text-muted); 
    font-style: italic; 
}

/* KPI card hover effect (matches Dashboard) */
.info-card.kpi-card {
    transition: transform var(--sib-transition-base), box-shadow var(--sib-transition-base);
}
.info-card.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--sib-shadow-lg);
}

/* ==========================================================================
   FORM SELECT STYLING FIX - SOT §10.1.4
   Ensures all select dropdowns and options are readable in all themes.
   ========================================================================== */

/* Select elements - explicit readable styling */
select.form-select,
select.form-control,
.form-select,
select {
    background-color: var(--sib-bg-white, #ffffff);
    color: var(--sib-text-primary, #012970);
    border: 1px solid var(--sib-border-color, #e9ecef);
    border-radius: var(--sib-input-radius, 4px);
}

select.form-select:focus,
select.form-control:focus,
.form-select:focus,
select:focus {
    border-color: var(--sib-input-focus-border, #4154f1);
    box-shadow: var(--sib-input-focus-shadow, 0 0 0 0.25rem rgba(65, 84, 241, 0.25));
    outline: none;
    background-color: var(--sib-bg-white, #ffffff);
    color: var(--sib-text-primary, #012970);
}

select.form-select:hover,
select.form-control:hover,
.form-select:hover,
select:hover {
    border-color: var(--sib-primary-hover, #3a4ad9);
}

select.form-select:disabled,
select.form-control:disabled,
.form-select:disabled,
select:disabled {
    background-color: var(--sib-bg-light, #f8f9fa);
    color: var(--sib-text-muted, #6c757d);
    opacity: 0.65;
}

/* Option elements - explicit readable styling */
select option,
.form-select option,
select.form-control option {
    background-color: var(--sib-bg-white, #ffffff);
    color: var(--sib-text-primary, #012970);
    padding: 0.5rem 0.75rem;
}

select option:checked,
select option:hover,
.form-select option:checked,
.form-select option:hover {
    background-color: var(--sib-primary-light, #e8ebff);
    color: var(--sib-text-primary, #012970);
}

/* ==========================================================================
   PROHIBITED PATTERNS (DOCUMENTED FOR ENFORCEMENT)
   ========================================================================== */

/*
 * THE FOLLOWING PATTERNS ARE PROHIBITED:
 * 
 * 1. Inline styles with hardcoded colors:
 *    ❌ style="color: #333333"
 *    ✅ class="sib-text-primary" or style="color: var(--sib-text-primary)"
 * 
 * 2. Hardcoded font sizes:
 *    ❌ style="font-size: 14px"
 *    ✅ class="small" or style="font-size: var(--sib-font-size-sm)"
 * 
 * 3. Hardcoded spacing:
 *    ❌ style="margin: 20px"
 *    ✅ class="my-4" or style="margin: var(--sib-spacing-lg)"
 * 
 * 4. Non-standard shadows:
 *    ❌ style="box-shadow: 0 2px 5px rgba(0,0,0,0.1)"
 *    ✅ class="sib-shadow" or style="box-shadow: var(--sib-shadow-md)"
 * 
 * 5. Non-standard border radius:
 *    ❌ style="border-radius: 10px"
 *    ✅ class="sib-rounded" or style="border-radius: var(--sib-radius-md)"
 * 
 * EXCEPTIONS (ALLOWED):
 * - Component-specific calculations (e.g., grid layouts)
 * - Animation keyframes
 * - SVG inline styles
 * - Print media styles
 */
