/* =============================================================================
 * TechnoSense-Wx — base.css
 * -----------------------------------------------------------------------------
 * Reset moderno + estilos base de elementos (body, tipografía, inputs, botones).
 * Depende de theme.css (usa sus variables).
 *
 * Orden de carga: theme.css → base.css → components.css → módulo.
 * ============================================================================= */

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-body);
    font-size: var(--fs-base);
    line-height: 1.55;
    color: var(--ink);
    background: var(--paper);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- Tipografía base ---- */
h1, h2, h3, h4 {
    font-family: var(--font-display);
    color: var(--sky-900);
    line-height: 1.2;
    font-weight: var(--fw-bold);
}
h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }

p { color: var(--ink-soft); }

a {
    color: var(--sky-600);
    text-decoration: none;
    transition: color var(--t-fast);
}
a:hover { color: var(--sky-900); }

/* Números y datos: tipografía tabular para alineación */
.data, .num {
    font-family: var(--font-data);
    font-variant-numeric: tabular-nums;
}

/* ---- Formularios ---- */
label {
    display: block;
    font-size: var(--fs-sm);
    color: var(--ink-soft);
    font-weight: var(--fw-medium);
    margin-bottom: var(--sp-2);
}

input, select, textarea {
    width: 100%;
    padding: 0.7rem 0.9rem;
    font-family: var(--font-body);
    font-size: var(--fs-base);
    color: var(--ink);
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--sky-600);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

/* ---- Botones ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: 0.7rem 1.25rem;
    font-family: var(--font-body);
    font-size: var(--fs-base);
    font-weight: var(--fw-bold);
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.btn:active { transform: translateY(1px); }

/* Botón primario: acción solar */
.btn-primary {
    background: var(--solar-500);
    color: var(--white);
}
.btn-primary:hover { background: var(--solar-600); }

/* Botón secundario: contorno azul */
.btn-secondary {
    background: var(--white);
    color: var(--sky-700);
    border-color: var(--line);
}
.btn-secondary:hover { border-color: var(--sky-600); color: var(--sky-900); }

.btn-block { width: 100%; }

/* ---- Accesibilidad ---- */
:focus-visible { outline: 2px solid var(--sky-600); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── Transición suave al cambiar tema ────────────────────────────────────── */
/* Solo se activa cuando el JS agrega esta clase temporalmente al cambiar */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
    transition:
        background-color 0.25s ease,
        border-color     0.2s ease,
        color            0.2s ease,
        box-shadow       0.2s ease !important;
}

/* ══════════════════════════════════════════════════════════════════════════════
 * TEMA OSCURO — base elements
 * ══════════════════════════════════════════════════════════════════════════════ */

[data-theme="dark"] body {
    background: var(--paper);
    color: var(--ink);
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4 { color: var(--sky-900); }

[data-theme="dark"] p { color: var(--ink-soft); }

[data-theme="dark"] a { color: var(--sky-600); }
[data-theme="dark"] a:hover { color: var(--sky-700); }

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: var(--surface-3);
    border-color: var(--line);
    color: var(--ink);
}
[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
    border-color: var(--sky-600);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

[data-theme="dark"] .btn-secondary {
    background: var(--surface-3);
    color: var(--sky-700);
    border-color: var(--line);
}
[data-theme="dark"] .btn-secondary:hover {
    border-color: var(--sky-600);
    color: var(--sky-900);
}