/* ============================================================
   统一登录页 v2（2026-09）—— 单栏居中卡片设计
   主题：跑道红 #DC2626 + 奖牌金 #F59E0B
   依赖约定：login.js 通过 id 操作 DOM，元素结构变化需同步
   ============================================================ */

:root {
    --track-primary: #DC2626;
    --track-primary-hover: #B91C1C;
    --track-primary-light: #FEF2F2;
    --track-gold: #F59E0B;
    --track-dark: #0F172A;
    --track-text: #0F172A;
    --track-muted: #64748B;
    --track-faint: #94A3B8;
    --track-border: #E2E8F0;
    --track-input-bg: #F1F5F9;
    --track-bg: #F8FAFC;
    --track-card: #FFFFFF;
}

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

html,
body {
    min-height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--track-bg);
    color: var(--track-text);
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
}

/* ===== 背景装饰 ===== */
.page-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.bg-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
}

.glow-1 {
    width: 420px;
    height: 420px;
    top: -160px;
    right: -120px;
    background: rgba(245, 158, 11, 0.10);
}

.glow-2 {
    width: 520px;
    height: 520px;
    bottom: -220px;
    left: -180px;
    background: rgba(220, 38, 38, 0.07);
}

.bg-curve {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 260px;
    height: 260px;
    opacity: 0.10;
}

.bg-curve svg {
    width: 100%;
    height: 100%;
}

/* ===== 主容器 ===== */
.login-container {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 16px 28px;
    min-height: 100vh;
    min-height: 100svh; /* 移动端小视口：排除浏览器底栏，避免版权贴底 */
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--track-card);
    border: 1px solid var(--track-border);
    border-radius: 24px;
    padding: 40px 36px 30px;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 12px 40px rgba(15, 23, 42, 0.08);
    animation: cardIn 0.5s ease both;
}

@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== 欢迎图标 ===== */
.welcome-icon {
    position: relative;
    width: 72px;
    height: 72px;
    margin: 0 auto 18px;
    border-radius: 20px;
    background: linear-gradient(140deg, #E23333 0%, var(--track-primary) 45%, var(--track-primary-hover) 100%);
    box-shadow:
        0 10px 24px rgba(220, 38, 38, 0.32),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    overflow: visible;
    animation: floatY 4.5s ease-in-out infinite;
}

@keyframes floatY {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

.welcome-icon .icon-track {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%);
    opacity: 0.9;
}

.welcome-icon .icon-runner {
    position: absolute;
    left: 50%;
    top: 54%;
    width: 62%;
    height: 62%;
    transform: translate(-50%, -50%);
}

.icon-dot {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--track-gold);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.8);
}

/* ===== 标题区 ===== */
.welcome-title {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    color: var(--track-dark);
    letter-spacing: 0.02em;
}

.welcome-subtitle {
    text-align: center;
    font-size: 14px;
    color: var(--track-muted);
    margin-top: 8px;
}

/* ===== SSO 应用提示 ===== */
.app-hint {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin: 18px 0 0;
    padding: 9px 14px;
    background: var(--track-primary-light);
    border: 1px solid rgba(220, 38, 38, 0.15);
    border-radius: 10px;
    color: var(--track-primary);
    font-size: 13px;
}

.app-hint svg {
    width: 15px;
    height: 15px;
    flex: none;
}

.app-hint strong {
    font-weight: 600;
}

/* ===== 表单 ===== */
.login-form {
    margin-top: 26px;
}

.field-label {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    color: #334155;
    margin: 0 0 7px 2px;
}

.field-label + .input-wrapper,
.field-label + .captcha-row {
    margin-bottom: 16px;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background: var(--track-input-bg);
    border: 1.5px solid transparent;
    border-radius: 12px;
    height: 48px;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.input-wrapper:focus-within {
    background: var(--track-card);
    border-color: var(--track-primary);
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.12);
}

.input-icon {
    width: 18px;
    height: 18px;
    margin: 0 10px 0 14px;
    color: var(--track-faint);
    flex: none;
    transition: color 0.2s;
}

.input-wrapper:focus-within .input-icon {
    color: var(--track-primary);
}

.input-wrapper input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: none;
    outline: none;
    background: transparent;
    font-size: 15px;
    color: var(--track-text);
    padding-right: 12px;
}

.input-wrapper input::placeholder {
    color: #A0AEC0;
}

/* 密码可见切换 */
.toggle-pwd {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 17px;
    line-height: 1;
    padding: 8px 14px 8px 6px;
    border-radius: 0 12px 12px 0;
    opacity: 0.75;
    transition: opacity 0.2s;
}

.toggle-pwd:hover {
    opacity: 1;
}

/* ===== 验证码 ===== */
.captcha-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
    height: 48px;
}

.captcha-row .captcha-input {
    flex: 1 1 0;
    min-width: 0; /* 允许输入框收缩，防止验证码图溢出卡片 */
    height: 100%;
}

.captcha-img {
    flex: 0 0 auto;
    width: 118px;
    max-width: 42%;
    object-fit: cover;
    height: 48px;
    border-radius: 12px;
    border: 1px solid var(--track-border);
    background: #FFF7ED;
    cursor: pointer;
    visibility: hidden;
}

/* ===== 记住我 ===== */
.form-options {
    margin: 2px 0 14px;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input {
    display: none;
}

.checkbox-box {
    width: 17px;
    height: 17px;
    border-radius: 5px;
    border: 1.5px solid #CBD5E1;
    background: var(--track-input-bg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
}

.checkbox-box svg {
    width: 11px;
    height: 11px;
    color: #fff;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.15s, transform 0.15s;
}

.checkbox-label input:checked + .checkbox-box {
    background: var(--track-primary);
    border-color: var(--track-primary);
}

.checkbox-label input:checked + .checkbox-box svg {
    opacity: 1;
    transform: scale(1);
}

.checkbox-text {
    font-size: 13.5px;
    color: var(--track-muted);
}

/* ===== 错误提示 ===== */
.error-message {
    background: var(--track-primary-light);
    border: 1px solid rgba(220, 38, 38, 0.2);
    color: var(--track-primary);
    font-size: 13px;
    line-height: 1.5;
    padding: 10px 13px;
    border-radius: 10px;
    margin-bottom: 14px;
    animation: shake 0.3s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* ===== 登录按钮 ===== */
.btn-submit {
    position: relative;
    width: 100%;
    height: 48px;
    border: none;
    border-radius: 12px;
    background: var(--track-primary);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.15em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.28);
}

.btn-submit:hover:not(:disabled) {
    background: var(--track-primary-hover);
    box-shadow: 0 6px 18px rgba(220, 38, 38, 0.35);
}

.btn-submit:active:not(:disabled) {
    transform: scale(0.985);
}

.btn-submit:disabled {
    opacity: 0.75;
    cursor: not-allowed;
}

.btn-arrow {
    width: 17px;
    height: 17px;
    transition: transform 0.2s;
}

.btn-submit:hover:not(:disabled) .btn-arrow {
    transform: translateX(3px);
}

.btn-loader {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* ===== 底部 ===== */
.footer-tip {
    text-align: center;
    font-size: 12.5px;
    color: var(--track-faint);
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid #F1F5F9;
}

.copyright {
    position: relative;
    z-index: 1;
    text-align: center;
    font-size: 12.5px;
    color: var(--track-faint);
    margin-top: 18px;
    padding: 0 16px calc(22px + env(safe-area-inset-bottom, 0px));
}

/* ===== 移动端 ===== */
@media (max-width: 480px) {
    .login-container {
        padding: 28px 14px 6px;
    }

    .login-card {
        padding: 32px 22px 24px;
        border-radius: 20px;
    }

    .bg-curve {
        width: 180px;
        height: 180px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-card,
    .welcome-icon,
    .error-message {
        animation: none;
    }
}
