/* Màn hình đăng nhập/đăng ký và form dùng chung cho các app frontend. */
:root {
    /* Legacy aliases used by the account screens and site.css. Keep their
       values connected to the shared theme so this stylesheet cannot force
       light colors onto pages rendered with MainLayout. */
    --paper: var(--jl-color-bg-canvas);
    --surface: var(--jl-color-bg-surface);
    --surface-subtle: var(--jl-color-bg-surface-subtle);
    --ink: var(--jl-color-text-primary);
    --ink-secondary: var(--jl-color-text-secondary);
    --ink-muted: var(--jl-color-text-muted);
    --brand: var(--jl-color-bg-brand);
    --brand-hover: var(--jl-color-bg-brand-hover);
    --brand-subtle: var(--jl-color-bg-brand-subtle);
    --accent: var(--jl-color-bg-accent);
    --danger: var(--jl-color-text-danger);
    --line: var(--jl-color-border-default);
    --focus: var(--jl-color-border-focus);
    --shadow-soft: var(--jl-shadow-md);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --content-width: 1280px;
}

.auth-page {
    display: grid;
    width: min(calc(100% - 48px), 1120px);
    min-height: calc(100vh - 185px);
    margin-inline: auto;
    grid-template-columns: minmax(0, 1.05fr) minmax(380px, 0.95fr);
    align-items: stretch;
    border-inline: 1px solid var(--line);
    background: var(--surface);
}

.auth-story,
.auth-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(48px, 7vw, 92px);
}

.auth-story {
    position: relative;
    overflow: hidden;
    border-right: 1px solid var(--line);
    background: var(--surface-subtle);
}

.auth-story::after {
    position: absolute;
    right: -48px;
    bottom: -80px;
    width: 230px;
    height: 230px;
    border: 34px solid rgb(213 133 34 / 16%);
    border-radius: 50%;
    content: "";
}

.auth-story__ornament {
    display: grid;
    width: 72px;
    height: 72px;
    margin-bottom: 48px;
    place-items: center;
    border-radius: 50% 50% 44% 56%;
    background: var(--brand);
    box-shadow: 0 12px 28px rgb(119 59 142 / 18%);
    color: white;
    font-family: "Literata", Georgia, serif;
    font-size: 2.2rem;
    font-weight: 700;
    transform: rotate(-6deg);
}

.auth-story blockquote {
    max-width: 520px;
    margin: 0;
    color: var(--ink);
    font-family: "Literata", Georgia, serif;
    font-size: clamp(1.75rem, 3vw, 2.65rem);
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: -0.035em;
}

.auth-story__caption {
    max-width: 430px;
    margin: 28px 0 0;
    color: var(--ink-secondary);
    font-size: 0.95rem;
    line-height: 1.75;
}

.auth-panel {
    max-width: 560px;
}

.auth-panel__heading h1 {
    margin: 0;
    font-family: "Literata", Georgia, serif;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.12;
    letter-spacing: -0.045em;
}

.auth-panel__heading > p:last-child {
    margin: 18px 0 0;
    color: var(--ink-secondary);
    line-height: 1.65;
}

.auth-form {
    display: grid;
    gap: 24px;
    margin-top: 40px;
}

.form-field {
    display: grid;
    gap: 8px;
}

.form-field label {
    color: var(--ink);
    font-size: 0.88rem;
    font-weight: 700;
}

.form-field__label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
}

.form-field__label-row span {
    color: var(--ink-muted);
    font-size: 0.72rem;
}

.text-input {
    width: 100%;
    min-height: 48px;
    padding: 11px 14px;
    border: 1px solid var(--jl-color-border-strong);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--ink);
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.text-input:hover {
    border-color: var(--ink-muted);
}

.text-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 28%, transparent);
    outline: none;
}

/* Ô mật khẩu có nút ẩn/hiện ở cuối. */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.password-input-wrapper .text-input {
    width: 100%;
    padding-right: 44px;
}

.password-toggle-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--ink-muted);
    cursor: pointer;
    transform: translateY(-50%);
    transition: color 150ms ease, background-color 150ms ease;
}

.password-toggle-btn:hover {
    color: var(--ink);
    background-color: var(--surface-subtle);
}

.password-toggle-btn:focus-visible {
    outline: 2px solid var(--focus);
}

.password-field__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--jl-space-2);
    margin-top: var(--jl-space-1);
}

.password-field__meta > span {
    color: var(--ink-muted);
    font-size: 0.75rem;
}

.validation-message {
    color: var(--danger);
    font-size: 0.78rem;
}

.form-help {
    color: var(--ink-secondary);
    font-size: 0.75rem;
    line-height: 1.45;
}

.form-alert {
    display: grid;
    grid-template-columns: 24px 1fr;
    align-items: start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid color-mix(in srgb, var(--jl-color-border-danger) 28%, transparent);
    background: var(--jl-color-bg-danger);
    color: var(--jl-color-text-danger);
    font-size: 0.84rem;
    line-height: 1.5;
}

.form-alert > span {
    display: grid;
    width: 22px;
    height: 22px;
    place-items: center;
    border-radius: 50%;
    background: var(--danger);
    color: white;
    font-weight: 700;
}

.form-alert p {
    margin: 1px 0 0;
}

.auth-submit {
    min-height: 48px !important;
    border-radius: var(--radius-md) !important;
    background: var(--brand) !important;
    box-shadow: none !important;
    font-weight: 700 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
}

.auth-submit:hover {
    background: var(--brand-hover) !important;
}

.button-progress {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    border: 2px solid rgb(255 255 255 / 45%);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 700ms linear infinite;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    color: var(--ink-muted);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    border-top: 1px solid var(--line);
}

.auth-google {
    display: flex;
    justify-content: center;
    min-height: 44px;
    margin-top: 16px;
}

.auth-google--busy {
    opacity: 0.6;
    pointer-events: none;
}

.auth-note {
    margin: 24px 0 0;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    color: var(--ink-muted);
    font-size: 0.76rem;
    line-height: 1.6;
}

.text-link {
    color: var(--brand);
    font-weight: 700;
    text-underline-offset: 4px;
}

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

@media (max-width: 820px) {
    .auth-page {
        width: 100%;
        min-height: auto;
        grid-template-columns: 1fr;
        border-inline: 0;
    }

    .auth-story {
        min-height: 340px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .auth-story,
    .auth-panel {
        padding: 48px clamp(24px, 8vw, 64px);
    }

    .auth-story__ornament {
        margin-bottom: 32px;
    }

    .auth-panel {
        max-width: none;
    }
}

@media (max-width: 599px) {
    .auth-story {
        min-height: 285px;
    }

    .auth-story,
    .auth-panel {
        padding: 40px 24px;
    }

    .auth-story__ornament {
        width: 58px;
        height: 58px;
        margin-bottom: 28px;
        font-size: 1.8rem;
    }

    .auth-story blockquote {
        font-size: 1.55rem;
    }

    .auth-story__caption {
        margin-top: 18px;
        font-size: 0.86rem;
    }

    .form-field__label-row span {
        display: none;
    }
}
