/* =========================================================
   BASE — Variables corporativas, reset y componentes comunes
   Compartido por todas las páginas.
   ========================================================= */

:root {
    /* Colores corporativos Ausolan */
    --color-amarillo: #f2bf2e;
    --color-amarillo-oscuro: #d9a80e;
    --color-oscuro: #1c1400;
    --color-oscuro-hover: #2e2000;

    /* Semánticos */
    --color-error: #e11d48;
    --color-exito: #059669;
    --color-exito-oscuro: #047857;

    /* Fondos y superficies */
    --color-fondo: #f2bf2e;
    --color-blanco: #FFFFFF;
    --color-negro: #000000;

    /* Colores de texto */
    --color-texto-primario: #222222;
    --color-texto-secundario: #555555;
    --color-texto-muted: #6B7280;

    /* Bordes y divisores */
    --color-border: #e5e7eb;

    /* Espaciado y forma */
    --radio-sm: 8px;
    --radio-md: 12px;
    --radio-lg: 16px;
    --radio-xl: 24px;
    --sombra-card: 0 2px 8px rgba(0, 0, 0, 0.07);
    --sombra-elevada: 0 12px 40px rgba(28, 20, 0, 0.12);
    --sombra-header: 0 2px 12px rgba(0, 0, 0, 0.18);

    /* Tipografía */
    --fuente-principal: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

    /* Transiciones */
    --transicion: 0.2s ease;

    /* Alturas fijas */
    --altura-topbar: 64px;
}


/* ─── RESET ───────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

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

body {
    min-height: 100vh;
    min-height: 100dvh;
    font-family: var(--fuente-principal);
    color: var(--color-texto-primario);
    background: var(--color-fondo);
    line-height: 1.5;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    display: block;
    max-width: 100%;
}

button {
    font: inherit;
    color: inherit;
    border: none;
    background: none;
    cursor: pointer;
}

input,
select {
    font: inherit;
    color: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}


/* ─── BARRA SUPERIOR (compartida) ─────────────────────────── */
.topbar {
    height: calc(var(--altura-topbar) + env(safe-area-inset-top, 0px));
    padding-top: env(safe-area-inset-top, 0px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-left: max(24px, env(safe-area-inset-left));
    padding-right: max(24px, env(safe-area-inset-right));
    background: var(--color-blanco);
    box-shadow: var(--sombra-header);
    position: sticky;
    top: 0;
    z-index: 20;
    flex-shrink: 0;
}

.topbar__logo {
    height: 26px;
    width: auto;
    user-select: none;
}

.topbar__actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar__btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 36px;
    padding: 0 14px;
    border-radius: var(--radio-sm);
    background: rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.14);
    color: rgba(28, 20, 0, 0.80);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: background var(--transicion), border-color var(--transicion), color var(--transicion);
}

.topbar__btn:hover {
    background: rgba(0, 0, 0, 0.14);
    border-color: rgba(0, 0, 0, 0.25);
    color: var(--color-oscuro);
}

.topbar__btn svg {
    width: 16px;
    height: 16px;
}

@media (max-width: 480px) {
    .topbar {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }
    .topbar__logo { height: 22px; }
    .topbar__btn span { display: none; }
    .topbar__btn { padding: 0 10px; }
}


/* ─── UTILIDADES ──────────────────────────────────────────── */
.oculto {
    display: none !important;
}


/* ─── SPINNER (compartido) ────────────────────────────────── */
.spinner {
    width: 38px;
    height: 38px;
    border: 3px solid rgba(28, 20, 0, 0.15);
    border-top-color: var(--color-oscuro);
    border-radius: 50%;
    animation: girar 0.8s linear infinite;
}

@keyframes girar {
    to { transform: rotate(360deg); }
}


/* ─── TOAST (compartido) ──────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(14px);
    z-index: 100;
    padding: 11px 18px;
    background: var(--color-oscuro);
    color: var(--color-blanco);
    border-radius: var(--radio-md);
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
    max-width: calc(100vw - 32px);
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
