/* Cross-platform font normalization with Google Fonts Inter */
/* This file ensures consistent font rendering across macOS, Linux, and other platforms */

/* Google Fonts Inter is now loaded via <link> in HTML for better performance */
/* The @import has been removed to eliminate FOUC and improve load times */

/* ===========================================
   TEMA CENTRALIZADO - VARIABLES CSS
   =========================================== */
:root {
    /* Sistema tipográfico profesional */
    --font-xs: 0.6875rem;
    /* 11px - Metadata muy pequeña */
    --font-sm: 0.8125rem;
    /* 13px - Texto secundario, labels */
    --font-md-sm: 0.875rem;
    /* 14px - Texto intermedio (explicaciones) */
    --font-base: 0.9375rem;
    /* 15px - Texto principal */
    --font-md: 1.0625rem;
    /* 17px - Texto destacado */
    --font-lg: 1.375rem;
    /* 22px - Títulos/números stats */
    --font-xl: 1.625rem;
    /* 26px - Números grandes */

    /* Variables especializadas para componentes */
    --font-table: 0.8125rem;
    /* 13px - Tablas (ajustar aquí para cambiar TODAS las tablas) */
    --font-filter: 0.8125rem;
    /* 13px - Filtros (mismo tamaño que tablas) */

    --leading-tight: 1.3;
    --leading-normal: 1.5;

    /* Modo claro - Colores principales */
    --bg-gradient-start: #f8fafc;
    --bg-gradient-end: #ffffff;
    --bg-primary: rgba(255, 255, 255, 0.9);
    --bg-secondary: rgba(241, 245, 249, 0.7);
    --bg-secondary-hover: rgba(248, 250, 252, 0.9);
    --text-primary: #0f172a;
    --text-secondary: #374151;
    --border-primary: rgba(219, 234, 254, 0.5);
    --border-secondary: rgba(71, 85, 105, 0.4);
}

/* Modo oscuro */
html.dark-theme {
    --bg-gradient-start: #2d3848;
    --bg-gradient-end: #384455;
    --bg-primary: rgba(30, 41, 59, 0.9);
    --bg-secondary: rgba(30, 41, 59, 0.7);
    --bg-secondary-hover: rgba(51, 65, 85, 0.9);
    --text-primary: #e2e8f0;
    --text-secondary: #cbd5e1;
    --border-primary: rgba(71, 85, 105, 0.5);
    --border-secondary: rgba(226, 232, 240, 0.4);
}

/* Aplicar tema global */
html {
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    /* Force explicit base font size to avoid OS defaults */
    font-size: 16px;
    /* Base 16px for rem calculations (1rem = 16px) */

    /* Prevent iOS font size changes on orientation change */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;

    /* Improve font rendering consistency */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;

    /* Ensure consistent line-height across platforms */
    line-height: 1.6;
}

body {
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    padding: 0;
    margin: 0;
    color: var(--text-primary);
    /* Font stack with Inter as primary choice */
    font-family:
        'Inter',
        /* Google Font - Primary choice */
        -apple-system,
        /* macOS San Francisco */
        BlinkMacSystemFont,
        /* macOS fallback */
        'Segoe UI',
        /* Windows */
        Roboto,
        /* Android/Chrome OS */
        Oxygen,
        /* KDE */
        Ubuntu,
        /* Ubuntu */
        Cantarell,
        /* GNOME */
        sans-serif;
    /* Generic fallback */

    /* Consolidated font properties from all pages */
    font-size: var(--font-base);
    /* Default: 15px - Base for UI elements */
    font-weight: 400;
    /* Normal weight for better readability */
    letter-spacing: 0.5px;
    /* Slight letter spacing for clarity */
    line-height: 1.6;
    /* Optimal line height for readability */
    color: #0f172a;
    /* Dark slate color for text */

    /* Ensure consistent metrics across platforms */
    font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
    font-variant-ligatures: common-ligatures contextual;

    /* Force system fonts until Inter loads to prevent FOUC */
    /* font-display: optional; - Removed to allow Google Fonts swap strategy */

    /* iOS momentum scroll for body */
    -webkit-overflow-scrolling: touch;
}

/* Additional optimization for variable fonts if available */
@supports (font-variation-settings: normal) {
    body {
        font-variation-settings: 'wght' 400;
    }
}

/* Unified mobile dark-theme background for all pages */
@media (max-width: 768px) {

    html.dark-theme,
    body.dark-theme {
        background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%) !important;
    }
}

/* Override browser zoom settings that might affect rendering */
* {
    box-sizing: border-box;
}

/* Specific fixes for common elements that vary between platforms */
input,
textarea,
select,
button {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

/* Ensure consistent rendering of measurement units */
@media screen {
    html {
        /* Force consistent DPI interpretation */
        zoom: 1;
    }
}

/* ===========================================
   CHROMIUM NAVIGATION INDICATOR FIX
   =========================================== */
/* Disable the blue loading ring that appears on navigation in Chromium browsers */
/* This prevents the flash/spinner when clicking navbar links */
html::-webkit-progress-bar {
    display: none !important;
}

/* Additional Chromium-specific navigation indicators */
::-webkit-progress-value {
    display: none !important;
}

/* Hide the navigation loading indicator completely */
body::before,
body::after {
    content: none !important;
}