/* ========================================
   ENBLAUCRM Site Base Styles
   ======================================== */

/* Reset básico */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: var(--font-sans, 'Ubuntu', 'Segoe UI', sans-serif);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text, #0f172a);
    background-color: var(--surface-muted, #f8fafc);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Links */
a {
    color: var(--brand-primary, #00C39E);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Focus visible para accesibilidad */
:focus-visible {
    outline: 2px solid var(--brand-primary, #00C39E);
    outline-offset: 2px;
}

/* Blazor error UI (oculto por defecto) */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* ── Overlay de reconexión del circuito Blazor (sustituye el modal por defecto) ──
   blazor.server.js alterna clases components-reconnect-* sobre #components-reconnect-modal
   (markup en Pages/_Host.cshtml). Los primeros segundos el velo es invisible: la página
   se ve tal cual (sin clicks, el circuito está caído); solo si la reconexión se alarga
   aparece una tarjeta discreta con spinner. */
#components-reconnect-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100999; /* por encima de #sw-update-banner (100000) */
    align-items: center;
    justify-content: center;
    background: rgba(248, 250, 252, 0.72);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: all;
}

#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    display: flex;
}

/* Reconectando: 4 s invisible; si se alarga, aparece con fundido suave */
#components-reconnect-modal.components-reconnect-show {
    animation: reconnect-fade-in 0.4s ease-out 4s forwards;
}

/* Fallo definitivo o circuito rechazado: visible sin retardo */
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    opacity: 1;
}

#components-reconnect-modal.components-reconnect-hide,
#components-reconnect-modal.reconnect-suppressed {
    display: none !important;
}

@keyframes reconnect-fade-in {
    to {
        opacity: 1;
    }
}

.reconnect-ui__card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--surface, #ffffff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius-sm, 8px);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    padding: 0.875rem 1.25rem;
    font-size: 0.9375rem;
    color: var(--text-secondary, #475569);
}

.reconnect-ui__spinner {
    width: 1.125rem;
    height: 1.125rem;
    flex: 0 0 auto;
    border: 2px solid var(--brand-primary-soft, rgba(0, 195, 158, 0.25));
    border-top-color: var(--brand-primary, #00C39E);
    border-radius: 50%;
    animation: reconnect-spin 0.8s linear infinite;
}

@keyframes reconnect-spin {
    to {
        transform: rotate(360deg);
    }
}

.reconnect-ui__msg {
    display: none;
}

#components-reconnect-modal.components-reconnect-show .reconnect-ui__msg--show {
    display: inline;
}

#components-reconnect-modal.components-reconnect-failed .reconnect-ui__msg--failed,
#components-reconnect-modal.components-reconnect-rejected .reconnect-ui__msg--failed {
    display: inline;
}

#components-reconnect-modal.components-reconnect-failed .reconnect-ui__spinner,
#components-reconnect-modal.components-reconnect-rejected .reconnect-ui__spinner {
    display: none;
}

.reconnect-ui__reload {
    margin-left: 0.375rem;
    font-weight: var(--font-weight-semibold, 600);
    color: var(--brand-primary, #00C39E);
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiI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