/* ==========================================================================
   1. 变量定义 (CSS Variables)
   ========================================================================== */
:root {
    /* 暗色模式 (默认) */
    --primary-bg: radial-gradient(circle at top left, #1a2a3a 0%, #0f1a25 50%, #0a1018 100%);
    --card-bg: #1e2832;
    --text-color: #E0E0E0;
    --light-text-color: #A0B0C0;
    --input-bg: #2a3540;
    --input-border: #4a5a6a;

    --gradient-start: #00b4d8;
    --gradient-end: #0077b6;
    --active-tab-bg: linear-gradient(to right, #00b4d8, #0077b6);
    --inactive-tab-bg: #2a3540;
    --logo-bg: linear-gradient(to right, #48cae4, #00b4d8);

    --shadow-color: rgba(0, 0, 0, 0.5);
    --strength-weak: #e74c3c;
    --strength-medium: #f39c12;
    --strength-strong: #2ecc71;
}

/* 亮色模式类名切换 */
body.light-mode {
    --primary-bg: radial-gradient(circle at top left, #e2e8f0 0%, #f8fafc 50%, #cbd5e1 100%);
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --light-text-color: #64748b;
    --input-bg: #f1f5f9;
    --input-border: #cbd5e1;
    --inactive-tab-bg: #e2e8f0;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   2. 全局基础样式
   ========================================================================== */
body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--primary-bg);
    background-attachment: fixed; /* 背景固定 */
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    font-size: 16px;
    line-height: 1.6;
    transition: background 0.4s ease, color 0.4s ease; /* 切换主题时的平滑过渡 */
}

.login-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

/* ==========================================================================
   3. 核心容器 (Card)
   ========================================================================== */
.login-container {
    background-color: var(--card-bg);
    border-radius: 20px;
    padding: 35px 40px;
    box-shadow: 0 10px 40px var(--shadow-color);
    width: 100%;
    max-width: 460px;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
    transition: background-color 0.4s ease, box-shadow 0.4s ease;
}

/* ==========================================================================
   4. 头部导航 (修复不和谐感)
   ========================================================================== */
.header-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 35px;
    gap: 15px;
}

.logo-btn {
    background: var(--logo-bg);
    padding: 8px 16px;
    border-radius: 10px;
    color: white !important; /* 确保Logo在亮色模式下文字依然是白色 */
    font-weight: bold;
    font-size: 0.95em;
    cursor: default;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
}

.nav-tabs {
    display: flex;
    gap: 5px;
    background-color: var(--inactive-tab-bg);
    padding: 4px;
    border-radius: 12px;
}

.nav-tab {
    background-color: transparent;
    border: none;
    padding: 6px 15px;
    border-radius: 8px;
    color: var(--light-text-color);
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 600;
    transition: all 0.3s ease;
}

.nav-tab:hover {
    color: var(--text-color);
}

.nav-tab.active {
    background: var(--active-tab-bg);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   5. 表单内容区
   ========================================================================== */
.form-section {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.form-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.form-section h2 {
    text-align: center;
    color: var(--text-color);
    margin: 0 0 8px 0;
    font-size: 1.7em;
}

.form-section .description {
    text-align: center;
    color: var(--light-text-color);
    font-size: 0.85em;
    margin-bottom: 25px;
}

/* ==========================================================================
   6. 输入框与表单项
   ========================================================================== */
.input-group {
    margin-bottom: 18px;
    position: relative;
}

.input-group label {
    display: block;
    color: var(--light-text-color);
    margin-bottom: 8px;
    font-size: 0.85em;
    font-weight: 500;
}

.input-group input[type="text"],
.input-group input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 10px;
    color: var(--text-color);
    font-size: 0.95em;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.input-group input:focus {
    border-color: var(--gradient-start);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.15);
}

/* 密码显示/隐藏按钮修复 */
.password-input-group {
    position: relative;
}

.password-input-group .password-toggle {
    position: absolute;
    right: 12px;
    top: 32px; /* 精确对齐输入框中心 */
    height: 42px; /* 匹配输入框高度 */
    background: none;
    border: none;
    color: var(--light-text-color);
    cursor: pointer;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    z-index: 2;
}

/* 复选框定制 */
.checkbox-group {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
    font-size: 0.85em;
}

.checkbox-group input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--input-border);
    border-radius: 5px;
    background-color: var(--input-bg);
    margin-right: 10px;
    cursor: pointer;
    position: relative;
}

.checkbox-group input[type="checkbox"]:checked {
    border-color: var(--gradient-start);
    background: var(--gradient-start);
}

.checkbox-group input[type="checkbox"]:checked::before {
    content: '\eb7a'; /* Remix Icon 的 check 图标编码或直接用 ✓ */
    font-family: 'remixicon';
    display: block;
    color: white;
    font-size: 14px;
    text-align: center;
}

.checkbox-group label {
    color: var(--light-text-color);
    cursor: pointer;
}

/* ==========================================================================
   7. 按钮与强度条
   ========================================================================== */
.primary-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(to right, var(--gradient-start), var(--gradient-end));
    color: white;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 180, 216, 0.3);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 180, 216, 0.4);
}

.password-strength-indicator {
    display: flex;
    gap: 5px;
    margin: -10px 0 20px 0;
    height: 6px;
}

.strength-bar {
    flex: 1;
    background-color: var(--input-border);
    border-radius: 10px;
    transition: background-color 0.3s ease;
}

.strength-bar.active.weak { background-color: var(--strength-weak); }
.strength-bar.active.medium { background-color: var(--strength-medium); }
.strength-bar.active.strong { background-color: var(--strength-strong); }
@keyframes spin {
    to { transform: rotate(360deg); }
}
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}
/* 禁用状态下的按钮 */
.primary-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important; /* 禁用缩放效果 */
    box-shadow: none !important;
}

/* ==========================================================================
   8. 主题切换按钮 (右下角)
   ========================================================================== */
.theme-toggle-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: var(--card-bg);
    border: 1px solid var(--input-border);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 5px 15px var(--shadow-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-color);
    font-size: 1.4em;
    z-index: 100;
}

.theme-toggle-btn:hover {
    transform: scale(1.1) rotate(15deg);
}

/* ==========================================================================
   9. 响应式适配
   ========================================================================== */
@media (max-width: 500px) {
    .login-container {
        padding: 30px 25px;
        margin: 20px;
        border-radius: 15px;
    }

    .header-nav {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-tabs {
        width: 100%;
    }

    .nav-tab {
        flex: 1;
        text-align: center;
    }
}
/* ==========================================================================
   10. 模态框遮罩
   ========================================================================== */
.modal-overlay {
    display: none; /* 默认隐藏 */
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

/* 模态框主体 */
.modal-content {
    background: var(--card-bg);
    width: 90%;
    max-width: 500px;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--input-border);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-desc {
    color: var(--light-text-color);
    font-size: 0.95em;
    line-height: 1.6;
    margin-bottom: 25px;
}

/* 验证码框 */
.verify-code-box {
    background: rgba(0, 0, 0, 0.3);
    border: 1px dashed var(--gradient-start);
    padding: 15px;
    border-radius: 12px;
    font-size: 2em;
    letter-spacing: 5px;
    color: var(--text-color);
    margin-bottom: 30px;
    font-family: 'Courier New', Courier, monospace;
}

/* 按钮组 */
.modal-btn-group {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 25px;
}

.modal-btn {
    border: none;
    padding: 12px 5px;
    border-radius: 10px;
    color: white;
    font-weight: bold;
    font-size: 0.85em;
    cursor: pointer;
    transition: transform 0.2s;
}

.modal-btn:hover { transform: scale(1.05); }

.purple-btn { background: linear-gradient(135deg, #8E2DE2, #4A00E0); }
.cyan-btn { background: linear-gradient(135deg, #2af598, #009efd); }
.pink-btn { background: linear-gradient(135deg, #f093fb, #f5576c); }

.modal-footer { font-size: 0.85em; color: var(--light-text-color); }
.countdown-text {
    margin-top: 15px;
    font-size: 1.2em;
    font-weight: bold;
    color: #ff4757;
}

/* ==========================================================================
   11. 弹窗优化
   ========================================================================== */
/* Toast 容器 */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
}

/* Toast 单体样式 */
.toast {
    min-width: 250px;
    margin-bottom: 10px;
    padding: 16px 20px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    color: #333;
    border-left: 4px solid #ccc;
}

/* 深色模式适配 */
body.dark-mode .toast {
    background: rgba(30, 41, 59, 0.8);
    color: #fff;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.toast.show {
    transform: translateX(0);
}

/* 不同类型的颜色 */
.toast.success { border-left-color: #10b981; }
.toast.error { border-left-color: #ef4444; }
.toast.warning { border-left-color: #f59e0b; }

.toast i {
    margin-right: 12px;
    font-size: 1.2rem;
}
