/* ============================================================================
   登录 / 注册页共用样式 — 消费 design-system.css 令牌
   ============================================================================ */

html {
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    padding: clamp(16px, 4vw, 48px);
    padding-bottom: max(clamp(16px, 4vw, 48px), env(safe-area-inset-bottom));
    overflow-x: hidden;
    background:
        radial-gradient(760px 420px at 18% 8%, rgba(45, 212, 191, 0.08), transparent 65%),
        radial-gradient(680px 380px at 88% 92%, rgba(20, 184, 166, 0.06), transparent 70%),
        var(--ds-bg);
}

/* ---------- 外壳 ---------- */

.auth-shell {
    position: relative;
    z-index: 1;
    margin: auto;
    width: 100%;
    max-width: 1020px;
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1fr);
    background: var(--ds-surface);
    border: 1px solid var(--ds-border-subtle);
    border-radius: var(--ds-radius-2xl);
    box-shadow: var(--ds-shadow-lg);
    overflow: hidden;
    animation: auth-enter 0.45s var(--ds-ease) both;
}

@keyframes auth-enter {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* ---------- 品牌区 ---------- */

.auth-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding: clamp(32px, 3.6vw, 52px);
    background:
        radial-gradient(420px 320px at 0% 100%, rgba(45, 212, 191, 0.09), transparent 70%),
        var(--ds-bg-subtle);
    border-right: 1px solid var(--ds-border-subtle);
    overflow: hidden;
}

.brand-logo {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--ds-text);
}

.brand-logo__mark {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: var(--ds-radius-md);
    background: var(--ds-gradient-accent);
    box-shadow: var(--ds-shadow-accent);
}

.brand-logo__mark img {
    width: 22px;
    height: 22px;
}

.brand-copy {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.brand-headline {
    margin: 0;
    font-size: clamp(28px, 3vw, 36px);
    font-weight: 650;
    line-height: 1.25;
    letter-spacing: -0.025em;
    color: var(--ds-text);
}

.brand-tagline {
    margin: 0;
    max-width: 22em;
    font-size: 14px;
    line-height: 1.8;
    letter-spacing: 0.01em;
    color: var(--ds-text-muted);
}

.brand-features {
    list-style: none;
    margin: auto 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.brand-features li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--ds-text-secondary);
}

.brand-features li::before {
    content: '';
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: 1px solid var(--ds-accent-border);
    border-radius: 50%;
    background-color: var(--ds-accent-soft);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='%232dd4bf' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 12px;
}

.brand-footer {
    padding-top: 18px;
    border-top: 1px solid var(--ds-border-subtle);
    font-size: 12px;
    letter-spacing: 0.04em;
    color: var(--ds-text-faint);
}

/* ---------- 表单区 ---------- */

.auth-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(30px, 4vw, 56px);
    background: var(--ds-surface);
}

.panel-header {
    margin-bottom: 26px;
}

.panel-eyebrow {
    display: block;
    margin-bottom: 10px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ds-accent);
}

.auth-title {
    margin: 0 0 8px;
    font-size: clamp(25px, 2.5vw, 30px);
    font-weight: 650;
    letter-spacing: -0.02em;
    color: var(--ds-text);
}

.auth-subtitle {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--ds-text-muted);
}

/* 提示条 */

.alert {
    display: none;
    position: relative;
    margin-bottom: 18px;
    padding: 12px 14px 12px 40px;
    font-size: 13.5px;
    line-height: 1.55;
    border: 1px solid transparent;
    border-radius: var(--ds-radius-md);
    animation: alert-in 0.2s var(--ds-ease);
}

@keyframes alert-in {
    from {
        opacity: 0;
        transform: translateY(-3px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.alert::before {
    position: absolute;
    top: 12px;
    left: 14px;
    display: grid;
    place-items: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.alert-error {
    border-color: var(--ds-danger-border);
    background: var(--ds-danger-soft);
    color: var(--ds-danger);
}

.alert-error::before {
    content: '!';
    background: rgba(248, 113, 113, 0.18);
    color: var(--ds-danger);
}

.alert-success {
    border-color: var(--ds-success-border);
    background: var(--ds-success-soft);
    color: var(--ds-success);
}

.alert-success::before {
    content: '✓';
    background: rgba(52, 211, 153, 0.18);
    color: var(--ds-success);
}

/* 表单元素 */

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.field > label {
    font-size: 13px;
    font-weight: 500;
    color: var(--ds-text-secondary);
}

.field-control {
    position: relative;
}

.field-icon {
    position: absolute;
    top: 50%;
    left: 15px;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
    color: var(--ds-text-faint);
    pointer-events: none;
    transition: color var(--ds-duration) var(--ds-ease);
}

.field-control:focus-within .field-icon {
    color: var(--ds-accent);
}

.field-control input {
    width: 100%;
    height: var(--auth-input-height);
    padding: 0 16px 0 44px;
    font-family: inherit;
    font-size: 15px;
    color: var(--ds-text);
    background: var(--ds-bg-subtle);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-md);
    transition: border-color var(--ds-duration) var(--ds-ease),
        background-color var(--ds-duration) var(--ds-ease),
        box-shadow var(--ds-duration) var(--ds-ease);
}

.field-control input::placeholder {
    color: var(--ds-text-faint);
}

@media (hover: hover) {
    .field-control input:hover {
        border-color: var(--ds-border-strong);
    }
}

.field-control input:focus {
    outline: none;
    border-color: var(--ds-accent);
    background: var(--ds-surface-hover);
    box-shadow: 0 0 0 3px var(--ds-accent-ring);
}

.field-control input:-webkit-autofill,
.field-control input:-webkit-autofill:hover,
.field-control input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--ds-text);
    caret-color: var(--ds-text);
    border-color: var(--ds-border);
    -webkit-box-shadow: 0 0 0 1000px var(--ds-raised) inset;
    transition: background-color 9999s ease-out 0s;
}

.field-hint {
    margin: 0;
    font-size: 12px;
    line-height: 1.55;
    color: var(--ds-text-faint);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: -2px;
    font-size: 13.5px;
}

.remember {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--ds-text-secondary);
    cursor: pointer;
    user-select: none;
}

.remember input {
    appearance: none;
    -webkit-appearance: none;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin: 0;
    background-color: var(--ds-bg-subtle);
    border: 1px solid var(--ds-border-strong);
    border-radius: 5px;
    cursor: pointer;
    transition: background-color var(--ds-duration) var(--ds-ease),
        border-color var(--ds-duration) var(--ds-ease);
}

.remember input:checked {
    border-color: var(--ds-accent);
    background-color: var(--ds-accent);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='%2303201c' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 11px;
}

.link {
    color: var(--ds-link);
    font-weight: 500;
    text-decoration: none;
    border-radius: 4px;
    transition: color var(--ds-duration) var(--ds-ease);
    -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
    .link:hover {
        color: var(--ds-accent-hover);
        text-decoration: underline;
        text-underline-offset: 3px;
    }
}

/* 提交按钮 */

.auth-submit {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 52px;
    margin-top: 2px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--ds-accent-contrast);
    background: var(--ds-gradient-accent);
    border: none;
    border-radius: var(--ds-radius-md);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    box-shadow: var(--ds-shadow-accent);
    transition: box-shadow var(--ds-duration) var(--ds-ease),
        filter var(--ds-duration) var(--ds-ease),
        transform var(--ds-duration-fast) var(--ds-ease);
}

@media (hover: hover) {
    .auth-submit:hover {
        filter: brightness(1.06);
        box-shadow: var(--ds-shadow-accent-hover);
    }
}

.auth-submit:active {
    transform: scale(0.995);
}

.auth-submit:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(3, 32, 28, 0.25);
    border-top-color: var(--ds-accent-contrast);
    border-radius: 50%;
    animation: spin 0.65s linear infinite;
}

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

/* 分隔与切换 */

.auth-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 22px 0;
    font-size: 12px;
    color: var(--ds-text-faint);
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--ds-border-subtle);
}

.auth-switch {
    margin: 0;
    text-align: center;
    font-size: 14px;
    color: var(--ds-text-muted);
}

.auth-switch .link {
    margin-left: 4px;
}

/* ---------- 响应式 ---------- */

@media (max-width: 980px) {
    .auth-shell {
        grid-template-columns: 1fr;
        max-width: 560px;
    }

    .auth-brand {
        gap: 14px;
        padding: 26px 28px 24px;
        border-right: none;
        border-bottom: 1px solid var(--ds-border-subtle);
    }

    .brand-copy {
        gap: 8px;
    }

    .brand-headline {
        font-size: 24px;
    }

    .brand-headline br {
        display: none;
    }

    .brand-tagline {
        max-width: none;
        font-size: 13px;
        line-height: 1.6;
    }

    .brand-features,
    .brand-footer {
        display: none;
    }

    .auth-panel {
        padding: 32px;
    }
}

@media (max-width: 560px) {
    body {
        padding: 12px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }

    .auth-shell {
        border-radius: var(--ds-radius-lg);
    }

    .auth-brand {
        padding: 22px 22px 20px;
    }

    .brand-logo {
        font-size: 15px;
    }

    .brand-logo__mark {
        width: 34px;
        height: 34px;
        border-radius: var(--ds-radius);
    }

    .brand-logo__mark img {
        width: 20px;
        height: 20px;
    }

    .brand-headline {
        font-size: 21px;
    }

    .brand-tagline {
        display: none;
    }

    .auth-panel {
        padding: 24px 20px 28px;
    }

    .panel-header {
        margin-bottom: 22px;
    }

    .auth-title {
        font-size: 23px;
    }

    .auth-subtitle {
        font-size: 13px;
    }

    .auth-form {
        gap: 16px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .field-control input {
        height: 48px;
        font-size: 16px;
        padding-left: 42px;
    }

    .auth-submit {
        height: 50px;
    }

    .form-options {
        font-size: 13px;
    }

    .auth-divider {
        margin: 18px 0;
    }
}

@media (max-height: 780px) and (min-width: 981px) {
    .auth-brand {
        padding-top: 40px;
        padding-bottom: 40px;
    }

    .auth-panel {
        padding-top: 40px;
        padding-bottom: 40px;
    }

    .panel-header {
        margin-bottom: 20px;
    }

    .auth-form {
        gap: 15px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-shell,
    .alert {
        animation: none;
    }

    .field-control input,
    .field-icon,
    .remember input,
    .link,
    .auth-submit {
        transition: none;
    }
}
