/* ============================================================
 *  登录弹窗样式 v5.5
 * ============================================================ */

* { box-sizing: border-box; }

/* ===== 遮罩层 ===== */
#login-popup-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99999;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
    margin: 0;
}

/* ===== 弹窗主体 ===== */
#login-popup-modal {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 820px;
    max-width: 100%;
    height: 560px;
    max-height: 90vh;
    position: relative;
    animation: loginPopupFadeIn 0.35s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    border: none;
}

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

/* ===== 关闭按钮 ===== */
#login-popup-close {
    position: absolute;
    top: 14px; right: 18px;
    font-size: 30px;
    font-weight: 300;
    color: #999;
    cursor: pointer;
    z-index: 10;
    line-height: 1;
    transition: color 0.2s;
    background: none;
    border: none;
    padding: 0; margin: 0;
    width: auto; height: auto;
}
#login-popup-close:hover { color: #333; }

/* ===== 左右分栏 ===== */
#login-popup-container {
    display: flex;
    height: 100%;
    min-height: 0;
    flex: 1;
    overflow: hidden;
}

/* ===== 左侧图片 ===== */
#login-popup-image {
    flex: 0 0 45%;
    background: #f0f4f8;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 0;
}
#login-popup-image img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}

/* ===== 右侧表单区域 ===== */
#login-popup-form-area {
    flex: 1;
    padding: 28px 32px 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #ffffff;
    min-width: 0;
    overflow-y: auto;
    height: 100%;
    box-sizing: border-box;
}

#login-popup-form-area h2 {
    margin: 0 0 2px 0;
    padding: 0;
    font-size: 22px;
    font-weight: 700;
    color: #1a1a2e;
    letter-spacing: -0.5px;
    flex-shrink: 0;
    line-height: 1.4;
    background: none;
    border: none;
}

.login-subtitle {
    margin: 0 0 14px 0;
    padding: 0;
    color: #888;
    font-size: 13px;
    flex-shrink: 0;
    line-height: 1.5;
    background: none;
    border: none;
}

/* ===== 表单字段 ===== */
.login-field {
    margin-bottom: 12px;
    flex-shrink: 0;
    padding: 0;
    border: none;
    background: none;
}
.login-field label {
    display: block;
    margin-bottom: 4px;
    padding: 0;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    line-height: 1.5;
    background: none;
    border: none;
}
.login-field input[type="text"],
.login-field input[type="password"] {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.25s, box-shadow 0.25s;
    background: #f7fafc;
    outline: none;
    box-sizing: border-box;
    margin: 0;
    color: #333;
    font-family: inherit;
    height: auto;
    line-height: 1.5;
}
.login-field input[type="text"]:focus,
.login-field input[type="password"]:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
    background: #fff;
}

/* ===== 密码显示切换 ===== */
.password-wrapper { position: relative; display: block; }
.password-wrapper input[type="password"],
.password-wrapper input[type="text"] { padding-right: 48px; }

.toggle-password {
    position: absolute;
    right: 12px; top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    font-size: 18px;
    line-height: 1;
    opacity: 0.5;
    transition: opacity 0.2s;
    color: #555;
    margin: 0;
    width: auto; height: auto;
}
.toggle-password:hover { opacity: 1; }
.toggle-password .eye-icon { display: inline-block; font-style: normal; }

/* ===== 密码强度检测 ===== */
.password-strength {
    margin-top: 6px;
    display: none;
}
.password-strength.visible {
    display: block;
}
.password-strength-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}
.password-strength-fill {
    height: 100%;
    width: 0;
    background: #dc2626;
    border-radius: 3px;
    transition: width 0.25s, background 0.25s;
}
.password-strength-text {
    font-size: 12px;
    color: #666;
    line-height: 1.5;
}

.password-hint {
    margin-top: 4px;
    font-size: 12px;
    color: #888;
    line-height: 1.5;
}

/* ===== 视图切换 ===== */
.popup-view { width: 100%; }

.view-switch {
    color: #4f46e5;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
}
.view-switch:hover { text-decoration: underline; }

/* ===== 图形点选验证码 ===== */
.captcha-field label {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}
.security-label {
    font-weight: 600;
    color: #333;
    font-size: 13px;
}
.captcha-instruction {
    font-size: 12px;
    color: #888;
    font-weight: 400;
}
.refresh-captcha {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 0 4px;
    opacity: 0.6;
    transition: opacity 0.2s, transform 0.2s;
    line-height: 1;
    margin: 0;
    width: auto; height: auto;
}
.refresh-captcha:hover { opacity: 1; transform: rotate(180deg); }
.refresh-captcha:disabled { cursor: not-allowed; }

.captcha-hint {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
    padding: 8px 10px;
    background: #f0f0ff;
    border-radius: 8px;
    min-height: 40px;
}
.captcha-hint-item {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 13px;
    color: #4f46e5;
    font-weight: 500;
}
.captcha-hint-emoji { font-size: 18px; line-height: 1; }
.captcha-hint-arrow { color: #a5b4fc; font-size: 13px; margin: 0 2px; }

.captcha-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 4px;
}
.captcha-item {
    position: relative;
    aspect-ratio: 1 / 1;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    background: #f7fafc;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: border-color 0.2s, background 0.2s, transform 0.1s;
    font-family: inherit;
}
.captcha-item:hover { border-color: #a5b4fc; background: #eef2ff; }
.captcha-item:active { transform: scale(0.95); }
.captcha-item.selected {
    border-color: #4f46e5;
    background: #e0e7ff;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.15);
}
.captcha-emoji { font-size: 26px; line-height: 1; pointer-events: none; }
.captcha-badge {
    position: absolute;
    top: -6px; right: -6px;
    min-width: 20px; height: 20px;
    line-height: 20px;
    border-radius: 10px;
    background: #4f46e5;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    padding: 0 5px;
    display: none;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.4);
}
.captcha-loading,
.captcha-error {
    grid-column: 1 / -1;
    text-align: center;
    color: #888;
    font-size: 13px;
    padding: 20px 0;
}
.captcha-error { color: #e53e3e; }

/* ===== 选项行 ===== */
.login-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    font-size: 13px;
    flex-shrink: 0;
    padding: 0;
    border: none;
    background: none;
    min-height: 32px;
    flex-wrap: nowrap;
}
.login-options label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #555;
    cursor: pointer;
    font-size: 13px;
    font-weight: 400;
    margin: 0;
    padding: 0;
    white-space: nowrap;
}
.login-options input[type="checkbox"] {
    width: 15px; height: 15px;
    accent-color: #4f46e5;
    cursor: pointer;
    margin: 0; padding: 0;
    flex-shrink: 0;
}
.forgot-password {
    color: #4f46e5;
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
    white-space: nowrap;
    padding: 0; margin: 0;
    flex-shrink: 0;
}
.forgot-password:hover { text-decoration: underline; }

/* ===== 提交按钮 ===== */
.login-submit-wrap { margin-bottom: 6px; flex-shrink: 0; }

#login-popup-submit,
#register-submit,
#lostpassword-submit {
    width: 100%;
    padding: 11px;
    background: #4f46e5;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.25s, transform 0.1s;
    font-family: inherit;
    line-height: 1.5;
    margin: 0;
}
#login-popup-submit:hover,
#register-submit:hover,
#lostpassword-submit:hover { background: #4338ca; }

#login-popup-submit:active,
#register-submit:active,
#lostpassword-submit:active { transform: scale(0.98); }

#login-popup-submit:disabled,
#register-submit:disabled,
#lostpassword-submit:disabled { opacity: 0.6; cursor: not-allowed; }

/* ===== 消息提示 ===== */
#login-popup-message,
#register-popup-message,
#lostpassword-popup-message {
    margin-top: 4px;
    padding: 4px 0;
    font-size: 13px;
    text-align: center;
    color: #e53e3e;
    min-height: 24px;
    flex-shrink: 0;
    border: none;
    background: none;
}
#login-popup-message.success,
#register-popup-message.success,
#lostpassword-popup-message.success { color: #38a169; }

/* ===== 注册链接 ===== */
.login-register-link {
    text-align: center;
    margin-top: 10px;
    font-size: 13px;
    color: #666;
    border-top: 1px solid #eee;
    padding-top: 10px;
    flex-shrink: 0;
    background: none;
}
.login-register-link a {
    color: #4f46e5;
    text-decoration: none;
    font-weight: 500;
}
.login-register-link a:hover { text-decoration: underline; }

/* ===== 触发按钮 ===== */
#login-popup-trigger-button {
    background: #4f46e5;
    color: #fff;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.25s, transform 0.1s;
    font-family: inherit;
    line-height: 1.5;
}
#login-popup-trigger-button:hover { background: #4338ca; }
#login-popup-trigger-button:active { transform: scale(0.97); }

.menu-login-btn {
    background: #4f46e5;
    color: #fff !important;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.25s;
    font-family: inherit;
    line-height: 1.5;
}
.menu-login-btn:hover { background: #4338ca; }

.login-popup-logged-in { color: #38a169; font-weight: 500; }

/* ============================================================
 *  响应式
 * ============================================================ */
@media (max-width: 768px) {
    #login-popup-overlay { padding: 12px; align-items: center; }
    #login-popup-modal {
        width: 420px;
        max-width: 100%;
        height: auto;
        max-height: 92vh;
        border-radius: 12px;
        min-height: 0;
    }
    #login-popup-container { flex-direction: column; height: auto; min-height: auto; }
    #login-popup-image { display: none; }
    #login-popup-form-area {
        padding: 24px 20px 20px;
        height: auto;
        max-height: 80vh;
        overflow-y: auto;
    }
    #login-popup-form-area h2 { font-size: 20px; }

    .login-options { flex-wrap: nowrap; gap: 10px; min-height: 30px; }
    .login-options label,
    .forgot-password { font-size: 12px; white-space: nowrap; }

    #login-popup-close { top: 10px; right: 14px; font-size: 26px; }

    .captcha-hint-item { font-size: 12px; }
    .captcha-hint-emoji { font-size: 16px; }
    .captcha-emoji { font-size: 22px; }
}

@media (max-width: 480px) {
    #login-popup-form-area { padding: 18px 14px 16px; }
    .login-field input[type="text"],
    .login-field input[type="password"] { padding: 9px 12px; font-size: 14px; }

    #login-popup-submit,
    #register-submit,
    #lostpassword-submit { padding: 10px; font-size: 15px; }

    .captcha-hint-item { font-size: 11px; }
    .captcha-hint-emoji { font-size: 15px; }
    .captcha-emoji { font-size: 20px; }
    .login-options label,
    .forgot-password { font-size: 11px; }
}

@media (max-width: 380px) {
    .login-options { flex-wrap: wrap; gap: 4px; justify-content: center; }
}