/* Screen lock (app-lock.js). Shared by the SPA and the letter pages. */

/* While locked nothing of the page is rendered — not merely blurred — so no data shows through. */
html.oa-locked body > *:not(.oa-lock) {
    visibility: hidden !important;
}

html.oa-locked,
html.oa-locked body {
    overflow: hidden !important;
}

.oa-lock {
    --oa-lock-ink: #f8fafc;
    --oa-lock-soft: rgba(248, 250, 252, 0.72);
    --oa-lock-glass: rgba(15, 23, 42, 0.55);
    --oa-lock-line: rgba(255, 255, 255, 0.14);
    --oa-lock-accent: #60a5fa;
    --oa-lock-danger: #fca5a5;
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* Never clip the top when the card is taller than the window: scroll instead. */
    justify-content: safe center;
    gap: 22px;
    padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
    color: var(--oa-lock-ink);
    font-family: inherit;
    direction: rtl;
    overflow-y: auto;
    animation: oa-lock-in 0.28s ease both;
}

.oa-lock.is-leaving { animation: oa-lock-out 0.26s ease both; }

.oa-lock-backdrop {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(circle at 18% 12%, rgba(59, 130, 246, 0.45) 0, transparent 42%),
        radial-gradient(circle at 85% 88%, rgba(124, 58, 237, 0.4) 0, transparent 45%),
        linear-gradient(160deg, #0b1226 0%, #111c3d 50%, #0a0f1f 100%);
}

.oa-lock-backdrop::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px);
    background-size: 22px 22px;
}

.oa-lock-clock { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.oa-lock-clock strong { font-size: clamp(2.6rem, 9vw, 4.2rem); font-weight: 300; letter-spacing: 1px; line-height: 1.1; }
.oa-lock-clock span { font-size: 0.95rem; color: var(--oa-lock-soft); }

.oa-lock-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: min(380px, 100%);
    padding: 28px 24px 18px;
    border-radius: 28px;
    background: var(--oa-lock-glass);
    border: 1px solid var(--oa-lock-line);
    box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(22px) saturate(1.3);
    -webkit-backdrop-filter: blur(22px) saturate(1.3);
    text-align: center;
}

.oa-lock-card.is-shaking { animation: oa-lock-shake 0.42s ease; }
.oa-lock-card.is-busy { opacity: 0.75; pointer-events: none; }

.oa-lock-avatar {
    position: relative;
    display: grid;
    place-items: center;
    width: 84px;
    height: 84px;
    margin-bottom: 14px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #7c3aed);
    font-size: 2rem;
    font-weight: 800;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.08);
}

.oa-lock-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }

.oa-lock-badge {
    position: absolute;
    bottom: -2px;
    inset-inline-start: -2px;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #0f172a;
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: var(--oa-lock-accent);
}

.oa-lock-badge svg { width: 15px; height: 15px; }
.oa-lock-card h2 { margin: 0; font-size: 1.2rem; font-weight: 800; color: var(--oa-lock-ink); }
.oa-lock-sub { margin: 6px 0 18px; font-size: 0.84rem; color: var(--oa-lock-soft); }

.oa-lock-dots { display: flex; justify-content: center; gap: 14px; margin-bottom: 20px; direction: ltr; }

.oa-lock-dots i {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.55);
    transition: background-color 0.12s ease, transform 0.12s ease;
}

.oa-lock-dots i.is-filled { background: var(--oa-lock-ink); border-color: var(--oa-lock-ink); transform: scale(1.08); }

.oa-lock-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.oa-lock-pad {
    display: grid;
    grid-template-columns: repeat(3, 72px);
    gap: 14px 22px;
    justify-content: center;
    direction: ltr;
}

.oa-lock-pad button {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.08);
    color: var(--oa-lock-ink);
    font-size: 1.6rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.12s ease, transform 0.08s ease;
}

.oa-lock-pad button:hover { background: rgba(255, 255, 255, 0.16); }
.oa-lock-pad button:active { transform: scale(0.94); background: rgba(255, 255, 255, 0.26); }
.oa-lock-pad button:focus-visible { outline: 2px solid var(--oa-lock-accent); outline-offset: 2px; }
.oa-lock-pad button.is-icon { background: transparent; border-color: transparent; }
.oa-lock-pad button svg { width: 26px; height: 26px; }

.oa-lock-field {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 5px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.oa-lock-field:focus-within { border-color: var(--oa-lock-accent); box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.25); }

.oa-lock-field input {
    flex: 1;
    min-width: 0;
    height: 44px;
    padding: 0 12px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--oa-lock-ink);
    font-size: 1rem;
    font-family: inherit;
}

.oa-lock-field input::placeholder { color: rgba(248, 250, 252, 0.5); }

.oa-lock-eye,
.oa-lock-go {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--oa-lock-soft);
    cursor: pointer;
}

.oa-lock-go { background: #3b82f6; color: #fff; }
.oa-lock-go:hover { background: #2563eb; }
.oa-lock-eye svg, .oa-lock-go svg { width: 20px; height: 20px; }

.oa-lock-error { min-height: 1.6em; margin-top: 14px; font-size: 0.82rem; font-weight: 700; color: var(--oa-lock-danger); }
.oa-lock-card.is-blocked .oa-lock-pad,
.oa-lock-card.is-blocked .oa-lock-field { opacity: 0.4; pointer-events: none; }

.oa-lock-foot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-top: 6px;
    padding-top: 14px;
    border-top: 1px solid var(--oa-lock-line);
}

.oa-lock-foot details { width: 100%; font-size: 0.8rem; color: var(--oa-lock-soft); }
.oa-lock-foot summary { cursor: pointer; color: var(--oa-lock-accent); font-weight: 700; list-style: none; }
.oa-lock-foot summary::-webkit-details-marker { display: none; }
.oa-lock-foot details p { margin: 8px 0 0; line-height: 1.9; }

.oa-lock-exit {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--oa-lock-soft);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
}

.oa-lock-exit:hover { color: var(--oa-lock-ink); background: rgba(255, 255, 255, 0.08); }
.oa-lock-exit svg { width: 16px; height: 16px; }

/* header button beside the notification bell */
.oa-lock-launcher {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--oa-line, #e2e8f0);
    background: var(--oa-surface, #fff);
    color: var(--oa-ink-soft, #475569);
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.oa-lock-launcher:hover { color: var(--oa-brand, #2563eb); border-color: var(--oa-brand, #2563eb); }
.oa-lock-launcher svg { width: 18px; height: 18px; }

@keyframes oa-lock-in { from { opacity: 0; transform: scale(1.02); } to { opacity: 1; transform: none; } }
@keyframes oa-lock-out { to { opacity: 0; transform: scale(1.03); } }
@keyframes oa-lock-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(9px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(4px); }
}

@media (max-height: 820px) {
    .oa-lock-clock strong { font-size: 2.2rem; }
}

@media (max-height: 700px) {
    .oa-lock-clock { display: none; }
    .oa-lock-pad { grid-template-columns: repeat(3, 62px); gap: 10px 18px; }
    .oa-lock-pad button { width: 62px; height: 62px; }
}

@media (prefers-reduced-motion: reduce) {
    .oa-lock, .oa-lock.is-leaving, .oa-lock-card.is-shaking { animation: none; }
}
