/* auth.css — C-end portal styles. Split from main.css for page-level loading. */

/* Source: main.css lines 736-1224. Auth page. */

/* ── Auth page ── */

body.auth-page {
    position: relative;
    min-height: 100dvh;
    background: oklch(96.6% 0.003 250);
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    overflow-x: hidden;
    overflow-y: auto;
}

body.auth-page::before {
    content: "";
    position: fixed;
    top: 0;
    bottom: 0;
    left: 50%;
    width: min(100vw, 480px);
    transform: translateX(-50%);
    z-index: 0;
    pointer-events: none;
    background: linear-gradient(180deg, white 0%, oklch(98.8% 0.003 250) 42%, oklch(96.6% 0.003 250) 100%);
}

body.auth-page::after {
    content: none;
}

.auth-page .header,
.auth-page .container,
.auth-page .icp-footer {
    position: relative;
    z-index: 1;
}

.auth-page .header {
    z-index: 3;
    background: white;
    border-bottom: 1px solid oklch(92% 0.004 250);
    box-shadow: none;
    backdrop-filter: none;
}

.auth-page .header-row {
    min-height: calc(48px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 16px 0;
}

.auth-page .header h1 {
    color: var(--ink);
    font-size: 17px;
    font-weight: 700;
}

.auth-page .nav-back {
    color: var(--ink);
}

.auth-page .container,
.no-tabbar.auth-page .container {
    display: flex;
    justify-content: center;
    width: min(100%, 480px);
    min-height: 100dvh;
    height: auto;
    padding: 0 28px;
    overflow: visible;
    overscroll-behavior: auto;
    touch-action: auto;
    -webkit-overflow-scrolling: touch;
}

.auth-landing {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(12px, 2.4vh, 22px);
    max-width: 340px;
    width: 100%;
    padding-bottom: env(safe-area-inset-bottom);
}

.auth-brand-lockup,
.auth-hero-copy,
.auth-card,
.auth-guest-form,
.auth-trust,
.auth-brand,
.auth-tagline {
    position: relative;
    z-index: 1;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.auth-brand-logo {
    display: block;
    width: 38px;
    height: auto;
    object-fit: contain;
}

.auth-brand-name {
    color: var(--brand-strong);
    font-size: 21px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

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

.auth-card {
    display: grid;
    gap: 14px;
    width: 100%;
    padding: 14px 0 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    min-height: 36px;
    padding: 0;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
}

.auth-tab {
    position: relative;
    min-width: 0;
    padding-bottom: 10px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--muted);
    font-size: 15px;
    font-weight: 400;
    line-height: 1.2;
    cursor: pointer;
    transition: color 0.2s ease;
}

.auth-tab:focus {
    outline: 0;
}

.auth-tab:focus-visible {
    box-shadow: var(--shadow-focus);
}

.auth-tab.active {
    color: var(--brand-strong);
    font-weight: 700;
    box-shadow: none;
}

.auth-tab.active::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 50%;
    width: 24px;
    height: 2px;
    border-radius: 999px;
    background: var(--brand);
    transform: translateX(-50%);
}

.auth-tab.active::after {
    content: none;
}

.auth-form {
    display: grid;
    gap: 14px;
    animation: fade-in 0.18s ease;
}

.auth-mode {
    display: grid;
    gap: 14px;
}

.auth-form .form-group {
    gap: 10px;
    margin-bottom: 0;
}

.auth-form .form-group label {
    color: var(--ink);
    font-size: 13px;
    font-weight: 400;
}

.auth-input-shell {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: white;
    transition: border-color 0.15s ease;
}

.auth-phone-shell {
    grid-template-columns: 24px auto 1px minmax(0, 1fr);
    gap: 12px;
}

.auth-password-shell {
    grid-template-columns: 24px minmax(0, 1fr) 34px;
}

.auth-input-shell:focus-within {
    border-color: var(--brand);
}

.auth-field-icon {
    color: var(--muted);
    font-size: 20px;
}

.auth-country-code {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    color: var(--ink);
    font-size: 15px;
    font-weight: 400;
    white-space: nowrap;
}

.auth-country-code .material-symbols-outlined {
    color: var(--subtle);
    font-size: 18px;
}

.auth-input-divider {
    width: 1px;
    height: 26px;
    background: var(--line);
}

.auth-page .auth-input-shell .form-control,
.auth-page .auth-input-shell input {
    min-height: 44px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: var(--ink);
    font-size: 15px;
}

.auth-page .auth-input-shell .form-control:focus,
.auth-page .auth-input-shell input:focus {
    border: 0;
    box-shadow: none;
}

.auth-page .auth-input-shell .form-control::placeholder,
.auth-page .auth-input-shell input::placeholder {
    color: var(--muted);
}

.auth-password-toggle {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.auth-password-toggle .material-symbols-outlined {
    font-size: 20px;
}

.auth-password-toggle:focus-visible {
    box-shadow: var(--shadow-focus);
}

.auth-inline-actions {
    display: flex;
    justify-content: center;
    min-height: 22px;
    margin-top: -2px;
}

.auth-link-button {
    border: 0;
    background: transparent;
    color: var(--brand-strong);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
}

.auth-link-button:focus-visible {
    border-radius: 8px;
    box-shadow: var(--shadow-focus);
}

.auth-page .code-row {
    grid-template-columns: minmax(0, 1fr) minmax(100px, 30%);
    gap: 10px;
    align-items: end;
}

.auth-code-field {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.auth-page .code-row .btn-outline {
    min-width: 0;
    min-height: 46px;
    padding: 0 10px;
    border-color: var(--line);
    border-radius: 12px;
    background: white;
    color: var(--brand-strong);
    font-size: 13px;
    font-weight: 400;
    white-space: nowrap;
}

.auth-page .check-line {
    align-items: flex-start;
    gap: 7px;
    padding: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.3;
    white-space: nowrap;
}

.auth-page .check-line input {
    width: 13px;
    height: 13px;
    margin: 1px 0 0;
    accent-color: var(--brand-strong);
    flex: 0 0 13px;
}

.auth-page .check-line span {
    min-width: 0;
    line-height: 1.35;
}

.auth-page .legal-link {
    color: var(--brand-strong);
    font-weight: 700;
}

.auth-submit {
    display: inline-flex;
    justify-content: center;
    min-width: 0;
    min-height: 46px;
    margin-top: 2px;
    border: 0;
    border-radius: 12px;
    background: var(--brand);
    color: white;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    box-shadow: none;
}

.auth-submit::before,
.auth-submit::after {
    content: none;
}

.auth-wechat-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    border: 1px solid oklch(72% 0.12 150);
    border-radius: 8px;
    background: white;
    color: oklch(43% 0.12 150);
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
}

.auth-wechat-link:active {
    transform: scale(0.99);
}

.auth-wechat-link .material-symbols-outlined {
    font-size: 20px;
}

.auth-submit-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 20px;
    margin-top: -2px;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.16s ease, visibility 0.16s ease;
}

.auth-submit-actions.is-active {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

.auth-card .state-note {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    margin-top: -4px;
    padding: 8px 10px;
    border: 0;
    border-radius: 12px;
    background: color-mix(in oklch, var(--brand-soft), white 54%);
    color: var(--brand-strong);
    text-align: center;
    line-height: 1.35;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-2px);
    visibility: hidden;
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
}

.auth-card .state-note.is-success,
.auth-card .state-note.is-danger,
.auth-card .state-note.is-warning {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

.auth-footer-link {
    margin-top: -4px;
    text-align: center;
    font-size: 13px;
    color: var(--muted);
}

.auth-footer-link a {
    color: var(--brand-strong);
    text-decoration: none;
    font-weight: 700;
}

.auth-guest-form {
    margin-top: 0;
}

.auth-guest-button {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(34px, 1fr) auto minmax(34px, 1fr);
    align-items: center;
    gap: 13px;
    min-height: 38px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--brand-strong);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.auth-guest-button:active {
    transform: scale(0.99);
}

.auth-guest-rule {
    display: block;
    height: 1px;
    background: linear-gradient(90deg, transparent, oklch(59% 0.036 145 / 0.58));
}

.auth-guest-rule:last-child {
    background: linear-gradient(90deg, oklch(59% 0.036 145 / 0.58), transparent);
}

.auth-guest-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 400;
    white-space: nowrap;
}

.auth-guest-label .material-symbols-outlined {
    font-size: 16px;
}

.auth-page .icp-footer,
.auth-page.no-tabbar .icp-footer {
    width: min(100%, 480px);
    margin: 0 auto;
    padding: 0 16px calc(12px + env(safe-area-inset-bottom));
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.auth-mode--hidden {
    display: none;
}

.auth-page .state-note.is-info {
    opacity: 0;
    visibility: hidden;
}

@media (max-width: 360px) {
    .auth-page .container,
    .no-tabbar.auth-page .container {
        padding-right: 20px;
        padding-left: 20px;
    }

    .auth-brand-name {
        font-size: 20px;
    }

    .auth-card {
        padding-right: 14px;
        padding-left: 14px;
    }

    .auth-page .code-row {
        grid-template-columns: minmax(0, 1fr) minmax(92px, 30%);
        gap: 8px;
    }

    .auth-page .code-row .btn-outline {
        padding-right: 8px;
        padding-left: 8px;
    }

    .home-hero-top {
        gap: var(--space-sm);
    }

    .home-info-grid {
        grid-template-columns: 1fr;
    }
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
