/* 
   全局按钮点击修复 - 确保所有按钮可正常点击
   修复内容：
   1. 统一按钮层级（z-index）
   2. 确保 pointer-events 正确设置
   3. 防止伪元素遮挡按钮
   4. 修复 disabled 状态不影响启用状态
*/

/* ============================================================
   1. 全局按钮基础修复（最高优先级）
   ============================================================ */
.btn,
button:not([type="checkbox"]):not([type="radio"]),
input[type="button"],
input[type="submit"] {
    position: relative;
    z-index: 50 !important; /* 统一提升所有按钮层级，确保在最上层 */
    pointer-events: auto !important; /* 确保所有按钮可以点击 */
    cursor: pointer !important;
    user-select: none; /* 防止文字被选中影响点击 */
    -webkit-user-select: none;
    -moz-user-select: none;
}

/* 确保按钮伪元素不遮挡点击 */
.btn::before,
.btn::after,
button::before,
button::after {
    pointer-events: none !important; /* 伪元素不拦截点击事件 */
    z-index: -1; /* 伪元素在按钮内容之下 */
}

/* 2. 禁用状态按钮 */
.btn:disabled,
button:disabled,
input[type="button"]:disabled,
input[type="submit"]:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    pointer-events: none !important; /* 禁用状态确实不能点击 */
    filter: grayscale(0.5);
}

/* 3. 启用状态按钮（多重确保） */
.btn:not(:disabled),
button:not(:disabled),
input[type="button"]:not(:disabled),
input[type="submit"]:not(:disabled) {
    pointer-events: auto !important;
    cursor: pointer !important;
    opacity: 1 !important;
}

/* 4. 特定按钮类型修复 */
.btn-primary:not(:disabled),
.btn-secondary:not(:disabled),
.btn-outline:not(:disabled),
.btn-fancy-auth:not(:disabled) {
    z-index: 60 !important; /* 主要按钮层级更高 */
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* 5. 任务卡片按钮修复 */
.task-btn,
.task-actions .btn,
.task-actions button {
    z-index: 100 !important; /* 任务卡片按钮层级最高 */
    pointer-events: auto !important;
    position: relative; /* 确保 z-index 生效 */
}

.task-btn:not(:disabled) {
    cursor: pointer !important;
    pointer-events: auto !important;
}

/* 6. 视频清晰化页面按钮修复 */
#startEnhanceBtn,
#startImageEnhanceBtn,
.enhance-upload-box button,
.enhance-upload-box .btn {
    z-index: 80 !important;
    pointer-events: auto !important;
    position: relative;
}

#startEnhanceBtn:not(:disabled),
#startImageEnhanceBtn:not(:disabled) {
    cursor: pointer !important;
    pointer-events: auto !important;
    opacity: 1 !important;
}

/* 7. 模态框按钮修复 */
.modal-content .btn,
.modal-content button {
    z-index: 200 !important; /* 模态框按钮层级最高 */
    pointer-events: auto !important;
    position: relative;
}

.modal-close-btn {
    z-index: 250 !important;
    pointer-events: auto !important;
}

/* 8. 导航按钮修复 */
.nav-item,
.header .btn,
.header button {
    z-index: 100 !important;
    pointer-events: auto !important;
    position: relative;
}

/* 9. 表单按钮修复 */
form button,
form .btn,
.form-group button {
    z-index: 70 !important;
    pointer-events: auto !important;
    position: relative;
}

/* 10. 上传区域按钮修复 */
.image-upload-area button,
.video-upload-area button,
.remove-image-btn,
.remove-video-btn {
    z-index: 90 !important;
    pointer-events: auto !important;
    position: relative;
}

/* 11. 确保容器不遮挡按钮 */
.create-task-box,
.enhance-upload-box,
.auth-box,
.modal-content,
.task-item,
.page-section {
    position: relative; /* 确保子元素的 z-index 生效 */
    overflow: visible; /* 允许按钮区域可见 */
}

/* 12. 特殊修复：批量操作按钮 */
#batchCreateBtn,
#submitTaskBtn,
#batchDownloadBtn,
#batchDeleteBtn {
    z-index: 75 !important;
    pointer-events: auto !important;
    position: relative;
}

/* 13. 过滤标签按钮 */
.filter-tabs .tab-btn,
.filter-tabs button {
    z-index: 55 !important;
    pointer-events: auto !important;
    position: relative;
}

/* 14. 工具栏按钮 */
.task-toolbar .btn,
.task-toolbar button,
.toolbar-left button,
.toolbar-right button {
    z-index: 65 !important;
    pointer-events: auto !important;
    position: relative;
}

/* 15. 页面操作按钮 */
.page-actions .btn,
.page-actions button {
    z-index: 60 !important;
    pointer-events: auto !important;
    position: relative;
}

/* 16. 防止背景层遮挡（已移除动态背景） */

/* 17. 确保内容层在背景之上 */
.header,
.main-content,
.modal,
.page-section,
.auth-section {
    position: relative;
    z-index: 10 !important;
}

/* 18. 按钮悬停状态确保可点击 */
.btn:hover:not(:disabled),
button:hover:not(:disabled) {
    pointer-events: auto !important;
    z-index: 51 !important; /* 悬停时层级更高 */
}

/* 19. 按钮激活状态 */
.btn:active:not(:disabled),
button:active:not(:disabled) {
    pointer-events: auto !important;
    z-index: 51 !important;
}

/* 20. 防止按钮被文本选中影响 */
.btn,
button {
    -webkit-tap-highlight-color: transparent; /* 移除移动端点击高亮 */
    touch-action: manipulation; /* 优化触摸响应 */
}
