/*
 * Стили страницы входа /lk/login — перенос вёрстки с /office/login
 * (React + Tailwind → чистый CSS для MoonShine-страницы).
 * Тёмная тема — базовая, светлая включается по prefers-color-scheme,
 * ручная тёмная тема MoonShine (html.dark) форсит тёмную палитру.
 */

.office-auth {
    --office-bg: #08080a;
    --office-panel: rgb(17 17 20 / 80%);
    --office-fg: #fafafa;
    --office-muted: rgb(255 255 255 / 52%);
    --office-faint: rgb(255 255 255 / 35%);
    --office-border: rgb(255 255 255 / 8%);
    --office-divider: rgb(255 255 255 / 10%);
    --office-provider: rgb(255 255 255 / 3.5%);
    --office-consent-box: rgb(255 255 255 / 4%);
    --office-error-bg: rgb(248 113 113 / 7%);
    --office-error-border: rgb(248 113 113 / 15%);
    --office-error-fg: #fecaca;
    --login-brand: #b42753;
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    background: var(--office-bg);
    color: var(--office-fg);
    color-scheme: dark;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.office-auth ::selection {
    background: rgb(184 59 98 / 40%);
}

body:has([data-office-login]) {
    margin: 0;
    min-width: 20rem;
    background: #08080a;
}

.office-auth a {
    color: inherit;
    text-decoration: none;
}

/* Фон: орбы и сетка */

.office-login-backdrop {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.office-orb {
    position: absolute;
    border-radius: 50%;
}

.office-orb-primary {
    top: -13rem;
    right: -12rem;
    width: 34rem;
    height: 34rem;
    background: radial-gradient(circle, rgb(184 59 98 / 32%) 0%, rgb(184 59 98 / 0%) 68%);
    animation: office-orb-float 14s ease-in-out infinite;
}

.office-orb-secondary {
    bottom: -14rem;
    left: -13rem;
    width: 38rem;
    height: 38rem;
    background: radial-gradient(circle, rgb(102 65 181 / 22%) 0%, rgb(102 65 181 / 0%) 68%);
    animation: office-orb-float-reverse 17s ease-in-out infinite;
}

.office-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgb(255 255 255 / 1.8%) 1px, transparent 1px),
        linear-gradient(90deg, rgb(255 255 255 / 1.8%) 1px, transparent 1px);
    background-size: 54px 54px;
    -webkit-mask-image: linear-gradient(to bottom, black, transparent 82%);
    mask-image: linear-gradient(to bottom, black, transparent 82%);
}

@keyframes office-orb-float {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(-18px, 16px, 0) scale(1.04); }
}

@keyframes office-orb-float-reverse {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(22px, -14px, 0) scale(1.05); }
}

@keyframes office-spin {
    to { transform: rotate(360deg); }
}

/* Карточка-«shell» и колонки */

.office-login-container {
    position: relative;
    display: flex;
    width: 100%;
    max-width: 1260px;
    min-height: 100vh;
    min-height: 100dvh;
    align-items: center;
    margin-inline: auto;
    padding: 2rem 1.25rem;
}

.office-login-shell {
    display: grid;
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--office-border);
    border-radius: 2rem;
    background: var(--office-panel);
    box-shadow: 0 36px 110px rgb(0 0 0 / 55%);
    -webkit-backdrop-filter: blur(40px);
    backdrop-filter: blur(40px);
}

/* Левая брендовая панель (только десктоп) */

.office-login-hero {
    position: relative;
    display: none;
    flex-direction: column;
    min-height: 720px;
    overflow: hidden;
    padding: 3rem;
    border-right: 1px solid var(--office-border);
}

.office-left-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg, rgb(184 59 98 / 13%), transparent 42%, rgb(93 61 156 / 8%));
}

.office-login-hero__brand {
    position: relative;
}

.office-login-hero__brand img {
    width: 300px;
    max-width: 100%;
    height: auto;
}

.office-login-hero__brand p {
    margin: 1rem 0 0;
    font-size: 15px;
    letter-spacing: 0.01em;
}

.office-login-hero__body {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin-block: auto;
    padding-block: 3rem;
}

.office-login-hero__body > p {
    max-width: 28rem;
    margin: 1.5rem 0 0;
    font-size: 17px;
    line-height: 28px;
}

.office-login-hero__badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #d988a2;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.18em;
}

.office-login-hero__badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #d45c82;
    box-shadow: 0 0 16px #d45c82;
}

.office-login-hero__title {
    margin: 1.5rem 0 0;
    font-size: clamp(2.7rem, 4.2vw, 4.6rem);
    font-weight: 600;
    line-height: 0.98;
    letter-spacing: -0.055em;
}

.office-login-hero__features {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.office-login-hero__feature {
    padding-top: 1rem;
    border-top: 1px solid var(--office-divider);
}

.office-login-hero__feature p {
    margin: 0;
}

.office-feature-title {
    color: color-mix(in srgb, var(--office-fg) 90%, transparent);
    font-size: 14px;
    font-weight: 600;
}

.office-login-hero__feature p + p {
    margin-top: 4px;
    font-size: 12px;
    line-height: 20px;
}

/* Правая колонка */

.office-login-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 680px;
    align-items: center;
    padding: 2.5rem 1.5rem;
}

.office-login-panel > * {
    width: 100%;
    max-width: 420px;
}

.office-muted {
    color: var(--office-muted);
}

.office-faint {
    color: var(--office-faint);
}

/* Шапка правой колонки */

.office-login-intro__brand {
    display: none;
    margin-bottom: 3rem;
}

.office-login-intro__brand img {
    width: 250px;
    max-width: 82vw;
    height: auto;
}

.office-login-intro__brand p {
    margin: 12px 0 0;
    font-size: 14px;
}

.office-login-intro__eyebrow {
    margin: 0;
    color: #d988a2;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
}

.office-login-intro__title {
    margin: 12px 0 0;
    font-size: 30px;
    font-weight: 600;
    letter-spacing: -0.035em;
    line-height: 36px;
}

.office-login-intro > p:last-child {
    margin: 12px 0 0;
    font-size: 15px;
    line-height: 24px;
}

/* Кнопки провайдеров */

.office-login-providers {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 36px;
}

/* Кнопки Яндекс ID и VK ID — отдельные компоненты страницы; идущие следом
 * группы стыкуются с тем же зазором, что и кнопки внутри одной группы.
 * Общая смежность (~), потому что между div-ами стоят <script> компонентов. */
.office-login-providers ~ .office-login-providers {
    margin-top: 12px;
}

.office-provider {
    --provider-accent: #FC3F1D;
    display: flex;
    width: 100%;
    align-items: center;
    gap: 16px;
    padding: 16px;
    color: inherit;
    font: inherit;
    text-align: left;
    background: var(--office-provider);
    border: 1px solid color-mix(in srgb, var(--provider-accent) 45%, transparent);
    border-radius: 16px;
    cursor: pointer;
    transition: transform 0.3s, border-color 0.3s, background-color 0.3s;
}

.office-provider--vk {
    --provider-accent: #0077FF;
}

.office-provider:hover:not(:disabled) {
    transform: translateY(-2px);
    background: color-mix(in srgb, var(--provider-accent) 8%, var(--office-provider));
    border-color: color-mix(in srgb, var(--provider-accent) 80%, transparent);
}

.office-provider:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--provider-accent) 70%, transparent);
    outline-offset: 2px;
}

.office-provider:disabled {
    opacity: 0.55;
    pointer-events: none;
}

.office-provider__icon {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
}

.office-provider__body {
    flex: 1;
    min-width: 0;
}

.office-provider__title {
    display: block;
    font-size: 15px;
    font-weight: 600;
}

.office-provider__caption {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    line-height: 16px;
}

.office-provider__arrow {
    display: inline-flex;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    align-items: center;
    justify-content: center;
    color: var(--office-faint);
    transition: transform 0.3s, color 0.3s;
}

.office-provider:hover:not(:disabled) .office-provider__arrow {
    transform: translateX(4px);
    color: color-mix(in srgb, var(--office-fg) 70%, transparent);
}

.office-provider__arrow-icon {
    width: 20px;
    height: 20px;
}

.office-provider__spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgb(255 255 255 / 20%);
    border-top-color: #fff;
    border-radius: 50%;
    animation: office-spin 0.7s linear infinite;
}

.office-provider.is-pending .office-provider__spinner {
    display: inline-block;
}

.office-provider.is-pending .office-provider__arrow-icon {
    display: none;
}

.office-spinner {
    border-radius: 50%;
    animation: office-spin 0.7s linear infinite;
}

/* Согласие, статус, безопасность */

.office-consent {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 24px;
    color: color-mix(in srgb, var(--office-fg) 42%, transparent);
    font-size: 12px;
    line-height: 20px;
    cursor: pointer;
}

.office-consent__input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    clip-path: inset(50%);
    overflow: hidden;
    white-space: nowrap;
}

.office-consent__box {
    display: grid;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    place-items: center;
    margin-top: 2px;
    background: var(--office-consent-box);
    border: 1px solid color-mix(in srgb, var(--office-fg) 20%, transparent);
    border-radius: 6px;
    transition: border-color 0.2s, background-color 0.2s;
}

.office-consent__box svg {
    width: 14px;
    height: 14px;
    opacity: 0;
    transition: opacity 0.2s;
}

.office-consent__input:checked + .office-consent__box {
    border-color: #a33f61;
    background: #963a59;
}

.office-consent__input:checked + .office-consent__box svg {
    opacity: 1;
}

.office-consent__input:focus-visible + .office-consent__box {
    outline: 2px solid rgba(199, 91, 126, 0.7);
    outline-offset: 2px;
}

.office-consent-link {
    color: color-mix(in srgb, var(--office-fg) 68%, transparent);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-color: color-mix(in srgb, var(--office-fg) 20%, transparent);
}

.office-consent-link:hover {
    color: var(--office-fg);
}

.office-login-status {
    min-height: 48px;
    padding-top: 12px;
}

.office-login-status p {
    margin: 0;
    font-size: 12px;
    line-height: 20px;
}

.office-login-status .office-faint {
    color: var(--office-faint);
}

.office-error {
    padding: 10px 12px;
    background: var(--office-error-bg);
    border: 1px solid var(--office-error-border);
    border-radius: 12px;
    color: var(--office-error-fg);
}

.office-login-status__noscript {
    margin: 12px 0 0;
    padding: 10px 12px;
    background: var(--office-error-bg);
    border: 1px solid var(--office-error-border);
    border-radius: 12px;
    color: var(--office-error-fg);
    font-size: 12px;
}

.office-security {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    padding-top: 24px;
    border-top: 1px solid var(--office-border);
    color: color-mix(in srgb, var(--office-fg) 32%, transparent);
    font-size: 12px;
    line-height: 16px;
}

.office-security svg {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
}

/* Разделитель способа входа */

.office-login-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 24px 0 4px;
    color: var(--office-faint);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.office-login-divider::before,
.office-login-divider::after {
    width: 100%;
    height: 1px;
    background: var(--office-divider);
    content: '';
}

/* Вход по номеру телефона (использует /api/auth/login + /login/phone/verify) */

.office-phone-auth__form {
    margin-top: 10px;
}

.office-phone-auth__label {
    display: block;
    margin: 10px 0 8px;
    color: var(--office-muted);
    font-size: 14px;
    font-weight: 600;
}

.office-phone-auth__field {
    position: relative;
}

.office-phone-auth__prefix {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    color: var(--office-muted);
    font-size: 15px;
    font-weight: 600;
    pointer-events: none;
}

.office-phone-auth__input {
    width: 100%;
    min-height: 52px;
    padding: 0 14px 0 42px;
    color: var(--office-fg);
    background: var(--office-consent-box);
    border: 1px solid color-mix(in srgb, var(--office-fg) 20%, transparent);
    border-radius: 16px;
    font: inherit;
    font-size: 15px;
    font-weight: 500;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.office-phone-auth__input::placeholder {
    color: var(--office-faint);
    font-weight: 400;
}

.office-phone-auth__input:focus {
    border-color: color-mix(in srgb, #b42753 55%, transparent);
    box-shadow: 0 0 0 3px color-mix(in srgb, #b42753 14%, transparent);
}

.office-phone-auth__submit {
    display: inline-flex;
    width: 100%;
    min-height: 52px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    padding-inline: 14px;
    color: #fff;
    background: var(--login-brand);
    border: 0;
    border-radius: 16px;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.office-phone-auth__submit:hover:not(:disabled):not(.is-disabled) {
    background: color-mix(in srgb, var(--login-brand) 88%, #000);
}

.office-phone-auth__submit:active:not(:disabled):not(.is-disabled) {
    transform: translateY(1px);
}

.office-phone-auth__submit:disabled {
    opacity: 0.65;
    cursor: default;
}

.office-phone-auth__submit.is-disabled {
    pointer-events: none;
}

.office-phone-auth__submit:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--login-brand) 58%, transparent);
    outline-offset: 3px;
}

.office-phone-auth__error {
    margin: 12px 0 0;
    padding: 10px 12px;
    background: var(--office-error-bg);
    border: 1px solid var(--office-error-border);
    border-radius: 12px;
    color: var(--office-error-fg);
    font-size: 13px;
    line-height: 1.45;
}

.office-phone-auth__hint {
    margin: 12px 0 0;
    padding: 12px;
    color: var(--office-muted);
    background: var(--office-consent-box);
    border: 1px solid var(--office-border);
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
}

.office-phone-auth__hint strong {
    color: var(--office-fg);
    white-space: nowrap;
}

.office-phone-auth__status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0 0;
    color: var(--office-faint);
    font-size: 13px;
}

.office-phone-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    border: 2px solid var(--office-border);
    border-top-color: var(--login-brand);
    border-radius: 50%;
    animation: office-spin 0.8s linear infinite;
}

.office-phone-spinner--brand {
    border-color: rgb(255 255 255 / 35%);
    border-top-color: #fff;
}

.office-phone-auth__change {
    display: inline-block;
    margin-top: 10px;
    padding: 0;
    color: #d988a2;
    background: none;
    border: 0;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.office-phone-auth__change:focus-visible {
    outline: 2px solid rgba(199, 91, 126, 0.7);
    outline-offset: 3px;
}

/* Форма подтверждения кода (VerifyLoginPage внутри той же оболочки) */

.office-login-panel .authentication-form {
    margin-top: 24px;
}

.office-login-panel .authentication-form label {
    color: var(--office-muted);
    font-size: 14px;
}

/* Десктоп: две колонки */

@media (min-width: 64rem) {
    .office-login-container {
        padding-inline: 3rem;
    }

    .office-login-shell {
        grid-template-columns: 1.08fr 0.92fr;
    }

    .office-login-hero {
        display: flex;
    }

    .office-login-intro__brand {
        display: none;
    }

    .office-login-panel {
        min-height: 720px;
        padding: 3rem 4rem;
    }

    .office-login-intro__title {
        font-size: 36px;
        line-height: 40px;
    }
}

@media (min-width: 40rem) {
    .office-login-panel {
        padding-inline: 3rem;
    }
}

/* Мобильные: карточка во всю ширину */

@media (max-width: 30rem) {
    body:has([data-office-login]) {
        align-items: start;
    }

    .office-login-container {
        min-height: 100dvh;
        align-items: stretch;
        padding: 0;
    }

    .office-login-shell {
        min-height: 100dvh;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .office-login-panel {
        min-height: 100dvh;
    }
}

/* Светлая тема (как на /office/login) */

@media (prefers-color-scheme: light) {
    .office-auth {
        --office-bg: #f7f4f6;
        --office-panel: rgb(255 255 255 / 84%);
        --office-fg: #1a1a2e;
        --office-muted: rgb(26 26 46 / 62%);
        --office-faint: rgb(26 26 46 / 43%);
        --office-border: rgb(26 26 46 / 9%);
        --office-divider: rgb(26 26 46 / 11%);
        --office-provider: rgb(255 255 255 / 72%);
        --office-consent-box: rgb(26 26 46 / 3%);
        --office-error-bg: rgb(239 68 68 / 7%);
        --office-error-border: rgb(239 68 68 / 18%);
        --office-error-fg: #b42332;
        color-scheme: light;
    }

    body:has([data-office-login]) {
        background: #f7f4f6;
    }

    .office-grid {
        background-image:
            linear-gradient(rgb(26 26 46 / 3.5%) 1px, transparent 1px),
            linear-gradient(90deg, rgb(26 26 46 / 3.5%) 1px, transparent 1px);
    }

    .office-login-shell {
        box-shadow: 0 36px 100px rgb(78 45 60 / 16%);
    }

    .office-left-overlay {
        background: linear-gradient(145deg, rgb(184 59 98 / 10%), transparent 44%, rgb(93 61 156 / 5%));
    }

    .office-orb-primary {
        background: radial-gradient(circle, rgb(209 93 130 / 20%) 0%, rgb(209 93 130 / 0%) 68%);
    }

    .office-orb-secondary {
        background: radial-gradient(circle, rgb(116 91 190 / 13%) 0%, rgb(116 91 190 / 0%) 68%);
    }

    .office-provider__spinner {
        border-color: rgb(26 26 46 / 20%);
        border-top-color: var(--office-fg);
    }
}

/* Ручная тёмная тема MoonShine перекрывает системную светлую */

html.dark .office-auth {
    --office-bg: #08080a;
    --office-panel: rgb(17 17 20 / 80%);
    --office-fg: #fafafa;
    --office-muted: rgb(255 255 255 / 52%);
    --office-faint: rgb(255 255 255 / 35%);
    --office-border: rgb(255 255 255 / 8%);
    --office-divider: rgb(255 255 255 / 10%);
    --office-provider: rgb(255 255 255 / 3.5%);
    --office-consent-box: rgb(255 255 255 / 4%);
    --office-error-bg: rgb(248 113 113 / 7%);
    --office-error-border: rgb(248 113 113 / 15%);
    --office-error-fg: #fecaca;
    background: var(--office-bg);
    color-scheme: dark;
}

html.dark body:has([data-office-login]) {
    background: #08080a;
}

html.dark .office-grid {
    background-image:
        linear-gradient(rgb(255 255 255 / 1.8%) 1px, transparent 1px),
        linear-gradient(90deg, rgb(255 255 255 / 1.8%) 1px, transparent 1px);
}

html.dark .office-login-shell {
    box-shadow: 0 36px 110px rgb(0 0 0 / 55%);
}

html.dark .office-left-overlay {
    background: linear-gradient(145deg, rgb(184 59 98 / 13%), transparent 42%, rgb(93 61 156 / 8%));
}

html.dark .office-orb-primary {
    background: radial-gradient(circle, rgb(184 59 98 / 32%) 0%, rgb(184 59 98 / 0%) 68%);
}

html.dark .office-orb-secondary {
    background: radial-gradient(circle, rgb(102 65 181 / 22%) 0%, rgb(102 65 181 / 0%) 68%);
}

html.dark .office-provider__spinner {
    border-color: rgb(255 255 255 / 20%);
    border-top-color: #fff;
}

/* Доступность: меньше анимаций */

@media (prefers-reduced-motion: reduce) {
    [data-office-login] *,
    [data-office-login] *::before,
    [data-office-login] *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
