/* DS随心转登录弹窗样式 (Web Adaptation) */
:root {
    /* 继承主弹窗的CSS变量系统 */
    --theme-blue-primary: #2563EB;
    --theme-blue-primary-hover: #1D4ED8;
    --theme-blue-light: #EFF6FF;
    --theme-blue-lighter: #F0F9FF;

    /* Colors from "Digital Study" Palette */
    --bg-rice-paper: #FAF9F6;
    --text-ink-black: #2B2B2B;
    --text-stone-gray: #666666;
    --border-soft: #E5E7EB;

    /* Status Colors */
    --success-color: #10B981;
    --error-color: #EF4444;

    /* Layout */
    --border-radius-main: 8px;
    --border-radius-large: 16px;
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-float: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* 覆盖层样式 - 替代原插件的 body/container */
#loginModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    /* 半透明遮罩 */
    z-index: 9999;
    /* 确保在最上层 */
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
    /* 添加背景模糊 */
    /* 动画由 JS 控制，避免与 JS animate 冲突 */
}

@keyframes fadeInModal {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* 登录框样式 - Split Layout */
.login-box {
    width: 720px;
    max-width: 95vw;
    height: 520px;
    background: #ffffff;
    border-radius: var(--border-radius-large);
    box-shadow: var(--shadow-float);
    overflow: hidden;
    display: flex;
    /* 动画由 JS 控制 */
    position: relative;
    /* 确保子元素定位参照此 */
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Left Panel - Promotional */
.login-left-panel {
    width: 40%;
    background: linear-gradient(135deg, #F0F9FF 0%, #E0F2FE 100%);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    border-right: 1px solid var(--border-soft);
}

.promo-visuals {
    width: 100%;
    max-width: 220px;
    margin-bottom: 24px;
    display: flex;
    justify-content: center;
}

.promo-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.15);
    transition: transform 0.3s ease;
}

.promo-image:hover {
    transform: translateY(-2px);
}

.promo-text {
    text-align: center;
    padding: 0 10px;
}

.promo-text h3 {
    font-family: 'Noto Serif SC', 'Source Han Serif', serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-ink-black);
    margin-bottom: 8px;
}

.promo-text p {
    font-size: 13px;
    color: var(--text-stone-gray);
    line-height: 1.5;
}

/* Right Panel - Form */
.login-right-panel {
    width: 60%;
    padding: 30px 40px;
    display: flex;
    flex-direction: column;
    position: relative;
    background: #ffffff;
}

.login-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #9CA3AF;
    font-size: 24px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 10;
}

.login-modal-close:hover {
    background: var(--theme-blue-light);
    color: var(--theme-blue-primary);
}

.login-header {
    margin-bottom: 24px;
    text-align: left;
    padding-top: 10px;
}

.login-header h2 {
    font-family: 'Noto Serif SC', 'Source Han Serif', serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-ink-black);
    letter-spacing: -0.5px;
    margin-bottom: 0;
    /* Reset default margin */
}

/* Tabs */
.login-type-tabs {
    display: flex;
    background: var(--bg-rice-paper);
    border-radius: var(--border-radius-main);
    padding: 4px;
    margin-bottom: 20px;
    border: 1px solid var(--border-soft);
}

.login-type-tab {
    flex: 1;
    padding: 8px;
    border: none;
    background: transparent;
    color: var(--text-stone-gray);
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.login-type-tab.active {
    background: #ffffff;
    color: var(--theme-blue-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    font-weight: 600;
}

/* Forms with Icons */
.form-group {
    margin-bottom: 16px;
}

.form-group.has-icon {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #9CA3AF;
    display: flex;
    align-items: center;
    transition: color 0.3s ease;
    pointer-events: none;
    z-index: 1;
    /* Verify formatting */
}

.form-input {
    width: 100%;
    padding: 12px 16px 12px 48px;
    border: 1px solid var(--border-soft);
    border-radius: var(--border-radius-main);
    font-size: 14px;
    background: var(--bg-rice-paper);
    transition: all 0.2s ease;
    color: var(--text-ink-black);
    box-shadow: none;
    /* Reset web styles */
}

/* 强制确保登录弹窗内带图标输入框左侧留白，避免图标与 placeholder 重叠 */
#loginModal .form-group.has-icon .form-input {
    padding-left: 48px;
}

#loginModal .form-group.has-icon .input-icon {
    width: 20px;
    height: 20px;
    justify-content: center;
}

#loginModal .form-group.has-icon .input-icon svg {
    display: block;
    width: 18px;
    height: 18px;
}

.form-input:focus {
    outline: none;
    border-color: var(--theme-blue-primary);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input:focus~.input-icon,
.form-group:focus-within .input-icon {
    color: var(--theme-blue-primary);
}

.verify-code-group {
    display: flex;
    gap: 12px;
}

.send-code-btn {
    padding: 0 16px;
    background: var(--theme-blue-light);
    color: var(--theme-blue-primary);
    border: 1px solid transparent;
    border-radius: var(--border-radius-main);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    /* Fixed height to match input */
    line-height: normal;
}

.send-code-btn:hover {
    background: var(--theme-blue-lighter);
    border-color: var(--theme-blue-primary);
    color: var(--theme-blue-primary-hover);
}

/* 统一登录弹窗验证码按钮配色，覆盖旧样式 */
#loginModal .send-code-btn {
    background: var(--theme-blue-primary);
    color: #ffffff;
    border: 1px solid var(--theme-blue-primary);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.22);
}

#loginModal .send-code-btn:hover:not(:disabled) {
    background: var(--theme-blue-primary-hover);
    border-color: var(--theme-blue-primary-hover);
    color: #ffffff;
}

#loginModal .send-code-btn:disabled {
    background: #94A3B8;
    border-color: #94A3B8;
    color: #ffffff;
    cursor: not-allowed;
    box-shadow: none;
}

.login-submit-btn {
    width: 100%;
    padding: 14px;
    background: var(--theme-blue-primary);
    color: white;
    border: none;
    border-radius: var(--border-radius-main);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.2);
}

.login-submit-btn:hover {
    background: var(--theme-blue-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 8px rgba(37, 99, 235, 0.25);
    color: white;
}

/* Password Toggle */
.password-input-wrapper {
    position: relative;
    width: 100%;
}

.password-toggle-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9CA3AF;
    cursor: pointer;
    padding: 4px;
    display: flex;
    z-index: 2;
}

.password-toggle-btn:hover {
    color: var(--text-ink-black);
}

/* Links & Extra Actions */
.login-actions {
    margin-top: 16px;
    text-align: center;
}

.set-password-link-btn {
    background: none;
    border: none;
    color: var(--theme-blue-primary);
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
}

.set-password-link-btn:hover {
    text-decoration: underline;
}

.login-tips {
    margin-top: 24px;
    text-align: center;
}

.login-tips p {
    font-size: 12px;
    color: #9CA3AF;
    margin: 0;
}

.login-tips a {
    color: var(--text-stone-gray);
    text-decoration: underline;
}

.login-tips a:hover {
    color: var(--theme-blue-primary);
}

/* Set Password Header Row */
.set-password-header-row {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.back-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: var(--text-stone-gray);
    margin-right: 8px;
    transition: background 0.2s;
    background: none;
    border: none;
    cursor: pointer;
}

.back-icon-btn:hover {
    background: var(--bg-rice-paper);
    color: var(--text-ink-black);
}

.set-pwd-title {
    font-size: 18px;
    font-weight: 600;
}

.login-set-submit-btn {
    width: 100%;
    padding: 14px;
    background: var(--theme-blue-primary);
    color: white;
    border: none;
    border-radius: var(--border-radius-main);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
}

/* 设置密码页主按钮统一为当前蓝色体系，覆盖旧渐变样式 */
#loginModal .login-set-submit-btn {
    background: var(--theme-blue-primary);
    color: #ffffff;
    border: 1px solid var(--theme-blue-primary);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.22);
    transition: all 0.2s ease;
}

#loginModal .login-set-submit-btn:hover:not(:disabled) {
    background: var(--theme-blue-primary-hover);
    border-color: var(--theme-blue-primary-hover);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 6px 10px rgba(29, 78, 216, 0.24);
}

#loginModal .login-set-submit-btn:disabled {
    background: #94A3B8;
    border-color: #94A3B8;
    color: #ffffff;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Display Control */
.login-form {
    display: none;
}

.login-form.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    .login-box {
        flex-direction: column;
        width: 100%;
        height: auto;
        border-radius: 16px 16px 0 0;
        position: absolute;
        bottom: 0;
        animation: slideUp 0.3s ease-out;
    }

    @keyframes slideUp {
        from {
            transform: translateY(100%);
        }

        to {
            transform: translateY(0);
        }
    }

    .login-left-panel {
        display: none;
    }

    .login-right-panel {
        width: 100%;
        padding: 24px;
    }

    #loginModal {
        align-items: flex-end;
        /* Align bottom on mobile */
    }
}