/**
 * 统一弹出菜单基础样式
 * 路径: css/popup-menu-base.css
 * 版本: Unified-2.0 - 优化版（顶部工具栏+紧凑间距）
 * 包含: 模态框、列表、搜索框、标签、徽章
 */

/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   第一部分：模态框基础
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

.dependency-selector-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.dependency-selector-modal.show {
    opacity: 1;
}

.dependency-selector-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    cursor: pointer;
}

/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   第二部分：弹出菜单容器（统一样式）
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

.dependency-selector-content {
    position: relative;
    width: 480px;
    max-width: 90vw;
    max-height: 80vh;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3),
                0 2px 8px rgba(0, 0, 0, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(102, 126, 234, 0.2);
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    animation: popupFadeIn 0.3s ease-out;
}

.dependency-selector-modal.show .dependency-selector-content {
    transform: scale(1);
}

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

/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   第三部分：⭐ 统一的头部工具栏（新样式）
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

.dependency-selector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 2px solid #dee2e6;
    border-radius: 12px 12px 0 0;
}

.dependency-selector-header .d-flex {
    display: flex;
    gap: 8px;
    align-items: center;
}

.dependency-selector-header h6 {
    font-size: 0.9rem;
    font-weight: 700;
    color: #495057;
    margin: 0;
}

/* ⭐ 保存按钮（参照任务编辑表单） */
.dependency-selector-header .btn-primary {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.dependency-selector-header .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* ⭐ 关闭按钮（X样式） */
.dependency-selector-header .btn-close {
    background: rgba(102, 126, 234, 0.1);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.5rem;
    color: #667eea;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.dependency-selector-header .btn-close:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: rotate(90deg);
}

/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   第四部分：主体内容区
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

.dependency-selector-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
}

.dependency-selector-body::-webkit-scrollbar {
    width: 6px;
}

.dependency-selector-body::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.dependency-selector-body::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* 搜索框 */
#depsSearchInput {
    width: 100%;
    padding: 8px 8px 8px 32px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 12px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23999' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 8px center;
    transition: all 0.2s ease;
}

#depsSearchInput:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
    outline: none;
}

/* ⭐ 任务列表（更紧凑的间距） */
.deps-list {
    max-height: 300px;
    overflow-y: auto;
}

.deps-list::-webkit-scrollbar {
    width: 6px;
}

.deps-list::-webkit-scrollbar-thumb {
    background: #dee2e6;
    border-radius: 3px;
}

.deps-item {
    padding: 6px 12px; /* ⭐ 从 8px 减少到 6px */
    margin-bottom: 2px; /* ⭐ 从 4px 减少到 2px */
    border-radius: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.deps-item:hover:not(.deps-item-disabled) {
    background: rgba(102, 126, 234, 0.05);
}

.deps-item .form-check-input {
    cursor: pointer;
    margin-top: 2px;
}

.deps-item .form-check-label {
    cursor: pointer;
    user-select: none;
    font-size: 0.85rem;
    line-height: 1.4; /* ⭐ 从 1.6 减少到 1.4 */
}

.deps-item .form-check-input:checked ~ .form-check-label {
    color: #667eea;
    font-weight: 600;
}

/* 禁用项样式 */
.deps-item-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f8f9fa;
}

.deps-item-disabled:hover {
    background: #f8f9fa;
}

.deps-item-disabled .form-check-input,
.deps-item-disabled .form-check-label {
    cursor: not-allowed;
}

.deps-item-disabled .form-check-label {
    text-decoration: line-through;
}

/* WBS 徽章 */
.wbs-badge-small {
    display: inline-block;
    padding: 1px 5px;
    background: rgba(102, 126, 234, 0.15);
    color: #667eea;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    margin-right: 4px;
}

/* 任务类型徽章 */
.deps-item .badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    margin-left: 6px;
    font-weight: 500;
}

/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   第五部分：⭐ 底部状态栏（移除操作按钮）
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

.dependency-selector-footer {
    padding: 10px 16px; /* ⭐ 从 12px 减少到 10px */
    background: #f8f9fa;
    border-top: 2px solid #dee2e6;
    border-radius: 0 0 12px 12px;
}

.dependency-selector-footer .text-muted {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0; /* ⭐ 移除底部间距 */
    font-size: 0.8rem;
    color: #6c757d;
}

.dependency-selector-footer #selectedCount {
    color: #667eea;
    font-weight: 700;
    font-size: 0.9rem;
}

.dependency-selector-footer .text-info {
    font-size: 0.7rem;
    color: #6c757d;
}

/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   第六部分：临时提示气泡
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

.temp-tooltip {
    position: absolute;
    background: rgba(220, 53, 69, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    z-index: 9999;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: tooltipFadeIn 0.2s ease-out;
    max-width: 250px;
    line-height: 1.4;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.temp-tooltip::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 6px solid rgba(220, 53, 69, 0.95);
}

/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   第七部分：响应式设计
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

@media (max-width: 768px) {
    .dependency-selector-content {
        width: 95vw;
        max-height: 85vh;
    }
    
    .dependency-selector-header {
        padding: 10px 14px;
    }
    
    .dependency-selector-header h6 {
        font-size: 0.85rem;
    }
    
    .dependency-selector-body {
        padding: 12px 14px;
    }
    
    .deps-item {
        padding: 5px 10px; /* ⭐ 移动端更紧凑 */
    }
    
    .deps-item .form-check-label {
        font-size: 0.8rem;
    }
    
    .wbs-badge-small {
        font-size: 0.65rem;
        padding: 1px 4px;
    }
    
    .dependency-selector-footer {
        padding: 10px 14px;
    }
    
    .dependency-selector-footer .text-muted {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        font-size: 0.75rem;
    }
    
    .dependency-selector-footer .text-info {
        font-size: 0.65rem;
    }
}

/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   第八部分：打印样式
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

@media print {
    .dependency-selector-modal {
        display: none !important;
    }
}

/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   第九部分：深色模式支持
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

@media (prefers-color-scheme: dark) {
    .dependency-selector-content {
        background: rgba(33, 37, 41, 0.98);
        border-color: rgba(102, 126, 234, 0.4);
    }
    
    .dependency-selector-header {
        background: linear-gradient(135deg, #212529 0%, #343a40 100%);
        border-bottom-color: #495057;
    }
    
    .dependency-selector-header h6 {
        color: #e9ecef;
    }
    
    .dependency-selector-body {
        background: #212529;
    }
    
    .deps-item {
        color: #e9ecef;
    }
    
    .deps-item:hover:not(.deps-item-disabled) {
        background: rgba(102, 126, 234, 0.15);
    }
    
    .deps-item-disabled {
        background: #343a40;
    }
    
    #depsSearchInput {
        background-color: #343a40;
        color: #e9ecef;
        border-color: #495057;
    }
    
    .dependency-selector-footer {
        background: #212529;
        border-top-color: #495057;
    }
}

/* ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
   第十部分：可访问性增强
   ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ */

@media (prefers-reduced-motion: reduce) {
    .dependency-selector-modal,
    .dependency-selector-content,
    .deps-item,
    .temp-tooltip {
        animation: none !important;
        transition-duration: 0.01ms !important;
    }
}

.dependency-selector-header .btn-close:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.deps-item:focus-within {
    outline: 2px solid #667eea;
    outline-offset: 2px;
    border-radius: 6px;
}
/* 在文件末尾添加或替换 Header 按钮样式 */

/* ⭐ 统一头部图标按钮 */
.btn-header-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: 50%;
    color: #6c757d;
    font-size: 1.1rem;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1); /* 弹性过渡 */
    cursor: pointer;
}

/* 悬停通用态 */
.btn-header-icon:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: scale(1.1);
}

.btn-header-icon:active {
    transform: scale(0.95);
}

/* ⭐ 上传按钮特化 (绿色) */
.btn-header-success:hover {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.1);
}

/* ⭐ 关闭按钮特化 (红色 + 旋转) */
.btn-header-close {
    font-size: 1.2rem; /* 稍微大一点的叉号 */
    margin-left: 4px;
}

.btn-header-close:hover {
    background: rgba(220, 53, 69, 0.15);
    color: #dc3545;
    transform: rotate(90deg) scale(1.1); /* 旋转特效 */
}

/* 调整 Header 布局以适应新按钮 */
.dependency-selector-header {
    padding: 10px 16px; /* 稍微调小内边距 */
    background: rgba(255,255,255,0.95); /* 增强对比度 */
}