@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;600;700&display=swap');

:root {
    --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --sat: env(safe-area-inset-top, 0px);
    --sab: env(safe-area-inset-bottom, 0px);
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    -webkit-tap-highlight-color: transparent;
}

/* Con el shell activo, bloquear scroll global de la ventana */
body.shell-active,
body:has(#desktop-shell:not(.hidden)) {
    overflow: hidden !important;
    height: 100vh !important;
    height: 100dvh !important;
}

#desktop-shell {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    overflow: hidden;
}

#view-container {
    height: 100%;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
}

.font-mono {
    font-family: var(--font-mono);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 9999px;
}
.dark ::-webkit-scrollbar-thumb {
    background: #334155;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Active Link en Sidebar de Escritorio */
.active-link {
    background: rgba(37, 99, 235, 0.1) !important;
    color: #2563eb !important;
    border-left: 3px solid #2563eb;
}
.dark .active-link {
    background: rgba(59, 130, 246, 0.15) !important;
    color: #60a5fa !important;
    border-left: 3px solid #3b82f6;
}

/* Signature Pad Canvas */
.signature-canvas {
    touch-action: none;
    cursor: crosshair;
}

/* Background & Card Premium para Login Responsivo (Escritorio + Móvil) */
#auth-container {
    background-image: radial-gradient(circle at 10% 20%, rgba(216, 241, 230, 0.46) 0.1%, rgba(233, 226, 226, 0.28) 90.1%), radial-gradient(circle at 90% 80%, rgba(206, 219, 243, 0.44) 0%, rgba(240, 240, 240, 0.3) 90%);
    background-attachment: fixed;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
}
.dark #auth-container {
    background-color: #030712;
    background-image: radial-gradient(circle at 10% 20%, rgba(17, 24, 39, 0.85) 0%, rgba(3, 7, 18, 1) 90%), radial-gradient(circle at 90% 80%, rgba(15, 23, 42, 0.85) 0%, rgba(3, 7, 18, 1) 90%);
}

.auth-card-premium {
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.05), 0 0 50px 0 rgba(37, 99, 235, 0.05);
}
.dark .auth-card-premium {
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.7), 0 0 50px 0 rgba(37, 99, 235, 0.08);
}

/* Modal Transitions */
.modal-backdrop {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: opacity 0.25s ease-out;
}

/* Scanner Laser Animation */
@keyframes scanner-laser {
    0% { top: 10%; opacity: 0.8; }
    50% { top: 85%; opacity: 1; }
    100% { top: 10%; opacity: 0.8; }
}

.laser-line {
    animation: scanner-laser 2s infinite ease-in-out;
}

#mobile-bottom-nav {
    padding-bottom: max(8px, var(--sab));
}

/* Prevenir auto-zoom molesto en inputs en Safari iOS */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* PIN Keypad (Kiosko Asistencia & Seguridad) */
.passcode-dot {
    width: 16px;
    height: 16px;
    border: 2px solid #2563eb;
    border-radius: 50%;
    transition: all 0.2s ease;
}
.passcode-dot.active {
    background-color: #2563eb;
    box-shadow: 0 0 12px rgba(37, 99, 235, 0.6);
}
.keypad-btn {
    width: 68px;
    height: 68px;
    font-size: 22px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #1e293b;
    transition: all 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
}
.dark .keypad-btn {
    background-color: #1e293b;
    border-color: #334155;
    color: #f8fafc;
}
.keypad-btn:active {
    transform: scale(0.92);
    background-color: #e2e8f0;
}
.dark .keypad-btn:active {
    background-color: #334155;
}
.shake {
    animation: shake 0.4s ease-in-out;
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-10px); }
    40%, 80% { transform: translateX(10px); }
}



/* ===== Zona segura inferior (barra de gestos / navegación del sistema) =====
   Con viewport-fit=cover el contenido llega hasta el borde: la barra inferior y el área
   de contenido deben reservar ese espacio o quedan tapados por la barra del sistema. */
#mobile-bottom-nav {
    padding-bottom: calc(0.375rem + env(safe-area-inset-bottom, 0px));
}
@media (max-width: 1023px) {
    #view-container {
        padding-bottom: calc(6rem + env(safe-area-inset-bottom, 0px));
    }
}
