/* ========================================
   VARIABLES GLOBALES
   ======================================== */
:root {
    /* === COLORES PRINCIPALES === */
    --primary-color: #1a3a6b;
    --secondary-color: #2563eb;
    --tertiary-color: #f87171;
    /* === COLORES DE FONDO === */
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --bg-gray: #f1f5f9;
    /* === COLORES DE TEXTO === */
    --text-dark: #1f2937;
    --text-light: #ffffff;
    --text-muted: #6b7280;
    /* === COLORES DE ESTADO === */
    --color-success: #22c55e;
    --color-danger: #ef4444;
    --color-warning: #f59e0b;
    --color-info: #3b82f6;
    /* === TIPOGRAFÍA === */
    --font-family: 'Segoe UI', 'Segoe UI', sans-serif;
    --font-size-base: 12px;
}

/* ========================================
   🦾 SCROLL GLOBAL — HEFESTO 13.1 PRO MAX
   ======================================== */

/* Reset de html/body para permitir scroll raíz SIEMPRE */
html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Contenedor raíz de Blazor — se estira y permite scroll */
#app {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Aseguramos que cualquier layout (MainLayout, EmptyLayout, etc.) no bloquee el scroll */
.empty-layout,
.main-layout,
.page,
.page-scroll {
    width: 100%;
    min-height: 100vh;
}

/* Tipografía y colores base */
body {
    font-family: var(--font-family, 'Segoe UI', sans-serif);
    font-size: var(--font-size-base, 12px);
    color: var(--text-dark, #1f2937);
    background: var(--bg-light, #f8fafc);
    line-height: 1.5;
}

    /* Scrollbar custom sutil */
    html::-webkit-scrollbar,
    body::-webkit-scrollbar {
        width: 10px;
        height: 10px;
    }

    html::-webkit-scrollbar-track,
    body::-webkit-scrollbar-track {
        background: #f1f5f9;
    }

    html::-webkit-scrollbar-thumb,
    body::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 999px;
        border: 2px solid #f1f5f9;
    }

        html::-webkit-scrollbar-thumb:hover,
        body::-webkit-scrollbar-thumb:hover {
            background: #94a3b8;
        }

/* Firefox */
html,
body {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

    /* Cuando un modal está abierto, evitamos doble scroll fantasma */
    body.modal-open {
        overflow: hidden;
    }

/* Móvil: usamos dvh para manejar bien la barra de URL */
@media (max-width: 768px) {
    html,
    body,
    #app {
        min-height: 100dvh;
    }

    .empty-layout,
    .main-layout,
    .page,
    .page-scroll {
        min-height: 100dvh;
    }
}

/* ========================================
   BLAZOR ERROR UI - ESTILOS MEJORADOS
   ======================================== */
#blazor-error-ui {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    padding: 24px 32px;
    min-width: 320px;
    max-width: 480px;
    border-left: 6px solid #ef4444;
    animation: errorSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: none;
}

@keyframes errorSlideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

#blazor-error-ui .error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
}

    #blazor-error-ui .error-container i {
        font-size: 2.4rem;
        color: #ef4444;
        animation: errorPulse 1.5s ease-in-out infinite;
    }

@keyframes errorPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
    }
}

#blazor-error-ui .error-container h4 {
    margin: 0;
    font-size: 1rem;
    color: #1f2937;
    font-weight: 700;
}

#blazor-error-ui .error-container p {
    margin: 0;
    font-size: 0.85rem;
    color: #6b7280;
}

#blazor-error-ui .error-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

#blazor-error-ui .btn-error-reload {
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    background: #2563eb;
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

    #blazor-error-ui .btn-error-reload:hover {
        background: #1d4ed8;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    }

#blazor-error-ui .btn-error-close {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    background: #f1f5f9;
    color: #6b7280;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

    #blazor-error-ui .btn-error-close:hover {
        background: #e2e8f0;
        color: #1f2937;
    }

/* ========================================
   RESPONSIVE ERROR UI
   ======================================== */
@media (max-width: 768px) {
    #blazor-error-ui {
        min-width: auto;
        width: calc(100% - 32px);
        padding: 18px 20px;
        bottom: 16px;
    }

        #blazor-error-ui .error-container i {
            font-size: 1.8rem;
        }

        #blazor-error-ui .error-container h4 {
            font-size: 0.9rem;
        }

        #blazor-error-ui .error-container p {
            font-size: 0.75rem;
        }

        #blazor-error-ui .error-actions {
            flex-wrap: wrap;
            justify-content: center;
        }
}

@media (max-width: 480px) {
    #blazor-error-ui {
        padding: 14px 16px;
        width: calc(100% - 16px);
        bottom: 8px;
        border-left-width: 4px;
    }
}

/* ============================================================
   🦾 HEFESTO 13.1 PRO MAX — SPLASH SCREEN PWA
   ============================================================ */

.app-splash {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    transition: opacity 0.4s ease;
}

.app-splash-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
}

.app-splash-icon {
    font-size: 72px;
    background: linear-gradient(135deg, #2563eb, #7c3aed, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: splashIcon 2s ease-in-out infinite;
    filter: drop-shadow(0 8px 24px rgba(37, 99, 235, 0.4));
}

@keyframes splashIcon {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }

    50% {
        transform: scale(1.12) rotate(-5deg);
    }
}

.app-splash-title {
    font-size: 32px;
    font-weight: 800;
    color: #ffffff;
    margin: 0;
    letter-spacing: -0.5px;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

.app-splash-subtitle {
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    letter-spacing: 4px;
    text-transform: uppercase;
    margin: 0;
}

.app-splash-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid #2563eb;
    border-right: 4px solid #7c3aed;
    border-radius: 50%;
    animation: splashSpin 1s linear infinite;
    margin-top: 12px;
}

@keyframes splashSpin {
    to {
        transform: rotate(360deg);
    }
}