/* ============================================================
   全站动态透明模态框 / 提示
   ============================================================ */
body.bk-modal-open { overflow: hidden; }

.bk-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background: rgba(18, 28, 45, 0.26);
    -webkit-backdrop-filter: blur(10px) saturate(125%);
    backdrop-filter: blur(10px) saturate(125%);
    opacity: 0;
    transition: opacity 0.2s ease;
}
.bk-modal-overlay.is-open { opacity: 1; }

.bk-modal {
    position: relative;
    width: min(420px, 100%);
    border-radius: 22px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.95);
    background: linear-gradient(160deg, rgba(255, 253, 248, 0.94), rgba(251, 245, 236, 0.9));
    -webkit-backdrop-filter: blur(24px) saturate(140%);
    backdrop-filter: blur(24px) saturate(140%);
    box-shadow:
        0 34px 90px rgba(45, 60, 85, 0.24),
        0 8px 24px rgba(45, 60, 85, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
    transform: translateY(18px) scale(0.96);
    opacity: 0;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.22s ease;
}
.bk-modal-overlay.is-open .bk-modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}
.bk-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #60a5fa, #a78bfa, #f472b6, #fbbf24);
}
.bk-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #9aa8bb;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease;
}
.bk-modal-close:hover { background: rgba(120, 140, 170, 0.12); color: #5b6b82; }

.bk-modal-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 26px 26px 0;
}
.bk-modal-icon {
    flex: 0 0 auto;
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.35rem;
    background: linear-gradient(135deg, #60a5fa, #8b5cf6);
    box-shadow: 0 12px 26px rgba(96, 165, 250, 0.28);
}
.bk-modal--confirm .bk-modal-icon {
    background: linear-gradient(135deg, #fbbf24, #f97316);
    box-shadow: 0 12px 26px rgba(249, 115, 22, 0.26);
}
.bk-modal--success .bk-modal-icon {
    background: linear-gradient(135deg, #34d399, #059669);
    box-shadow: 0 12px 26px rgba(16, 185, 129, 0.24);
}
.bk-modal--error .bk-modal-icon {
    background: linear-gradient(135deg, #fb7185, #e11d48);
    box-shadow: 0 12px 26px rgba(225, 29, 72, 0.24);
}
.bk-modal--warning .bk-modal-icon {
    background: linear-gradient(135deg, #fbbf24, #f97316);
    box-shadow: 0 12px 26px rgba(249, 115, 22, 0.24);
}
.bk-modal-title {
    margin: 0;
    font-size: 1.04rem;
    font-weight: 800;
    color: #2f3b4f;
    line-height: 1.4;
}
.bk-modal-sub {
    margin: 3px 0 0;
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    color: #a3afc0;
}
.bk-modal-body {
    padding: 14px 26px 6px;
    color: #4d5b70;
    font-size: 0.9rem;
    line-height: 1.75;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 46vh;
    overflow-y: auto;
}
.bk-modal-input {
    width: 100%;
    margin-top: 12px;
    height: 42px;
    padding: 0 13px;
    border-radius: 11px;
    border: 1px solid rgba(150, 168, 195, 0.3);
    background: rgba(255, 255, 255, 0.72);
    color: #334155;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.bk-modal-input:focus {
    border-color: rgba(96, 165, 250, 0.75);
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.12);
}
.bk-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 18px 26px 24px;
}
.bk-modal-btn {
    min-width: 92px;
    height: 40px;
    padding: 0 18px;
    border: 0;
    border-radius: 11px;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.bk-modal-btn:active { transform: translateY(1px); }
.bk-modal-btn--ghost {
    background: rgba(126, 145, 171, 0.12);
    color: #5b6b82;
}
.bk-modal-btn--ghost:hover { background: rgba(126, 145, 171, 0.18); }
.bk-modal-btn--primary {
    color: #fff;
    background: linear-gradient(135deg, #4f7cf7, #8b5cf6);
    box-shadow: 0 10px 24px rgba(79, 124, 247, 0.28);
}
.bk-modal-btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(79, 124, 247, 0.36);
}
.bk-modal-btn--danger {
    color: #fff;
    background: linear-gradient(135deg, #fb923c, #ef4444);
    box-shadow: 0 10px 24px rgba(239, 68, 68, 0.26);
}
.bk-modal-btn--danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(239, 68, 68, 0.34);
}

@media (max-width: 520px) {
    .bk-modal-overlay { padding: 16px; }
    .bk-modal { border-radius: 18px; }
    .bk-modal-head { padding: 22px 20px 0; }
    .bk-modal-body { padding: 12px 20px 4px; }
    .bk-modal-actions { padding: 16px 20px 20px; }
    .bk-modal-btn { flex: 1; min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .bk-modal-overlay,
    .bk-modal { transition: none !important; }
}

/* 移动端降低模态框滤镜开销 */
@media (pointer: coarse) {
    .bk-modal-overlay {
        -webkit-backdrop-filter: blur(6px) saturate(110%);
        backdrop-filter: blur(6px) saturate(110%);
    }
    .bk-modal {
        -webkit-backdrop-filter: blur(12px) saturate(120%);
        backdrop-filter: blur(12px) saturate(120%);
    }
}

/* HTML 模态框（无底部按钮栏，body 支持自定义 HTML） */
.bk-modal-overlay--html .bk-modal-body {
    max-height: 85vh;
    overflow-y: auto;
    padding: 16px 26px 24px;
    white-space: normal;
    scrollbar-width: thin;
    scrollbar-color: rgba(150, 168, 195, 0.4) transparent;
}
.bk-modal-overlay--html .bk-modal-body::-webkit-scrollbar {
    width: 4px;
}
.bk-modal-overlay--html .bk-modal-body::-webkit-scrollbar-track {
    background: transparent;
}
.bk-modal-overlay--html .bk-modal-body::-webkit-scrollbar-thumb {
    background: rgba(150, 168, 195, 0.4);
    border-radius: 2px;
}
.bk-modal-overlay--html .bk-modal-body form {
    margin: 0;
}
.bk-modal-overlay--html .bk-modal-body .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 24px;
    border: 0;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
}
.bk-modal-overlay--html .bk-modal-body .btn-primary {
    background: linear-gradient(135deg, #4f7cf7, #8b5cf6);
    color: #fff;
    box-shadow: 0 8px 20px rgba(79, 124, 247, 0.3);
}
.bk-modal-overlay--html .bk-modal-body .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(79, 124, 247, 0.4);
}
.bk-modal-overlay--html .bk-modal-body .btn-primary:active {
    transform: translateY(0);
}
.bk-modal-overlay--html .bk-modal-body .btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}
@media (max-width: 520px) {
    .bk-modal-overlay--html .bk-modal-body {
        padding: 12px 18px 18px;
        max-height: 55vh;
    }
}

/* ============================================================
   个人资料编辑弹窗：精致表单样式
   ============================================================ */
.bk-modal-overlay--html .bk-modal {
    background: linear-gradient(165deg, rgba(255, 253, 250, 0.98), rgba(248, 244, 238, 0.96));
    border: 1px solid rgba(255, 255, 255, 0.95);
    max-width: 520px !important;
    display: flex;
    flex-direction: column;
    max-height: calc(100dvh - 44px);
}
.bk-modal-overlay--html .bk-modal-head {
    flex: none;
}
.bk-modal-overlay--html .bk-modal-body {
    padding: 0;
    flex: 1;
    min-height: 0;
    max-height: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
/* 可滚动内容区域 */
.bk-modal-overlay--html .profile-modal-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px 20px 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(150, 168, 195, 0.4) transparent;
}
/* 固定底部保存按钮栏 */
.bk-modal-overlay--html .profile-modal-footer {
    flex: none;
    padding: 12px 20px 16px;
    border-top: 1px solid rgba(150, 168, 195, 0.12);
    background: rgba(255, 253, 250, 0.95);
}
.bk-modal-overlay--html .profile-modal-footer .btn {
    width: 100%;
    padding: 11px 20px;
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.bk-modal-overlay--html .user-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 10px;
}
.bk-modal-overlay--html .user-form .form-group {
    margin-bottom: 14px;
}
.bk-modal-overlay--html .user-form label {
    display: block;
    font-size: 0.76rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: #5a6a82;
    letter-spacing: 0.02em;
}
.bk-modal-overlay--html .user-form input[type="text"],
.bk-modal-overlay--html .user-form input[type="email"],
.bk-modal-overlay--html .user-form input[type="password"],
.bk-modal-overlay--html .user-form textarea {
    width: 100%;
    padding: 7px 11px;
    border-radius: 8px;
    border: 1.5px solid rgba(150, 168, 195, 0.25);
    background: rgba(255, 255, 255, 0.85);
    color: #2f3b4f;
    font-family: inherit;
    font-size: 0.82rem;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.bk-modal-overlay--html .user-form input::placeholder,
.bk-modal-overlay--html .user-form textarea::placeholder {
    color: #a3afc0;
}
.bk-modal-overlay--html .user-form input:focus,
.bk-modal-overlay--html .user-form textarea:focus {
    border-color: #4f7cf7;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(79, 124, 247, 0.12);
    outline: none;
}
.bk-modal-overlay--html .user-form textarea {
    resize: vertical;
    min-height: 68px;
    line-height: 1.6;
}

/* 头像上传区域：水平布局，按钮不拉伸 */
.bk-modal-overlay--html .avatar-upload {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(79, 124, 247, 0.04);
    border-radius: 10px;
    border: 1px dashed rgba(79, 124, 247, 0.2);
}
.bk-modal-overlay--html .avatar-preview {
    width: 44px;
    height: 44px;
    flex: none;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #4f7cf7, #8b5cf6);
    border: 2px solid #fff;
    box-shadow: 0 4px 12px rgba(79, 124, 247, 0.25);
}
.bk-modal-overlay--html .avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.bk-modal-overlay--html .avatar-upload-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.bk-modal-overlay--html .avatar-file-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    width: auto;
    max-width: fit-content;
    padding: 7px 14px;
    border-radius: 50px;
    background: linear-gradient(135deg, #4f7cf7, #8b5cf6);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(79, 124, 247, 0.25);
    transition: all 0.25s ease;
    border: 0;
    white-space: nowrap;
}
.bk-modal-overlay--html .avatar-file-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(79, 124, 247, 0.35);
}
.bk-modal-overlay--html .avatar-file-btn input {
    display: none;
}
.bk-modal-overlay--html .avatar-tip {
    margin: 0;
    font-size: 0.68rem;
    color: #8a97ab;
    line-height: 1.5;
}

/* 保存按钮 */
.bk-modal-overlay--html .user-form button[type="submit"] {
    width: 100%;
    padding: 9px 20px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* 弹窗头部美化 */
.bk-modal-overlay--html .bk-modal-head {
    padding: 16px 20px 0;
    gap: 10px;
}
.bk-modal-overlay--html .bk-modal-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 0.9rem;
}
.bk-modal-overlay--html .bk-modal-title {
    font-size: 1rem;
    font-weight: 800;
    color: #2f3b4f;
}
.bk-modal-overlay--html .bk-modal-close {
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    color: #a3afc0;
    transition: all 0.2s ease;
}
.bk-modal-overlay--html .bk-modal-close:hover {
    background: rgba(120, 140, 170, 0.15);
    color: #5b6b82;
}

/* 移动端适配：全屏弹窗 + 固定底部保存按钮 */
@media (max-width: 520px) {
    .bk-modal-overlay--html {
        padding: 0;
        align-items: stretch;
    }
    .bk-modal-overlay--html .bk-modal {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 100dvh;
        height: 100dvh;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }
    .bk-modal-overlay--html .bk-modal-head {
        padding: 14px 18px 12px;
        gap: 10px;
        flex: none;
        border-bottom: 1px solid rgba(150, 168, 195, 0.1);
    }
    .bk-modal-overlay--html .bk-modal-body {
        padding: 0;
        max-height: none;
        flex: 1;
        min-height: 0;
        overflow: hidden;
    }
    .bk-modal-overlay--html .user-form {
        display: flex;
        flex-direction: column;
        height: 100%;
        min-height: 0;
    }
    /* 统一由内容区滚动，避免 body 与表单双重滚动 */
    .bk-modal-overlay--html .profile-modal-scroll {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 14px 18px 6px;
    }
    .bk-modal-overlay--html .profile-modal-footer {
        flex: none;
        padding: 10px 18px calc(12px + env(safe-area-inset-bottom));
    }
    .bk-modal-overlay--html .user-form .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    .bk-modal-overlay--html .user-form .form-group {
        margin-bottom: 14px;
    }
    .bk-modal-overlay--html .avatar-upload {
        gap: 12px;
        padding: 12px;
    }
    .bk-modal-overlay--html .avatar-preview {
        width: 48px;
        height: 48px;
        font-size: 1.05rem;
    }
    .bk-modal-overlay--html .avatar-file-btn {
        font-size: 0.72rem;
        padding: 6px 12px;
    }
}

/* 暗色模式适配 */
html[data-theme="dark"] .bk-modal-overlay--html .bk-modal {
    background: linear-gradient(165deg, rgba(30, 35, 48, 0.98), rgba(22, 26, 36, 0.96));
    border-color: rgba(255, 255, 255, 0.08);
}
html[data-theme="dark"] .bk-modal-overlay--html .bk-modal-title { color: #e2e8f0; }
html[data-theme="dark"] .bk-modal-overlay--html .user-form label { color: #94a3b8; }
html[data-theme="dark"] .bk-modal-overlay--html .user-form input,
html[data-theme="dark"] .bk-modal-overlay--html .user-form textarea {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
}
html[data-theme="dark"] .bk-modal-overlay--html .user-form input:focus,
html[data-theme="dark"] .bk-modal-overlay--html .user-form textarea:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: #4f7cf7;
}
html[data-theme="dark"] .bk-modal-overlay--html .avatar-upload {
    background: rgba(79, 124, 247, 0.08);
    border-color: rgba(79, 124, 247, 0.25);
}
html[data-theme="dark"] .bk-modal-overlay--html .avatar-preview { border-color: rgba(255,255,255,0.15); }
html[data-theme="dark"] .bk-modal-overlay--html .avatar-tip { color: #64748b; }
html[data-theme="dark"] .bk-modal-overlay--html .bk-modal-close { color: #64748b; }
html[data-theme="dark"] .bk-modal-overlay--html .bk-modal-close:hover { background: rgba(255,255,255,0.1); color: #94a3b8; }
