/* Central SSO login screen; kept separate from the document app styles. */
* { -webkit-tap-highlight-color: transparent; }

body.login-pending .app,
body.login-active .app { display: none; }

.login-screen {
    position: fixed;
    inset: 0;
    z-index: 3000;
    overflow: hidden;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 90px;
    min-height: 100vh;
    min-height: 100dvh;
    padding: max(24px, env(safe-area-inset-top)) 22px max(24px, env(safe-area-inset-bottom));
    background: #0a0a18;
    color: #fff;
    font-family: "Vazirmatn", -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, sans-serif;
    -webkit-user-select: none;
    user-select: none;
}

body.login-active .login-screen { display: flex; }

.login-screen::before {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 0;
    width: 600px;
    height: 600px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(124,58,237,.10) 0%, transparent 65%);
    content: "";
    pointer-events: none;
}

.title-wrap { position: relative; z-index: 2; text-align: center; animation: titleFadeIn 1.2s ease-out both; }
@keyframes titleFadeIn { from { opacity: 0; transform: translateY(-16px); } to { opacity: 1; transform: translateY(0); } }

.title {
    margin: 0;
    background: linear-gradient(90deg, #c4b5fd, #67e8f9, #a78bfa, #22d3ee, #c4b5fd);
    background-size: 300% 100%;
    color: transparent;
    font-size: 34px;
    font-weight: 700;
    letter-spacing: 1px;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 6s linear infinite;
    filter: drop-shadow(0 0 22px rgba(139,92,246,.35));
}
@keyframes gradientShift { 0% { background-position: 0% 50%; } 100% { background-position: 300% 50%; } }

.subtitle {
    margin: 12px 0 0;
    color: #6b6b85;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 4px;
    text-transform: uppercase;
    animation: subtitlePulse 3s ease-in-out infinite;
}
@keyframes subtitlePulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

.title-line {
    width: 60px;
    height: 2px;
    margin: 18px auto 0;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, #8b5cf6, #06b6d4, transparent);
    animation: lineGrow 1.6s ease-out .4s both;
}
@keyframes lineGrow { from { width: 0; opacity: 0; } to { width: 60px; opacity: 1; } }

.loader-wrap {
    position: relative;
    z-index: 2;
    width: 140px;
    height: 140px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
    transition: transform .3s ease;
    animation: orbFadeIn 1.2s ease-out .25s both;
}
.loader-wrap:focus-visible { outline: 3px solid rgba(196,181,253,.85); outline-offset: 10px; }
@keyframes orbFadeIn { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: scale(1); } }
.loader-wrap:hover { transform: scale(1.06); }
.loader-wrap:active { transform: scale(.96); }

.loader {
    position: absolute;
    inset: 0;
    display: block;
    border-radius: 50%;
    background: linear-gradient(45deg, #7c3aed, #06b6d4, #8b5cf6);
    animation: rotate 2s linear infinite;
    box-shadow: 0 0 40px rgba(124,58,237,.5), 0 0 80px rgba(6,182,212,.25);
}
@keyframes rotate { to { transform: rotate(360deg); } }
.loader > span { position: absolute; inset: 0; border-radius: 50%; background: linear-gradient(45deg, #8b5cf6, #ec4899, #06b6d4, #7c3aed); }
.loader > span:nth-child(1) { opacity: .9; filter: blur(8px); }
.loader > span:nth-child(2) { opacity: .7; filter: blur(16px); }
.loader > span:nth-child(3) { opacity: .5; filter: blur(28px); }

.inner {
    position: absolute;
    inset: 12px;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 45%, #1a1030 0%, #0a0a18 70%);
    box-shadow: inset 0 0 20px rgba(0,0,0,.8);
    transition: background .3s ease;
}
.loader-wrap:hover .inner { background: radial-gradient(circle at 50% 45%, #241542 0%, #0a0a18 70%); }
.lock-icon { width: 34px; height: 34px; color: #c4b5fd; filter: drop-shadow(0 0 8px rgba(139,92,246,.8)); transition: all .3s ease; pointer-events: none; }
.loader-wrap:hover .lock-icon { transform: scale(1.1); color: #fff; filter: drop-shadow(0 0 14px rgba(139,92,246,1)); }
.loader-wrap.unlocked .lock-icon { color: #67e8f9; filter: drop-shadow(0 0 16px rgba(6,182,212,1)); }

.hint {
    position: absolute;
    top: calc(100% + 28px);
    left: 50%;
    transform: translateX(-50%);
    color: #8b8ba7;
    font-size: 13px;
    letter-spacing: 1.5px;
    white-space: nowrap;
    opacity: .9;
    transition: color .3s ease;
    pointer-events: none;
    direction: ltr;
}
.loader-wrap:hover .hint { color: #c4b5fd; }
.caret { display: inline-block; margin-left: 2px; color: #8b5cf6; font-weight: 300; animation: blink .9s steps(2,start) infinite; }
@keyframes blink { to { visibility: hidden; } }
.hint.rtl { direction: rtl; }
.hint.rtl .caret { margin-right: 2px; margin-left: 0; }

.login-error {
    position: relative;
    z-index: 2;
    margin-top: 8px;
    padding: 0 22px;
    color: #ff8a80;
    font-size: .76rem;
    line-height: 1.8;
    text-align: center;
}
.login-error[hidden] { display: none; }

@media (max-height: 560px) {
    .login-screen { gap: 56px; }
    .loader-wrap { width: 112px; height: 112px; }
}
@media (prefers-reduced-motion: reduce) {
    .login-screen *, .login-screen *::before, .login-screen *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
