/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
                 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-x: hidden;
}

input {
    -webkit-user-select: text;
    user-select: text;
}

button, a {
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

/* 登录容器 */
.login-container {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Logo */
.logo {
    margin-bottom: 30px;
}

.logo-text {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #5568d3 0%, #6a4190 100%);
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 36px;
    font-weight: bold;
    color: #fff;
    box-shadow: 0 8px 24px rgba(85, 104, 211, 0.4);
    letter-spacing: 2px;
}

/* 登录卡片 */
.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px 30px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.login-title {
    font-size: 28px;
    font-weight: 600;
    color: #333;
    text-align: center;
    margin-bottom: 30px;
}

/* 表单组 */
.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #555;
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    color: #333;
    transition: all 0.3s ease;
    outline: none;
}

.form-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.form-input::placeholder {
    color: #aaa;
}

.form-input.error {
    border-color: #ff4d4f;
}

.form-input.error:focus {
    box-shadow: 0 0 0 3px rgba(255, 77, 79, 0.1);
}

/* 密码输入框 */
.password-container {
    position: relative;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    transition: color 0.3s ease;
}

.toggle-password:hover {
    color: #667eea;
}

.toggle-password svg {
    fill: currentColor;
}

/* 验证码 */
.captcha-container {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}

.captcha-image {
    flex: 1;
    height: 180px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
}

.captcha-image canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.refresh-captcha {
    width: 48px;
    height: 48px;
    background: #f5f5f5;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: all 0.3s ease;
}

.refresh-captcha:hover {
    background: #e8e8e8;
    color: #667eea;
}

.refresh-captcha svg {
    fill: currentColor;
}

.captcha-hint {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

/* 错误提示 */
.error-tip {
    display: block;
    font-size: 12px;
    color: #ff4d4f;
    margin-top: 4px;
    min-height: 16px;
}

/* 登录按钮 */
.login-btn {
    width: 100%;
    height: 48px;
    background: linear-gradient(135deg, #5568d3 0%, #6a4190 100%);
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.login-btn:hover:not(:disabled) {
    box-shadow: 0 8px 20px rgba(85, 104, 211, 0.4);
    transform: translateY(-2px);
}

.login-btn:active:not(:disabled) {
    transform: translateY(0);
}

.login-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.loading-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-spinner.show {
    display: block;
}

/* 底部链接 */
.footer-links {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.footer-links a {
    font-size: 14px;
    color: #666;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: #667eea;
}

/* 弹窗 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    min-width: 300px;
    max-width: 400px;
    text-align: center;
}

.modal-message {
    font-size: 16px;
    color: #333;
    margin-bottom: 20px;
    line-height: 1.6;
}

.modal-close {
    width: 100%;
    height: 40px;
    background: linear-gradient(135deg, #5568d3 0%, #6a4190 100%);
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-close:hover {
    box-shadow: 0 6px 16px rgba(85, 104, 211, 0.4);
}

/* 响应式 */
@media (max-width: 480px) {
    body {
        padding: 16px;
    }

    .login-container {
        width: 100%;
        max-width: 100%;
    }

    .logo-text {
        width: 64px;
        height: 64px;
        font-size: 32px;
        margin-bottom: 24px;
    }

    .login-card {
        padding: 28px 20px;
        border-radius: 14px;
    }

    .login-title {
        font-size: 24px;
        margin-bottom: 24px;
    }

    .form-group {
        margin-bottom: 20px;
    }

    .form-label {
        font-size: 13px;
        margin-bottom: 6px;
    }

    .form-input {
        height: 46px;
        font-size: 15px;
        padding: 0 14px;
        border-radius: 7px;
    }

    .password-container .form-input {
        padding-right: 46px;
    }

    .toggle-password {
        width: 40px;
        height: 40px;
    }

    .captcha-container {
        gap: 8px;
        margin-bottom: 12px;
    }

    .captcha-image {
        height: 140px;
        border-radius: 7px;
    }

    .refresh-captcha {
        width: 46px;
        height: 46px;
        border-radius: 7px;
    }

    .captcha-hint {
        font-size: 11px;
        margin-top: 3px;
    }

    .login-btn {
        height: 50px;
        font-size: 16px;
        border-radius: 7px;
    }

    .error-tip {
        font-size: 12px;
        min-height: 15px;
    }

    .footer-links {
        margin-top: 20px;
        padding-top: 16px;
        font-size: 13px;
    }

    .footer-links a {
        font-size: 13px;
        padding: 4px 8px;
    }

    /* 模态框移动端优化 */
    .modal-content {
        margin: 20px;
        max-width: calc(100% - 40px);
        min-width: auto;
        padding: 24px 20px;
        border-radius: 12px;
    }

    .modal-message {
        font-size: 15px;
        margin-bottom: 16px;
    }

    .modal-close {
        height: 44px;
        font-size: 15px;
        border-radius: 7px;
    }
}

/* 超小屏幕优化（iPhone SE等） */
@media (max-width: 375px) {
    .captcha-image {
        height: 120px;
    }

    .refresh-captcha {
        width: 40px;
        height: 40px;
    }

    .form-input {
        height: 44px;
        font-size: 14px;
    }

    .login-btn {
        height: 48px;
        font-size: 15px;
    }
}
