/* ========== CSS 变量 ========== */
:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #8b5cf6;
    --primary-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border-color: #e5e7eb;
    --danger-color: #ef4444;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
}

/* ========== 登录容器 ========== */
.login-wrapper {
    display: flex;
    width: 100%;
    max-width: 900px;
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    min-height: 520px;
}

/* 左侧品牌区 */
.login-banner {
    flex: 1;
    background: var(--primary-gradient);
    color: white;
    padding: 48px 36px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.login-banner::before {
    content: '';
    position: absolute;
    top: -100px;
    right: -100px;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.login-banner::after {
    content: '';
    position: absolute;
    bottom: -150px;
    left: -80px;
    width: 350px;
    height: 350px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
}

.banner-logo {
    display: flex;
    align-items: center;
    font-weight: 700;
    font-size: 22px;
    position: relative;
    z-index: 1;
}

.banner-logo .logo-icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    backdrop-filter: blur(10px);
}

.banner-content {
    position: relative;
    z-index: 1;
}

.banner-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1.3;
}

.banner-desc {
    font-size: 14px;
    opacity: 0.9;
    line-height: 1.7;
    margin-bottom: 24px;
}

.banner-features {
    list-style: none;
    position: relative;
    z-index: 1;
}

.banner-features > * + * {
    margin-top: 12px;
}

.banner-features li {
    display: flex;
    align-items: center;
    font-size: 13px;
    opacity: 0.95;
}

.banner-features svg {
    margin-right: 10px;
    flex-shrink: 0;
}

.banner-footer {
    font-size: 12px;
    opacity: 0.7;
    position: relative;
    z-index: 1;
}

/* 右侧表单区 */
.login-form-side {
    flex: 1;
    padding: 48px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.form-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 28px;
}

/* ========== 表单组件 ========== */
.form-group {
    margin-bottom: 18px;
}

.form-group > * + * {
    margin-top: 6px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-label .required {
    color: var(--danger-color);
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    display: flex;
    align-items: center;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 2;
}

.form-control {
    width: 100%;
    padding: 11px 14px 11px 42px;
    font-size: 14px;
    font-family: inherit;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: #f9fafb;
    transition: all 0.2s;
    box-sizing: border-box;
    display: block;
    height: 44px;
    outline: none;
    color: var(--text-primary);
}

.form-control:focus {
    border-color: var(--primary-color);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.password-toggle {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    z-index: 2;
}

.password-toggle:hover {
    color: var(--primary-color);
}

/* 验证码 */
.captcha-group {
    display: flex;
    align-items: center;
}

.captcha-group > * + * {
    margin-left: 10px;
}

.captcha-input {
    flex: 1;
}

.captcha-img {
    width: 110px;
    height: 44px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border-color);
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-primary);
    user-select: none;
    font-family: 'Courier New', monospace;
    font-style: italic;
    flex-shrink: 0;
}

.captcha-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.captcha-img:hover {
    border-color: var(--primary-color);
}

/* 选项行 */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    font-size: 13px;
}

.form-check {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.form-check input {
    margin-right: 6px;
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
}

.form-check label {
    color: var(--text-secondary);
    cursor: pointer;
}

.forgot-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.forgot-link:hover {
    text-decoration: underline;
}

/* ========== 统一按钮样式 ========== */
.btn-primary,
.btn-secondary,
.btn-cancel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1.5px solid transparent;
    line-height: 1.4;
    white-space: nowrap;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    border: none;
    width: 100%;
}

.btn-primary:hover {
    opacity: 0.92;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border-color: var(--border-color);
    width: 100%;
}

.btn-secondary:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.btn-cancel {
    background: white;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

/* 分隔符 */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 24px 0;
    color: var(--text-muted);
    font-size: 12px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.divider::before {
    margin-right: 12px;
}

.divider::after {
    margin-left: 12px;
}

/* 第三方登录 */
.social-login {
    display: flex;
    justify-content: center;
}

.social-login > * + * {
    margin-left: 12px;
}

.social-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border-color);
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
}

.social-btn:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

/* 页脚 */
.login-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
}

.login-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    margin-left: 4px;
}

.login-footer a:hover {
    text-decoration: underline;
}

/* 加载动画 */
.loading-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 8px;
}

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

/* ========== Toast ========== */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
}

.toast-container > * + * {
    margin-top: 12px;
}

.custom-toast {
    min-width: 280px;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary-color);
    overflow: hidden;
    transition: all 0.3s;
}

.custom-toast.success {
    border-left-color: var(--success-color);
}

.custom-toast.error {
    border-left-color: var(--danger-color);
}

.custom-toast.warning {
    border-left-color: var(--warning-color);
}

.toast-body {
    padding: 12px 16px;
    display: flex;
    align-items: center;
}

.toast-body > * + * {
    margin-left: 10px;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .login-wrapper {
        flex-direction: column;
        max-width: 440px;
    }

    .login-banner {
        padding: 28px 24px;
        min-height: auto;
    }

    .banner-title {
        font-size: 20px;
    }

    .banner-features {
        display: none;
    }

    .login-form-side {
        padding: 32px 24px;
    }
}
