/* Routario - Biometric & PIN App Lock Styles */

.routario-app-lock-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483647; /* Topmost layer */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 1.5rem 1rem;
    background: rgba(15, 23, 42, 0.97);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #f8fafc;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.28s ease, visibility 0.28s ease;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
}

[data-theme="light"] .routario-app-lock-overlay {
    background: rgba(248, 250, 252, 0.97);
    color: #0f172a;
}

.routario-app-lock-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.routario-app-lock-card {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 2.25rem 2rem;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.05);
    animation: routarioLockCardIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    margin: auto; /* Centers horizontally and vertically when space permits, allows natural scrolling when screen is small */
    flex-shrink: 0;
    box-sizing: border-box;
    transition: all 0.25s ease;
}

[data-theme="light"] .routario-app-lock-card {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

@keyframes routarioLockCardIn {
    from {
        transform: scale(0.95) translateY(8px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.routario-app-lock-logo {
    width: 68px;
    height: 68px;
    margin: 0 auto 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    background: rgba(59, 130, 246, 0.12);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.15);
}

.routario-app-lock-logo img {
    width: 46px;
    height: 46px;
    object-fit: contain;
}

.routario-app-lock-title {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0 0 0.3rem;
}

.routario-app-lock-subtitle {
    font-size: 0.88rem;
    color: #94a3b8;
    margin: 0 0 1.25rem;
}

[data-theme="light"] .routario-app-lock-subtitle {
    color: #64748b;
}

.routario-app-lock-user {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.9rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    font-size: 0.82rem;
    color: #cbd5e1;
    margin-bottom: 1.5rem;
}

[data-theme="light"] .routario-app-lock-user {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.06);
    color: #475569;
}

/* Biometric View */
.routario-app-lock-sensor-wrap {
    position: relative;
    margin: 1.25rem auto 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.routario-app-lock-sensor-btn {
    position: relative;
    width: 88px;
    height: 88px;
    border-radius: 50%;
    border: 2px solid rgba(59, 130, 246, 0.45);
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    font-size: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    outline: none;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 8px 24px -4px rgba(59, 130, 246, 0.25);
}

.routario-app-lock-sensor-btn:hover {
    transform: scale(1.06);
    background: rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
    box-shadow: 0 12px 30px -4px rgba(59, 130, 246, 0.35);
}

.routario-app-lock-sensor-btn:active {
    transform: scale(0.95);
}

.routario-app-lock-sensor-btn.loading {
    border-color: #f59e0b;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.12);
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.25);
}

.routario-app-lock-sensor-btn.success {
    border-color: #10b981;
    color: #10b981;
    background: rgba(16, 185, 129, 0.18);
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.35);
}

.routario-app-lock-pulse {
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 2px solid rgba(59, 130, 246, 0.35);
    animation: routarioSensorPulse 2.4s infinite cubic-bezier(0.25, 1, 0.5, 1);
    pointer-events: none;
}

@keyframes routarioSensorPulse {
    0% {
        transform: scale(0.9);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

.routario-app-lock-prompt {
    margin-top: 1rem;
    font-size: 0.88rem;
    font-weight: 500;
    color: #94a3b8;
    min-height: 1.25rem;
}

[data-theme="light"] .routario-app-lock-prompt {
    color: #64748b;
}

/* PIN View */
.routario-app-lock-pin-box {
    margin: 1.25rem 0 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.routario-app-lock-pin-input {
    width: 100%;
    max-width: 260px;
    height: 52px;
    font-size: 1.8rem;
    letter-spacing: 0.5rem;
    text-align: center;
    border-radius: 14px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.25);
    color: #f8fafc;
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
    font-family: inherit;
}

[data-theme="light"] .routario-app-lock-pin-input {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.15);
    color: #0f172a;
}

.routario-app-lock-pin-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.routario-app-lock-pin-submit {
    width: 100%;
    max-width: 260px;
    margin-top: 0.85rem;
    height: 44px;
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
}

/* Shake animation for errors */
@keyframes routarioShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

.routario-shake {
    animation: routarioShake 0.4s ease-in-out;
}

.routario-app-lock-error {
    margin: 0.75rem 0 1.25rem;
    padding: 0.65rem 0.9rem;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 10px;
    color: #ef4444;
    font-size: 0.82rem;
    line-height: 1.4;
    text-align: center;
}

.routario-app-lock-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .routario-app-lock-actions {
    border-top-color: rgba(0, 0, 0, 0.08);
}

.routario-app-lock-actions .btn {
    padding: 0.5rem 0.9rem;
    font-size: 0.84rem;
}

/* ── Dynamic Sizing / Responsiveness for Small Screens ── */

@media (max-height: 720px) {
    .routario-app-lock-overlay {
        padding: 1rem 0.75rem;
    }
    .routario-app-lock-card {
        padding: 1.35rem 1.25rem;
        border-radius: 18px;
    }
    .routario-app-lock-logo {
        width: 50px;
        height: 50px;
        margin-bottom: 0.65rem;
        border-radius: 12px;
    }
    .routario-app-lock-logo img {
        width: 32px;
        height: 32px;
    }
    .routario-app-lock-title {
        font-size: 1.15rem;
        margin-bottom: 0.2rem;
    }
    .routario-app-lock-subtitle {
        font-size: 0.8rem;
        margin-bottom: 0.8rem;
    }
    .routario-app-lock-user {
        margin-bottom: 0.85rem;
        padding: 0.25rem 0.65rem;
        font-size: 0.78rem;
    }
    .routario-app-lock-sensor-wrap {
        margin: 0.85rem auto 1rem;
    }
    .routario-app-lock-sensor-btn {
        width: 70px;
        height: 70px;
        font-size: 36px;
    }
    .routario-app-lock-prompt {
        margin-top: 0.5rem;
        font-size: 0.8rem;
    }
    .routario-app-lock-pin-box {
        margin: 0.85rem 0 1rem;
    }
    .routario-app-lock-pin-input {
        height: 46px;
        font-size: 1.55rem;
    }
    .routario-app-lock-pin-submit {
        height: 40px;
        font-size: 0.88rem;
    }
    .routario-app-lock-actions {
        margin-top: 0.85rem;
        padding-top: 0.85rem;
    }
}

@media (max-height: 540px) {
    .routario-app-lock-overlay {
        padding: 0.5rem;
    }
    .routario-app-lock-card {
        padding: 1rem 1rem;
    }
    .routario-app-lock-logo {
        display: none;
    }
    .routario-app-lock-user {
        display: none;
    }
    .routario-app-lock-sensor-wrap {
        margin: 0.5rem auto 0.75rem;
    }
    .routario-app-lock-sensor-btn {
        width: 58px;
        height: 58px;
        font-size: 30px;
    }
    .routario-app-lock-pin-input {
        height: 42px;
        font-size: 1.4rem;
    }
    .routario-app-lock-pin-submit {
        height: 38px;
        font-size: 0.84rem;
        margin-top: 0.5rem;
    }
    .routario-app-lock-actions {
        margin-top: 0.65rem;
        padding-top: 0.65rem;
    }
}

@media (max-width: 440px) {
    .routario-app-lock-overlay {
        padding: 1rem 0.75rem;
    }
    .routario-app-lock-card {
        padding: 1.5rem 1.15rem;
        border-radius: 20px;
    }
    .routario-app-lock-actions {
        flex-direction: row;
        gap: 0.5rem;
    }
    .routario-app-lock-actions .btn {
        flex: 1;
        padding: 0.45rem 0.5rem;
        font-size: 0.78rem;
        white-space: nowrap;
    }
}
