/* ==========================================================================
   DESIGN TOKENS — MobiiClub
   Single source of truth: colors, radii, spacing, typography.
   Overrides Tabler's CSS variables so every component inherits automatically.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Typography — Geist + Geist Mono via Google Fonts
   -------------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500;600&display=swap');

/* --------------------------------------------------------------------------
   Light theme (default)
   -------------------------------------------------------------------------- */
:root,
[data-bs-theme='light'] {
    /* Surfaces */
    --mc-bg: #ffffff;
    --mc-surface: #ffffff;
    --mc-surface-2: #fafafa;
    --mc-surface-3: #f5f5f5;
    --mc-surface-hover: #f5f5f5;

    /* Text */
    --mc-text: #0a0a0a;
    --mc-text-secondary: #525252;
    --mc-text-muted: #737373;
    --mc-text-on-accent: #0a0a0a;

    /* Borders */
    --mc-border: #e5e5e5;
    --mc-border-strong: #d4d4d4;
    --mc-border-subtle: #f0f0f0;

    /* Accent — brand "Amarillo señal" */
    --mc-accent: #f3c300;
    --mc-accent-hover: #e5b800;
    --mc-accent-soft: rgba(243, 195, 0, 0.12);
    --mc-accent-border: rgba(243, 195, 0, 0.4);

    /* Brand secondaries */
    --mc-brand-orange: #e58a3a;      /* Naranja cálido */
    --mc-brand-ivory: #f6f2e8;       /* Marfil */
    --mc-brand-fog: #d9d3c8;         /* Gris niebla */
    --mc-brand-black: #111111;       /* Negro profundo */

    /* Status — OMS/operations palette */
    --mc-success: #22c55e;
    --mc-success-soft: rgba(34, 197, 94, 0.1);
    --mc-danger: #ef4444;
    --mc-danger-soft: rgba(239, 68, 68, 0.1);
    --mc-warning: #e58a3a;
    --mc-warning-soft: rgba(229, 138, 58, 0.12);
    --mc-info: #f3c300;
    --mc-info-soft: rgba(243, 195, 0, 0.1);

    /* Map onto Tabler */
    --tblr-body-bg: var(--mc-bg);
    --tblr-body-color: var(--mc-text);
    --tblr-body-color-rgb: 10, 10, 10;
    --tblr-secondary-color: var(--mc-text-secondary);
    --tblr-tertiary-color: var(--mc-text-muted);
    --tblr-muted: var(--mc-text-muted);

    --tblr-bg-surface: var(--mc-surface);
    --tblr-bg-surface-secondary: var(--mc-surface-2);
    --tblr-bg-surface-tertiary: var(--mc-surface-3);

    --tblr-border-color: var(--mc-border);
    --tblr-border-color-translucent: var(--mc-border);

    --tblr-card-bg: var(--mc-surface);
    --tblr-card-cap-bg: var(--mc-surface);
    --tblr-card-border-color: var(--mc-border);

    --tblr-dropdown-bg: var(--mc-surface);
    --tblr-dropdown-border-color: var(--mc-border);
    --tblr-dropdown-link-hover-bg: var(--mc-surface-hover);

    --tblr-modal-bg: var(--mc-surface);
    --tblr-modal-border-color: var(--mc-border);

    --tblr-navbar-bg: var(--mc-surface);
    --tblr-navbar-border-color: var(--mc-border);

    --tblr-form-control-bg: var(--mc-surface);
    --tblr-form-control-disabled-bg: var(--mc-surface-2);

    --tblr-table-bg: transparent;
    --tblr-table-striped-bg: var(--mc-surface-2);
    --tblr-table-hover-bg: var(--mc-surface-hover);
    --tblr-table-border-color: var(--mc-border);

    /* Typography */
    --tblr-font-sans-serif: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --tblr-font-monospace: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Monaco, Consolas, monospace;
    --mc-font-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Monaco, Consolas, monospace;

    /* Radii — Midday-style (near 0) */
    --mc-radius-0: 0;
    --mc-radius-xs: 1px;
    --mc-radius-sm: 2px;
    --mc-radius-md: 4px;
    --mc-radius-lg: 6px;
    --mc-radius-full: 9999px;

    --tblr-border-radius: var(--mc-radius-sm);
    --tblr-border-radius-sm: var(--mc-radius-xs);
    --tblr-border-radius-lg: var(--mc-radius-md);
    --tblr-border-radius-xl: var(--mc-radius-lg);
    --tblr-border-radius-2xl: var(--mc-radius-lg);
    --tblr-border-radius-pill: var(--mc-radius-full);

    --tblr-card-border-radius: var(--mc-radius-0);
    --tblr-card-inner-border-radius: var(--mc-radius-0);
    --tblr-modal-border-radius: var(--mc-radius-sm);
    --tblr-dropdown-border-radius: var(--mc-radius-sm);
    --tblr-btn-border-radius: var(--mc-radius-sm);
    --tblr-btn-border-radius-sm: var(--mc-radius-sm);
    --tblr-btn-border-radius-lg: var(--mc-radius-sm);
    --tblr-input-border-radius: var(--mc-radius-sm);

    /* Borders */
    --tblr-border-width: 1px;

    /* Spacing scale (kept Tabler-compatible) */
    --mc-space-1: 0.25rem;
    --mc-space-2: 0.5rem;
    --mc-space-3: 0.75rem;
    --mc-space-4: 1rem;
    --mc-space-5: 1.5rem;
    --mc-space-6: 2rem;
    --mc-space-7: 3rem;
    --mc-space-8: 4rem;

    /* Typography scale — dense ops UI with readable baseline */
    --mc-text-2xs: 10px;    /* uppercase table labels, metadata */
    --mc-text-xs: 11px;     /* labels, captions */
    --mc-text-sm: 12px;     /* secondary, badges */
    --mc-text-base: 13px;   /* body, table cells, nav, inputs — readable baseline */
    --mc-text-md: 13px;     /* emphasized body */
    --mc-text-lg: 14px;     /* h4, card titles */
    --mc-text-xl: 15px;     /* h3, sub-section titles */
    --mc-text-2xl: 17px;    /* h2, KPI value */
    --mc-text-3xl: 20px;    /* h1, page title */
    --mc-text-display: 28px;/* hero numbers (KPI dashboard) */

    /* Override Tabler base font sizes so components inherit our scale */
    --tblr-font-size-base: 13px;
    --tblr-body-font-size: 13px;
    --tblr-h1-font-size: 20px;
    --tblr-h2-font-size: 17px;
    --tblr-h3-font-size: 15px;
    --tblr-h4-font-size: 14px;
    --tblr-h5-font-size: 13px;
    --tblr-h6-font-size: 12px;

    /* Layout vars live in layout.css :root to stay theme-agnostic */

    /* Shadows — extremely subtle, mostly flat */
    --mc-shadow-xs: 0 1px 0 0 rgba(0, 0, 0, 0.03);
    --mc-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    --mc-shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.06);
    --mc-shadow-lg: 0 12px 32px -8px rgba(0, 0, 0, 0.08);
    --mc-shadow-hover: 0 2px 6px -1px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);

    /* Icon stroke — controls the universal stroke-width of every <i class="ti">
       once the icon-thinner script swaps it to inline SVG. Lower = thinner.
       Tabler's webfont default is 2; we homologate to 1.5 across the system. */
    --mc-icon-stroke: 1.5;

    /* Motion — easing curves + duration tokens */
    --mc-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --mc-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --mc-ease-in: cubic-bezier(0.7, 0, 0.84, 0);
    --mc-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

    --mc-dur-instant: 80ms;
    --mc-dur-fast: 140ms;
    --mc-dur-base: 220ms;
    --mc-dur-slow: 380ms;
    --mc-dur-slower: 600ms;

    /* Brand RGB (for rgba() use in Bootstrap utilities) */
    --tblr-primary: #0a0a0a;
    --tblr-primary-rgb: 10, 10, 10;
}

/* --------------------------------------------------------------------------
   Dark theme
   -------------------------------------------------------------------------- */
[data-bs-theme='dark'] {
    /* Surfaces — OMS-OS pure black */
    --mc-bg: #0a0a0a;
    --mc-surface: #0f0f0f;
    --mc-surface-2: #141414;
    --mc-surface-3: #1c1c1c;
    --mc-surface-hover: #1a1a1a;

    /* Text */
    --mc-text: #f5f5f5;
    --mc-text-secondary: #a3a3a3;
    --mc-text-muted: #6b6b6b;
    --mc-text-on-accent: #111111;

    /* Borders — very subtle on dark */
    --mc-border: #1c1c1c;
    --mc-border-strong: #2a2a2a;
    --mc-border-subtle: #141414;

    /* Accent — brand yellow on dark */
    --mc-accent: #f3c300;
    --mc-accent-hover: #ffd400;
    --mc-accent-soft: rgba(243, 195, 0, 0.14);
    --mc-accent-border: rgba(243, 195, 0, 0.45);

    /* Brand secondaries */
    --mc-brand-orange: #e58a3a;
    --mc-brand-ivory: #f6f2e8;
    --mc-brand-fog: #d9d3c8;
    --mc-brand-black: #111111;

    /* Status — operations palette (OMS-OS reference) */
    --mc-success: #4ade80;           /* in transit / active green */
    --mc-success-soft: rgba(74, 222, 128, 0.12);
    --mc-danger: #f87171;             /* delay risk */
    --mc-danger-soft: rgba(248, 113, 113, 0.12);
    --mc-warning: #e58a3a;            /* processing — brand orange */
    --mc-warning-soft: rgba(229, 138, 58, 0.14);
    --mc-info: #f3c300;               /* default highlight — brand yellow */
    --mc-info-soft: rgba(243, 195, 0, 0.12);

    /* Map onto Tabler */
    --tblr-body-bg: var(--mc-bg);
    --tblr-body-color: var(--mc-text);
    --tblr-body-color-rgb: 250, 250, 250;
    --tblr-secondary-color: var(--mc-text-secondary);
    --tblr-tertiary-color: var(--mc-text-muted);
    --tblr-muted: var(--mc-text-muted);
    --tblr-emphasis-color: #ffffff;

    --tblr-bg-surface: var(--mc-surface);
    --tblr-bg-surface-dark: var(--mc-bg);
    --tblr-bg-surface-secondary: var(--mc-surface-2);
    --tblr-bg-surface-tertiary: var(--mc-surface-3);

    --tblr-border-color: var(--mc-border);
    --tblr-border-color-translucent: var(--mc-border);

    --tblr-card-bg: var(--mc-surface);
    --tblr-card-cap-bg: var(--mc-surface);
    --tblr-card-border-color: var(--mc-border);

    --tblr-dropdown-bg: var(--mc-surface);
    --tblr-dropdown-border-color: var(--mc-border);
    --tblr-dropdown-link-hover-bg: var(--mc-surface-hover);

    --tblr-modal-bg: var(--mc-surface);
    --tblr-modal-border-color: var(--mc-border);

    --tblr-navbar-bg: var(--mc-surface);
    --tblr-navbar-border-color: var(--mc-border);

    --tblr-form-control-bg: var(--mc-surface-2);
    --tblr-form-control-disabled-bg: var(--mc-surface);

    --tblr-table-bg: transparent;
    --tblr-table-striped-bg: rgba(255, 255, 255, 0.02);
    --tblr-table-hover-bg: var(--mc-surface-hover);
    --tblr-table-border-color: var(--mc-border);

    /* Shadows on dark — stronger to keep depth */
    --mc-shadow-xs: 0 1px 0 0 rgba(0, 0, 0, 0.4);
    --mc-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
    --mc-shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.5);
    --mc-shadow-lg: 0 12px 32px -8px rgba(0, 0, 0, 0.6);

    --tblr-primary: #fafafa;
    --tblr-primary-rgb: 250, 250, 250;
}

/* --------------------------------------------------------------------------
   Base — typography for dense operations UI
   -------------------------------------------------------------------------- */
html {
    font-size: 14px;
}

body,
.page-wrapper {
    font-family: var(--tblr-font-sans-serif);
    background-color: var(--mc-bg);
    color: var(--mc-text);
    font-size: var(--mc-text-base) !important;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'cv11', 'ss01', 'ss03';
}

/* Anchors inherit text styling — no underline, no color override.
   Centralized reset so individual components don't repeat anti-underline rules.
   This is the ONLY place we touch text-decoration. */
a,
a:hover,
a:focus,
a:active {
    color: inherit;
    text-decoration: none;
}

/* Explicit semantic links keep their default color */
a.link-primary,
a.link-secondary,
a.link-info,
a.link-success,
a.link-danger,
a.link-warning { color: revert; }

/* Headings — explicit, override Tabler */
h1, .h1 { font-size: var(--mc-text-3xl) !important; line-height: 1.2; }
h2, .h2 { font-size: var(--mc-text-2xl) !important; line-height: 1.25; }
h3, .h3 { font-size: var(--mc-text-xl) !important; line-height: 1.3; }
h4, .h4 { font-size: var(--mc-text-lg) !important; line-height: 1.35; }
h5, .h5 { font-size: var(--mc-text-md) !important; line-height: 1.4; }
h6, .h6 { font-size: var(--mc-text-base) !important; line-height: 1.4; }

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    color: var(--mc-text);
    letter-spacing: -0.015em;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

/* Tabler font-size utility classes — remapped to our compact scale */
.fs-1 { font-size: var(--mc-text-2xl) !important; }   /* 15 */
.fs-2 { font-size: var(--mc-text-xl) !important; }    /* 14 */
.fs-3 { font-size: var(--mc-text-lg) !important; }    /* 13 */
.fs-4 { font-size: var(--mc-text-base) !important; }  /* 12 */
.fs-5 { font-size: var(--mc-text-sm) !important; }    /* 11 */
.fs-6 { font-size: var(--mc-text-xs) !important; }    /* 10 */

small, .small { font-size: var(--mc-text-sm) !important; }

/* Paragraph & list defaults inherit body size */
p, ul, ol, dl, label, span, a, button, input, select, textarea, td, th {
    font-size: inherit;
}

/* Numeric display: tabular figures (uniform width digits) */
.mc-mono,
.mc-num,
.text-num,
.balance-amount,
h1, .h1,
h2, .h2 {
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

/* Hero/display number (dashboards, KPI cards) */
.mc-display {
    font-size: var(--mc-text-display);
    line-height: 1.1;
    font-weight: 500;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Motion — global keyframes
   ========================================================================== */

@keyframes mc-fade-up {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes mc-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes mc-scale-in {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes mc-pulse-soft {
    0%, 100% { box-shadow: 0 0 0 0 var(--mc-accent-soft); }
    50% { box-shadow: 0 0 0 6px var(--mc-accent-soft); }
}

@keyframes mc-pulse-ring {
    0% {
        box-shadow: 0 0 0 0 currentColor;
        opacity: 0.45;
    }
    70% {
        box-shadow: 0 0 0 6px currentColor;
        opacity: 0;
    }
    100% {
        box-shadow: 0 0 0 0 currentColor;
        opacity: 0;
    }
}

@keyframes mc-dot-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.35); opacity: 0.55; }
}

@keyframes mc-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes mc-rotate {
    from { transform: rotate(0); }
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Icon stroke homologation
   The icon-thinner script swaps <i class="ti ti-X"> → inline SVG with the
   `ti-svg` class. From there CSS owns the rendering. Default: 1.5 px stroke.
   ========================================================================== */

.ti-svg {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
    overflow: visible;
}

/* Stroke-width must target descendants too because Tabler/Iconify wraps paths
   in <g stroke-width="2"> — a presentation attribute that would otherwise win
   over the SVG-level CSS via inheritance. */
.ti-svg,
.ti-svg * {
    stroke-width: var(--mc-icon-stroke);
}

/* Before the swap happens (and as a fallback if Iconify fails to load) the
   webfont icons still render via `.ti`. Keep them legible. */
i.ti {
    line-height: 1;
}

/* Reduced motion — turn off all decorative animation */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
