/* ============================================================
   Account Pages - 居中卡片 (SaaS) 主题
   设计 Token + 移动优先响应式
   ============================================================ */

:root {
    /* Brand */
    --acct-primary: #5b4bd9;
    --acct-primary-deep: #4a3cc4;
    --acct-primary-2: #7a5cf0;
    --acct-primary-soft: rgba(91, 75, 217, 0.10);
    --acct-primary-weak: #efeefb;
    --acct-link-hover: #4233b6;

    /* Neutrals */
    --acct-text: #1f2333;
    --acct-text-2: #666c82;
    --acct-text-3: #a3a8ba;
    --acct-border: #e5e7f0;
    --acct-bg-card: #ffffff;

    /* Semantic */
    --acct-danger: #c73f38;
    --acct-danger-bg: #fdf1f0;
    --acct-danger-border: #f3ccc8;
    --acct-success: #1f7a44;
    --acct-success-bg: #eff8f1;
    --acct-success-border: #cde9d6;

    /* Shape */
    --acct-radius-md: 12px;
    --acct-radius-lg: 20px;
    --acct-ring: 0 0 0 3px rgba(91, 75, 217, 0.14);

    /* Elevation */
    --acct-shadow-card: 0 24px 60px -30px rgba(58, 52, 130, 0.30), 0 2px 8px rgba(58, 52, 130, 0.05);
}

/* ============ 页面外壳（LoginLayout） ============ */
.acct-page {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    padding: calc(env(safe-area-inset-top, 0px) + 32px) 20px calc(env(safe-area-inset-bottom, 0px) + 28px);
    box-sizing: border-box;
    background:
        radial-gradient(1100px 560px at 88% -10%, rgba(122, 92, 240, 0.12), transparent 60%),
        radial-gradient(900px 500px at -8% 108%, rgba(91, 75, 217, 0.10), transparent 55%),
        linear-gradient(160deg, #f7f6fd 0%, #eff1f9 55%, #faf8fe 100%);
}

.acct-shell {
    margin: auto;
    width: min(100%, 440px);
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.acct-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 28px;
}

.acct-brand-logo {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 21px;
    color: #fff;
    background: linear-gradient(135deg, var(--acct-primary), var(--acct-primary-2));
    box-shadow: 0 10px 22px -8px rgba(91, 75, 217, 0.55);
}

.acct-brand-name {
    font-size: 21px;
    font-weight: 600;
    color: var(--acct-text);
    letter-spacing: -0.2px;
}

.acct-main {
    width: 100%;
}

.acct-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 12px;
    line-height: 1.9;
    color: var(--acct-text-3);
}

.acct-footer p {
    margin: 0;
}

.acct-footer a {
    color: var(--acct-text-3);
    text-decoration: none;
    transition: color 0.2s ease;
}

.acct-footer a:hover {
    color: var(--acct-primary);
}

/* ============ 居中卡片 ============ */
.account-card {
    background: var(--acct-bg-card);
    border: 1px solid var(--acct-border);
    border-radius: var(--acct-radius-lg);
    box-shadow: var(--acct-shadow-card);
    padding: 40px 36px 30px;
    box-sizing: border-box;
    animation: account-in 0.35s ease-out;
}

@keyframes account-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.account-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 24px;
    font-size: 14px;
    color: var(--acct-text-3);
    text-decoration: none;
    transition: color 0.2s ease;
}

.account-back-link:hover {
    color: var(--acct-primary);
}

.account-back-link i {
    font-size: 12px;
}

.account-card-head {
    margin-bottom: 26px;
}

.account-form-title {
    margin: 0 0 6px;
    font-size: 26px;
    font-weight: 600;
    color: var(--acct-text);
    letter-spacing: -0.3px;
}

.account-form-subtitle {
    margin: 0;
    font-size: 14px;
    color: var(--acct-text-2);
}

/* ============ 分区分组（注册/找回） ============ */
.account-section {
    margin-bottom: 22px;
}

.account-section + .account-section {
    padding-top: 18px;
    border-top: 1px dashed var(--acct-border);
}

.account-section-title {
    margin: 0 0 14px;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.6px;
    color: var(--acct-text-3);
}

/* ============ 表单字段 ============ */
.account-field {
    margin-bottom: 18px;
}

.account-label {
    display: block;
    margin-bottom: 7px;
    font-size: 14px;
    font-weight: 500;
    color: var(--acct-text);
}

.account-input-box {
    position: relative;
}

.account-input-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 15px;
    color: var(--acct-text-3);
    pointer-events: none;
    transition: color 0.2s ease;
}

.account-input {
    width: 100%;
    height: 46px;
    padding: 0 16px 0 44px;
    box-sizing: border-box;
    border: 1.5px solid var(--acct-border);
    border-radius: var(--acct-radius-md);
    background: #fff;
    color: var(--acct-text);
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.account-input-box:has(.account-input-toggle) .account-input {
    padding-right: 48px;
}

.account-input::placeholder {
    color: var(--acct-text-3);
}

.account-input:hover {
    border-color: #cdd2e4;
}

.account-input:focus {
    outline: none;
    border-color: var(--acct-primary);
    box-shadow: var(--acct-ring);
}

/* 密码显隐切换 */
.account-input-toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--acct-text-3);
    font-size: 15px;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
}

.account-input-toggle:hover {
    color: var(--acct-primary);
    background: var(--acct-primary-weak);
}

/* 校验消息（Blazor ValidationMessage） */
.validation-message {
    margin-top: 6px;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--acct-danger);
}

/* 注意：asp-validation-for 渲染的 <span class="validation-message"> 在标记里恒存在（无错时为空），
   若只写 :has(.validation-message) 会永远命中，导致输入框边框一直发红。
   必须加 :not(:empty)，仅在真正带错误文本时才变红。 */
.account-field:has(.validation-message:not(:empty)) .account-input {
    border-color: var(--acct-danger);
    background: #fffafa;
}

/* 邮箱验证码行 */
.verify-code-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.verify-code-row .account-input-box {
    flex: 1;
    min-width: 0;
}

.btn-verify-code {
    flex-shrink: 0;
    min-width: 112px;
    height: 46px;
    padding: 0 14px;
    border: 1.5px solid var(--acct-primary);
    border-radius: var(--acct-radius-md);
    background: var(--acct-primary-weak);
    color: var(--acct-primary);
    font-size: 13.5px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s ease, color 0.2s ease;
}

.btn-verify-code:hover:not(:disabled) {
    background: var(--acct-primary);
    color: #fff;
}

.btn-verify-code:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    border-color: var(--acct-border);
    background: #f4f5fa;
    color: var(--acct-text-3);
}

/* ============ 选项行：记住我 / 忘记密码 ============ */
.account-form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 2px 0 22px;
}

.account-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--acct-text-2);
    cursor: pointer;
    user-select: none;
    padding: 6px 2px;
}

.account-checkbox input[type="checkbox"] {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--acct-primary);
    cursor: pointer;
}

.account-checkbox input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--acct-primary);
    outline-offset: 2px;
}

.account-link {
    font-size: 14px;
    font-weight: 500;
    color: var(--acct-primary);
    text-decoration: none;
    padding: 6px 2px;
    transition: color 0.2s ease;
}

.account-link:hover {
    color: var(--acct-link-hover);
}

/* ============ 主按钮 ============ */
.btn-account-submit {
    width: 100%;
    height: 48px;
    border: none;
    border-radius: var(--acct-radius-md);
    background: linear-gradient(135deg, var(--acct-primary), var(--acct-primary-2));
    color: #fff;
    font-size: 15.5px;
    font-weight: 600;
    font-family: inherit;
    letter-spacing: 0.12em;
    cursor: pointer;
    box-shadow: 0 14px 26px -12px rgba(91, 75, 217, 0.65);
    transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease, filter 0.2s ease;
}

.btn-account-submit:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(1.03);
    box-shadow: 0 18px 30px -12px rgba(91, 75, 217, 0.72);
}

.btn-account-submit:active:not(:disabled) {
    transform: translateY(0);
}

.btn-account-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============ 全局提示（错误/成功） ============ */
.account-alert {
    margin-top: 18px;
    padding: 12px 14px;
    border-radius: var(--acct-radius-md);
    font-size: 13.5px;
    line-height: 1.6;
    text-align: center;
    animation: account-in 0.3s ease-out;
}

.account-alert-error {
    background: var(--acct-danger-bg);
    color: var(--acct-danger);
    border: 1px solid var(--acct-danger-border);
}

.account-alert-success {
    background: var(--acct-success-bg);
    color: var(--acct-success);
    border: 1px solid var(--acct-success-border);
}

/* ============ 底部互链 ============ */
.account-bottom-links {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #f0f1f7;
    text-align: center;
    font-size: 14px;
    color: var(--acct-text-2);
}

.account-bottom-links a {
    color: var(--acct-primary);
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease;
}

.account-bottom-links a:hover {
    color: var(--acct-link-hover);
}

/* ============ 键盘可达性 ============ */
.account-back-link:focus-visible,
.account-input-toggle:focus-visible,
.btn-verify-code:focus-visible,
.btn-account-submit:focus-visible,
.account-link:focus-visible,
.account-bottom-links a:focus-visible {
    outline: 2px solid var(--acct-primary);
    outline-offset: 2px;
}

/* ============================================================
   响应式（移动优先关键项）
   ============================================================ */
@media (max-width: 900px) {
    /* 输入字号 >=16px，避免 iOS 聚焦自动缩放 */
    .account-input {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .acct-page {
        padding: calc(env(safe-area-inset-top, 0px) + 20px) 14px calc(env(safe-area-inset-bottom, 0px) + 22px);
    }

    .acct-brand {
        gap: 10px;
        margin-bottom: 22px;
    }

    .acct-brand-logo {
        width: 40px;
        height: 40px;
        border-radius: 12px;
        font-size: 18px;
    }

    .acct-brand-name {
        font-size: 19px;
    }

    .acct-footer {
        margin-top: 20px;
        font-size: 11px;
    }

    .account-card {
        padding: 28px 20px 24px;
        border-radius: 16px;
    }

    .account-back-link {
        margin-bottom: 20px;
    }

    .account-card-head {
        margin-bottom: 22px;
    }

    .account-form-title {
        font-size: 22px;
    }

    .account-form-subtitle {
        font-size: 13.5px;
    }

    .account-field {
        margin-bottom: 16px;
    }

    .account-input {
        height: 46px;
    }

    .account-input-toggle {
        width: 40px;
        height: 40px;
    }

    .btn-verify-code {
        min-width: 104px;
        font-size: 13px;
    }

    .account-form-options {
        margin: 0 0 18px;
    }

    .btn-account-submit {
        height: 48px;
        font-size: 15px;
    }

    .account-bottom-links {
        margin-top: 20px;
        padding-top: 16px;
        font-size: 13.5px;
    }

    .account-checkbox input[type="checkbox"] {
        width: 18px;
        height: 18px;
    }
}

/* 低矮屏幕：卡片顶部留白最小化，保证可完整滚动 */
@media (max-height: 720px) {
    .acct-page {
        padding-top: 18px;
    }

    .acct-brand {
        margin-bottom: 16px;
    }
}

/* ============================================================
   分步表单（注册 / 重置密码 两步式）
   ============================================================ */
.account-steps {
    display: flex;
    align-items: center;
    margin: 0 0 24px;
}

.account-step {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.account-step-num {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--acct-text-3);
    background: #f2f3f9;
    border: 1.5px solid var(--acct-border);
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.account-step.is-active .account-step-num {
    background: var(--acct-primary);
    border-color: var(--acct-primary);
    color: #fff;
    box-shadow: 0 0 0 3px var(--acct-primary-soft);
}

.account-step.is-done .account-step-num {
    background: var(--acct-primary-weak);
    border-color: var(--acct-primary);
    color: var(--acct-primary);
}

.account-step-label {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--acct-text-3);
    white-space: nowrap;
    transition: color 0.2s ease;
}

.account-step.is-active .account-step-label {
    color: var(--acct-text);
    font-weight: 600;
}

.account-step.is-done .account-step-label {
    color: var(--acct-text-2);
}

.account-step-bar {
    flex: 1;
    height: 2px;
    margin: 0 12px;
    border-radius: 1px;
    background: #eceef5;
}

/* 步骤导航按钮 */
.account-step-nav {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.account-step-nav .btn-account-submit {
    flex: 1;
}

.btn-account-back {
    flex-shrink: 0;
    height: 48px;
    padding: 0 18px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1.5px solid var(--acct-border);
    border-radius: var(--acct-radius-md);
    background: #fff;
    color: var(--acct-text-2);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.btn-account-back i {
    font-size: 12px;
}

.btn-account-back:hover {
    border-color: var(--acct-primary);
    color: var(--acct-primary);
    background: var(--acct-primary-weak);
}

.btn-account-back:focus-visible {
    outline: 2px solid var(--acct-primary);
    outline-offset: 2px;
}

@media (max-width: 480px) {
    .account-steps {
        margin-bottom: 20px;
    }

    .account-step-num {
        width: 26px;
        height: 26px;
        font-size: 12.5px;
    }

    .account-step-label {
        font-size: 12.5px;
    }

    .account-step-bar {
        margin: 0 8px;
    }

    .btn-account-back {
        height: 48px;
        padding: 0 14px;
        font-size: 13.5px;
    }
}
