/* apihub 登录/注册页样式（P13）
 * 完整移植自 v2 user_portal.html 第 1177-1576 行 login 段。
 * 命名空间 .login-* / .l-* / .agreement-* / .toast-top，与 landing.css (.auth-*)
 * 和 portal.css (.modal-*/.dash-*/.commission-*) 无冲突。
 */

:root {
    --primary: #1a5cff;
    --primary-hover: #1448cc;
    --primary-light: #eef2ff;
    --text: #1a1a2e;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --danger: #ef4444;
    --success: #10b981;
    --border: #d0d7de;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body.login-body-root {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
                 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    background: #eef2ff;
    min-height: 100vh;
}

.login-page {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}
.login-page.hidden { display: none; }

.login-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 70% 50%, rgba(255,255,255,0.35) 0%, rgba(255,255,255,0.10) 50%, rgba(255,255,255,0) 100%),
        url('/assets/images/apihub/login_bg.png') center center / cover no-repeat;
    background-attachment: fixed;
}

.login-brand {
    position: absolute;
    top: 28px;
    left: 32px;
    z-index: 2;
    display: flex;
    align-items: baseline;
    gap: 9px;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.4px;
    color: #111827;
    user-select: none;
    text-decoration: none;
}
.login-brand span {
    font-size: 17px;
    font-weight: 600;
    color: #4b5563;
    letter-spacing: 0.2px;
}

.login-card {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(20,40,80,0.18), 0 4px 20px rgba(20,40,80,0.08);
    overflow: hidden;
    animation: loginCardIn 0.5s cubic-bezier(0.2,0.9,0.3,1);
}

@keyframes loginCardIn {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-banner {
    position: relative;
    padding: 32px 36px 28px;
    background:
        radial-gradient(circle at 10% 20%, rgba(255,255,255,0.6) 0%, transparent 50%),
        radial-gradient(circle at 90% 80%, rgba(26,92,255,0.08) 0%, transparent 45%),
        linear-gradient(135deg, #f5f8ff 0%, #eaf1ff 100%);
    overflow: hidden;
}
.login-banner::before,
.login-banner::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(26,92,255,0.12), rgba(26,92,255,0.04));
    pointer-events: none;
}
.login-banner::before { width: 160px; height: 160px; top: -60px; right: -40px; }
.login-banner::after  { width: 100px; height: 100px; bottom: -30px; right: 60px; }

.login-banner-title {
    position: relative;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.5px;
    line-height: 1.4;
}
.login-banner-sub {
    position: relative;
    margin-top: 8px;
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.6;
}
.login-banner-sub strong {
    color: var(--primary);
    font-weight: 700;
    font-size: 15px;
    margin: 0 2px;
}

.login-invite-hint {
    position: relative;
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(26,92,255,0.09);
    border: 1px solid rgba(26,92,255,0.18);
    border-radius: 8px;
    font-size: 12.5px;
    color: var(--primary);
    line-height: 1.55;
}
.login-invite-hint strong { color: var(--primary); font-weight: 700; }

.login-body-content { padding: 8px 36px 32px; }

.login-tabs {
    display: flex;
    gap: 28px;
    border-bottom: 1px solid #adb5bd;
    margin-bottom: 22px;
}
.login-tab {
    position: relative;
    flex: 1;
    padding: 12px 4px 14px;
    background: transparent;
    border: none;
    font-size: 14.5px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
    text-align: center;
    font-family: inherit;
}
.login-tab:hover { color: #1a5cff !important; }
.login-tab.active { color: #1a5cff !important; font-weight: 600 !important; }
.login-tab.active::after {
    content: '' !important;
    display: block !important;
    position: absolute !important;
    left: 8% !important;
    right: 8% !important;
    bottom: -2px !important;
    height: 3.5px !important;
    background: #1a5cff !important;
    border-radius: 3px 3px 0 0 !important;
    box-shadow: 0 1px 4px rgba(26,92,255,0.35) !important;
}

.login-panel { display: none; animation: panelIn 0.25s ease; }
.login-panel.active { display: block; }
@keyframes panelIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.l-input {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    font-size: 14px;
    font-family: inherit;
    color: #8b96a5;
    background: #fff;
    border: 1px solid #adb5bd;
    border-radius: 8px;
    outline: none;
    box-shadow: inset 0 1px 2px rgba(16, 24, 40, 0.04);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.l-input::placeholder { color: var(--text-muted); }
.l-input:hover { border-color: #6b7684; }
.l-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,92,255,0.15), inset 0 1px 2px rgba(26,92,255,0.05);
}

.login-group { margin-bottom: 14px; }

.login-phone-row { display: flex; gap: 10px; margin-bottom: 14px; position: relative; }
.l-country {
    flex: 0 0 100px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0 10px;
    font-size: 14px;
    color: #4b5563;
    background: #f6f8fa;
    border: 1px solid #adb5bd;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.2s, background 0.2s;
}
.l-country:hover { border-color: #6b7684; background: #eef1f5; }
.l-country.open { border-color: #1a5cff; background: #eef2ff; }
.l-country .flag { font-size: 16px; line-height: 1; }
.l-country .arrow { font-size: 10px; color: #6b7280; margin-left: 2px; transition: transform 0.2s; }
.l-country.open .arrow { transform: rotate(180deg); }
.login-phone-row .l-input { flex: 1; }

.country-dropdown {
    position: absolute;
    top: 52px;
    left: 0;
    width: 290px;
    max-width: 100%;
    background: #fff;
    border: 1px solid #d0d7de;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.15), 0 2px 8px rgba(15, 23, 42, 0.06);
    z-index: 30;
    display: none;
    overflow: hidden;
}
.country-dropdown.active { display: block; animation: countryIn 0.15s ease-out; }
@keyframes countryIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}
.country-search-wrap { padding: 10px 12px; border-bottom: 1px solid #eef1f5; }
.country-search {
    width: 100%;
    height: 34px;
    padding: 0 12px;
    font-size: 13px;
    font-family: inherit;
    color: #4b5563;
    background: #f6f8fa;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.15s;
}
.country-search:focus { border-color: #1a5cff; background: #fff; }
.country-list { max-height: 260px; overflow-y: auto; padding: 4px 0; }
.country-list::-webkit-scrollbar { width: 6px; }
.country-list::-webkit-scrollbar-thumb { background: #d0d7de; border-radius: 3px; }
.country-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    font-size: 13.5px;
    color: #333;
    cursor: pointer;
    transition: background 0.12s;
}
.country-item:hover { background: #f5f7fb; }
.country-item.selected { background: #eef2ff; color: #1a5cff; font-weight: 600; }
.country-item .flag { font-size: 16px; line-height: 1; }
.country-item .name { flex: 1; }
.country-item .code { color: #6b7280; font-size: 13px; }
.country-item.selected .code { color: #1a5cff; }
.country-empty { padding: 20px 14px; text-align: center; font-size: 13px; color: #9ca3af; }

.login-captcha-row { display: flex; gap: 10px; margin-bottom: 14px; }
.login-captcha-row .l-input { flex: 1; }

.l-captcha-btn {
    flex: 0 0 120px;
    height: 46px;
    padding: 0 12px;
    font-size: 13.5px;
    font-weight: 600 !important;
    font-family: inherit;
    color: #1a5cff !important;
    background: #fff !important;
    border: 1px solid #1a5cff !important;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.l-captcha-btn:hover:not(:disabled) { background: #eef2ff !important; color: #1a5cff !important; border-color: #1a5cff !important; }
.l-captcha-btn:disabled {
    color: #9ca3af !important;
    border-color: #d0d7de !important;
    background: #f6f8fa !important;
    font-weight: 500 !important;
    cursor: not-allowed;
}

.l-submit {
    width: 100%;
    height: 50px;
    margin-top: 8px;
    margin-bottom: 18px;
    font-size: 15.5px;
    font-weight: 600;
    font-family: inherit;
    letter-spacing: 2px;
    color: #fff;
    background: linear-gradient(135deg, #2b6dff 0%, #1a5cff 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(26,92,255,0.30);
    transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
}
.l-submit:hover:not(:disabled) {
    background: linear-gradient(135deg, #3a78ff 0%, #2358e0 100%);
    box-shadow: 0 8px 20px rgba(26,92,255,0.38);
}
.l-submit:active:not(:disabled) { transform: translateY(1px); }
.l-submit:disabled { opacity: 0.7; cursor: not-allowed; }

.login-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: -2px 0 14px;
    font-size: 12.5px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}
.login-remember input[type="checkbox"] {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: var(--primary);
}

.login-terms {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.6;
    cursor: pointer;
}
.login-terms input[type="checkbox"] {
    margin-top: 3px;
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: var(--primary);
}
.login-terms a,
.login-terms a:link,
.login-terms a:visited { color: #1a5cff !important; text-decoration: none !important; font-weight: 600 !important; }
.login-terms a:hover { text-decoration: underline !important; }

.login-footer-link {
    text-align: center;
    margin-top: 14px;
    font-size: 13px;
    color: var(--text-secondary);
}
.login-footer-link a { color: var(--primary); text-decoration: none; font-weight: 500; margin-left: 4px; }
.login-footer-link a:hover { text-decoration: underline; }

.toast-top {
    position: fixed !important;
    top: 24px !important;
    left: 50% !important;
    transform: translateX(-50%) translateY(-20px);
    min-width: 220px;
    max-width: 90vw;
    padding: 12px 24px !important;
    font-size: 14.5px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    text-align: center !important;
    color: #fff !important;
    background: #1f2937 !important;
    border-radius: 10px !important;
    opacity: 0;
    transition: opacity 0.22s, transform 0.22s;
    z-index: 99999 !important;
    pointer-events: none;
    box-shadow: 0 12px 32px rgba(0,0,0,0.25), 0 4px 12px rgba(0,0,0,0.12) !important;
    white-space: nowrap;
}
.toast-top.show { opacity: 1 !important; transform: translateX(-50%) translateY(0) !important; }
.toast-top.error   { background: #dc2626 !important; }
.toast-top.success { background: #16a34a !important; }

.agreement-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 7000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.28);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.agreement-modal-overlay.active { display: flex; }

.agreement-modal {
    width: 420px;
    max-width: 92vw;
    background: rgba(255,255,255,0.96);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18), 0 8px 24px rgba(15, 23, 42, 0.08);
    padding: 26px 28px 24px;
    animation: agreementIn 0.22s ease;
}

@keyframes agreementIn {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.agreement-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1a5cff;
    background: linear-gradient(135deg, #eef4ff, #ffffff);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 8px 18px rgba(26,92,255,0.12);
}

.agreement-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 8px;
}

.agreement-desc {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 20px;
}

.agreement-desc a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.agreement-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.agreement-btn {
    height: 38px;
    padding: 0 20px;
    border-radius: 8px;
    border: none;
    font-size: 13.5px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.18s;
}

.agreement-btn.reject {
    color: var(--text-secondary);
    background: #f3f5f8;
}

.agreement-btn.reject:hover { background: #e9edf3; }

.agreement-btn.agree {
    color: #fff;
    background: linear-gradient(135deg, #2b6dff, #1a5cff);
    box-shadow: 0 6px 14px rgba(26,92,255,0.22);
}

.agreement-btn.agree:hover {
    background: linear-gradient(135deg, #3a78ff, #2358e0);
}

@media (max-width: 520px) {
    .login-page { padding: 24px 14px; }
    .login-banner { padding: 26px 22px 22px; }
    .login-body-content { padding: 6px 22px 26px; }
    .login-banner-title { font-size: 19px; }
    .login-tabs { gap: 18px; }
    .login-tab { font-size: 13.5px; }
    .l-captcha-btn { flex: 0 0 110px; font-size: 13px; }
}
