/**
 * Login — no page scroll; centered card (mobile) / right panel (desktop)
 * Always dark (ignores system light mode and saved v3-theme preference).
 */

html:has(body.auth-login-page),
html.auth-login-html {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    color-scheme: dark;
}

.auth-login-page,
html.dark-theme body.auth-login-page,
html:not(.dark-theme) body.auth-login-page {
    margin: 0;
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
    font-family: 'Roboto', system-ui, sans-serif;
    color: #f8fafc !important;
    background: #020617 !important;
    color-scheme: dark;
}

.auth-login-page *,
.auth-login-page *::before,
.auth-login-page *::after {
    box-sizing: border-box;
}

.auth-login-scene {
    position: relative;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
}

/* Background */
.auth-login-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.auth-login-bg-img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: cover;
    object-position: center 35%;
}

.auth-login-scrim {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(2, 6, 23, 0.2) 0%, rgba(2, 6, 23, 0.45) 55%, rgba(2, 6, 23, 0.88) 100%),
        linear-gradient(180deg, rgba(2, 6, 23, 0.35) 0%, rgba(2, 6, 23, 0.65) 100%);
}

/* Shell */
.auth-login-shell {
    position: relative;
    z-index: 2;
    height: 100dvh;
    max-height: 100dvh;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.auth-login-main {
    min-width: 0;
    overflow: hidden;
}

.auth-login-glass {
    width: 100%;
    min-width: 0;
    max-height: calc(100dvh - 2rem - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 1.25rem 1.15rem 1.15rem;
    border-radius: 1rem;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(18px) saturate(1.2);
    -webkit-backdrop-filter: blur(18px) saturate(1.2);
    color-scheme: dark;
}

/* Mobile: lock scroll + centered card */
@media (max-width: 1023px) {
    html:has(body.auth-login-page),
    body.auth-login-page {
        position: fixed;
        inset: 0;
        width: 100%;
        overflow: hidden;
    }

    .auth-login-scene {
        position: fixed;
        inset: 0;
        width: 100%;
        max-width: 100%;
        height: 100dvh;
        overflow: hidden;
    }

    .auth-login-shell {
        position: absolute;
        inset: 0;
        display: grid;
        place-items: center;
        padding:
            max(1rem, env(safe-area-inset-top))
            max(1rem, env(safe-area-inset-right))
            max(1rem, env(safe-area-inset-bottom))
            max(1rem, env(safe-area-inset-left));
    }

    .auth-login-main {
        width: min(22rem, calc(100vw - 2rem - env(safe-area-inset-left) - env(safe-area-inset-right)));
        max-height: 100%;
        margin: 0;
        justify-self: center;
    }

    .auth-login-glass {
        box-shadow: 0 10px 32px rgba(0, 0, 0, 0.38);
    }
}

/* Header: logo + lang */
.auth-login-head {
    margin-bottom: 1.25rem;
    text-align: center;
}

.auth-login-title,
.auth-login-subtitle {
    text-align: center;
}

.auth-login-brand-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    min-width: 0;
}

.auth-login-logo {
    display: block;
    height: 2rem;
    width: auto;
    max-width: calc(100% - 4.5rem);
    object-fit: contain;
    object-position: center left;
    flex: 1 1 auto;
    min-width: 0;
}

.auth-login-lang {
    flex-shrink: 0;
    display: inline-flex;
    gap: 0.15rem;
    padding: 0.15rem;
    border-radius: 9999px;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-login-lang a {
    padding: 0.28rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.auth-login-lang-on {
    background: rgba(166, 255, 0, 0.22);
    color: #d9f99d;
}

.auth-login-lang-off {
    color: rgba(255, 255, 255, 0.55);
}

.auth-login-lang-off:hover {
    color: #fff;
}

.auth-login-title {
    margin: 0;
    font-size: 1.375rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: #fff;
}

.auth-login-subtitle {
    margin: 0.4rem 0 0;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.58);
}

/* Form */
.auth-login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-login-field {
    margin: 0;
}

.auth-login-field > label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.82);
    margin-bottom: 0.35rem;
}

.auth-login-field-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.35rem 0.5rem;
    margin-bottom: 0.35rem;
}

.auth-login-field-row label {
    margin-bottom: 0;
}

.auth-login-input-wrap {
    position: relative;
    min-width: 0;
    width: 100%;
}

.auth-login-input-wrap > i {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    color: rgba(166, 255, 0, 0.55);
    pointer-events: none;
}

.auth-login-input {
    display: block;
    width: 100%;
    max-width: 100%;
    padding: 0.7rem 2.4rem 0.7rem 2.15rem;
    border-radius: 0.65rem;
    font-size: 1rem;
    line-height: 1.25;
    color: #f8fafc;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.14);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-login-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.auth-login-input:focus {
    border-color: rgba(166, 255, 0, 0.5);
    box-shadow: 0 0 0 2px rgba(166, 255, 0, 0.12);
}

.auth-login-input:-webkit-autofill,
.auth-login-input:-webkit-autofill:hover,
.auth-login-input:-webkit-autofill:focus {
    -webkit-text-fill-color: #f8fafc;
    caret-color: #f8fafc;
    box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.35) inset;
    border-color: rgba(255, 255, 255, 0.14);
    transition: background-color 99999s ease-out 0s;
}

.auth-login-input--password {
    padding-right: 2.5rem;
}

.auth-login-pw-toggle {
    position: absolute;
    right: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.2rem;
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    font-size: 0.8rem;
}

.auth-login-pw-toggle:hover {
    color: rgba(255, 255, 255, 0.85);
}

.auth-login-submit {
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.8rem 1rem;
    border: none;
    border-radius: 0.65rem;
    font-size: 0.875rem;
    font-weight: 800;
    cursor: pointer;
    color: #0f172a;
    background: linear-gradient(180deg, #b8f032 0%, #a6ff00 100%);
    box-shadow: 0 6px 18px rgba(166, 255, 0, 0.28);
    transition: transform 0.15s, box-shadow 0.15s;
}

@media (hover: hover) {
    .auth-login-submit:hover {
        transform: translateY(-1px);
        box-shadow: 0 8px 22px rgba(166, 255, 0, 0.34);
    }
}

.auth-login-muted {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.45);
    text-decoration: none;
    flex-shrink: 0;
}

.auth-login-muted:hover {
    color: rgba(255, 255, 255, 0.85);
}

.auth-login-error {
    font-size: 0.6875rem;
    color: #fca5a5;
    margin: 0.3rem 0 0;
}

.auth-login-error-box {
    margin-top: 1rem;
    padding: 0.7rem 0.8rem;
    border-radius: 0.65rem;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(248, 113, 113, 0.3);
}

.auth-login-error-box p {
    font-size: 0.75rem;
    color: #fecaca;
    margin: 0.2rem 0;
}

.auth-login-foot {
    margin-top: 1.25rem;
    padding-top: 1.15rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.auth-login-foot-register {
    margin: 0 0 0.75rem;
    font-size: 0.75rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.52);
}

.auth-login-link {
    color: #c4f542;
    font-weight: 700;
    text-decoration: none;
}

.auth-login-link:hover {
    text-decoration: underline;
}

.auth-login-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.45);
    text-decoration: none;
}

.auth-login-back:hover {
    color: #fff;
}

/* Desktop: right panel, no page scroll */
@media (min-width: 1024px) {
    html:has(body.auth-login-page),
    body.auth-login-page {
        position: relative;
        inset: auto;
    }

    .auth-login-scene {
        position: relative;
        inset: auto;
        height: 100dvh;
    }

    .auth-login-scrim {
        background:
            linear-gradient(90deg, rgba(2, 6, 23, 0.1) 0%, rgba(2, 6, 23, 0.25) 50%, rgba(2, 6, 23, 0.94) 68%, rgba(2, 6, 23, 0.98) 100%);
    }

    .auth-login-shell {
        position: relative;
        inset: auto;
        display: flex;
        flex-direction: row;
        justify-content: flex-end;
        align-items: stretch;
        padding: 0;
        height: 100dvh;
    }

    .auth-login-main {
        flex: 0 0 26rem;
        width: 26rem;
        max-width: 26rem;
        min-width: 26rem;
        margin: 0;
        max-height: 100dvh;
        height: 100dvh;
        justify-self: auto;
    }

    .auth-login-glass {
        height: 100%;
        max-height: 100dvh;
        border-radius: 0;
        border: none;
        border-left: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: -8px 0 40px rgba(0, 0, 0, 0.35);
        padding: clamp(1.5rem, 3vh, 2.5rem) clamp(1.5rem, 2.5vw, 2.25rem);
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .auth-login-head {
        margin-bottom: 1.5rem;
        text-align: left;
    }

    .auth-login-title,
    .auth-login-subtitle {
        text-align: left;
    }

    .auth-login-brand-row {
        margin-bottom: 1.15rem;
    }

    .auth-login-logo {
        height: 2.25rem;
        max-width: 12rem;
    }

    .auth-login-title {
        font-size: 1.5rem;
    }

    .auth-login-subtitle {
        font-size: 0.875rem;
    }

    .auth-login-form {
        gap: 1.1rem;
    }

    .auth-login-foot {
        margin-top: 1.5rem;
        padding-top: 1.25rem;
        text-align: left;
    }

    .auth-login-back {
        justify-content: flex-start;
    }
}

@media (min-width: 1280px) {
    .auth-login-main {
        flex: 0 0 28rem;
        width: 28rem;
        max-width: 28rem;
        min-width: 28rem;
    }
}

/* Neutralize shared auth light styles when login forces dark */
html:not(.dark-theme) body.auth-login-page,
html.dark-theme body.auth-login-page {
    background: #020617 !important;
    color: #f8fafc !important;
}

html:not(.dark-theme) body.auth-login-page .auth-login-glass,
html.dark-theme body.auth-login-page .auth-login-glass {
    background: rgba(15, 23, 42, 0.72);
    border-color: rgba(255, 255, 255, 0.12);
    color: #f8fafc;
}

html:not(.dark-theme) body.auth-login-page .auth-login-title,
html:not(.dark-theme) body.auth-login-page .auth-login-field > label,
html:not(.dark-theme) body.auth-login-page .auth-login-input,
html:not(.dark-theme) body.auth-login-page .auth-login-foot-register {
    color: inherit;
}

html:not(.dark-theme) body.auth-login-page .auth-login-input {
    color: #f8fafc;
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.14);
}

html:not(.dark-theme) body.auth-login-page .auth-login-lang {
    background: rgba(0, 0, 0, 0.28);
    border-color: rgba(255, 255, 255, 0.1);
}
