/* styles_simple_finder.css - 简化版材料查找器样式 */

/* 简化查找器容器 */
.simple-finder-container {
    background: #1f2937;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    border: 2px solid #374151;
}

.simple-finder-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.simple-finder-header h3 {
    color: #60a5fa;
    margin: 0;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.simple-finder-toggle {
    margin-left: auto;
    background: #374151;
    border: none;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.3s;
}

.simple-finder-toggle:hover {
    background: #4b5563;
}

/* 查找器内容区域 */
.simple-finder-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.simple-search-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.simple-search-input-group {
    position: relative;
}

.simple-search-input {
    width: 100%;
    max-width: 280px;
    padding: 10px;
    background: #374151;
    border: 2px solid #4b5563;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    outline: none;
    transition: border-color 0.3s;
}

.simple-search-input:focus {
    border-color: #60a5fa;
}

.simple-search-suggestions {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    max-width: 100%;
    max-height: 200px;
    overflow-y: auto;
    background-color: #1f2937;
    border: 1px solid #4b5563;
    border-top: none;
    border-radius: 0 0 6px 6px;
    z-index: 1002;
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
}

.simple-search-suggestion-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #4b5563;
    transition: background-color 0.2s;
    font-size: 14px;
}

.simple-search-suggestion-item:hover {
    background: #4b5563;
}

.simple-search-suggestion-item:last-child {
    border-bottom: none;
}

.simple-search-suggestion-name {
    font-weight: bold;
    color: #60a5fa;
    margin-bottom: 3px;
}

.simple-search-suggestion-details {
    font-size: 12px;
    color: #9ca3af;
    display: flex;
    justify-content: space-between;
}

/* 控制项容器的基础规范由 styles.css 统一控制。
   这里原先重复定义 .control-item 并写死 min-width: 0，会盖掉 styles.css 里
   移动端「.control-item { min-width: 100% }」，导致小屏被挤压，故移除。 */

.control-item label {
    white-space: nowrap;
    flex-shrink: 0;
}

/* 确保搜索容器不会撑开父元素 */
.simple-search-container {
    flex: 1;
    min-width: 0;
}

/* ============================================
   可折叠下级材料容器样式
   ============================================ */

.collapsible-lower-materials {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.95) 100%);
    border-radius: 12px;
    border: 2px solid rgba(96, 165, 250, 0.2);
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(96, 165, 250, 0.1);
    overflow: hidden;
    margin: 20px 0;
    transition: all 0.3s ease;
    max-height: 600px;
    display: flex;
    flex-direction: column;
}

.collapsible-lower-materials.collapsed {
    max-height: 50px;
    overflow: hidden;
}

/* 可折叠头部 */
.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(90deg, 
        rgba(96, 165, 250, 0.1) 0%, 
        rgba(139, 92, 246, 0.05) 100%);
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid rgba(96, 165, 250, 0.1);
    transition: background-color 0.3s;
}

.collapsible-header:hover {
    background: linear-gradient(90deg, 
        rgba(96, 165, 250, 0.15) 0%, 
        rgba(139, 92, 246, 0.1) 100%);
}

.collapsible-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.collapsible-icon {
    font-size: 18px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.collapsible-text {
    color: #60a5fa;
    font-size: 16px;
    font-weight: 600;
}

.collapsible-count {
    background: rgba(96, 165, 250, 0.2);
    color: #60a5fa;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid rgba(96, 165, 250, 0.3);
}

.collapsible-arrow {
    color: #94a3b8;
    font-size: 12px;
    transition: transform 0.3s;
    margin-left: 5px;
}

.collapsible-lower-materials.collapsed .collapsible-arrow {
    transform: rotate(-90deg);
}

/* 可折叠操作按钮 */
.collapsible-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.btn-expand-all,
.btn-collapse-all {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    width: 30px;
    height: 30px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
}

.btn-expand-all:hover {
    background: rgba(96, 165, 250, 0.2);
    border-color: #60a5fa;
    color: #60a5fa;
}

.btn-collapse-all:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #ef4444;
}

/* 可折叠内容区域 */
.collapsible-content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    max-height: 400px;
    transition: max-height 0.3s ease;
}

.collapsible-lower-materials.collapsed .collapsible-content {
    max-height: 0;
    padding: 0 16px;
    overflow: hidden;
}

/* 可折叠材料网格 */
.collapsible-materials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}

/* 可折叠材料按钮 */
.collapsible-material-btn {
    background: linear-gradient(135deg, 
        rgba(45, 55, 72, 0.8) 0%, 
        rgba(74, 85, 104, 0.8) 100%);
    border: 1px solid rgba(74, 85, 104, 0.6);
    border-radius: 10px;
    padding: 12px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    position: relative;
    overflow: hidden;
    min-height: 70px;
    display: flex;
    align-items: center;
    width: 100%;
}

.collapsible-material-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(90deg, 
        rgba(96, 165, 250, 0.1) 0%, 
        rgba(139, 92, 246, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.collapsible-material-btn:hover {
    background: linear-gradient(135deg, 
        rgba(74, 85, 104, 0.9) 0%, 
        rgba(100, 116, 139, 0.9) 100%);
    border-color: #60a5fa;
    transform: translateY(-2px);
    box-shadow: 
        0 4px 15px rgba(96, 165, 250, 0.2),
        inset 0 0 0 1px rgba(96, 165, 250, 0.1);
}

.collapsible-material-btn:hover::before {
    opacity: 1;
}

/* 按钮内容 */
.collapsible-material-btn .material-btn-content {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    position: relative;
    z-index: 1;
}

.collapsible-material-btn .material-btn-emoji {
    font-size: 22px;
    background: rgba(255, 255, 255, 0.15);
    padding: 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    height: 50px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.collapsible-material-btn .material-btn-text {
    flex: 1;
    overflow: hidden;
    min-width: 0;
}

.collapsible-material-btn .material-btn-name {
    font-weight: 600;
    font-size: 14px;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 5px;
}

.collapsible-material-btn .material-btn-details {
    display: flex;
    gap: 8px;
    font-size: 11px;
    color: #94a3b8;
}

.collapsible-material-btn .material-btn-quality {
    background: rgba(148, 163, 184, 0.15);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.collapsible-material-btn .material-btn-wear {
    background: rgba(96, 165, 250, 0.15);
    color: #60a5fa;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid rgba(96, 165, 250, 0.2);
}

/* 无材料提示 */
.collapsible-no-materials {
    text-align: center;
    padding: 30px 20px;
    color: #94a3b8;
}

.no-materials-message {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.no-materials-message span {
    font-size: 16px;
    color: #60a5fa;
}

.no-materials-message small {
    font-size: 12px;
    color: #64748b;
}

/* 可折叠页脚 */
.collapsible-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(96, 165, 250, 0.1);
    background: rgba(15, 23, 42, 0.8);
}

.btn-add-all {
    width: 100%;
    padding: 12px;
    background: linear-gradient(90deg, #60a5fa 0%, #8b5cf6 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-add-all:hover {
    background: linear-gradient(90deg, #4f9bf7 0%, #7a4cf5 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(96, 165, 250, 0.4);
}

.btn-add-all:active {
    transform: translateY(0);
}

.add-all-count {
    font-size: 12px;
    opacity: 0.9;
    font-weight: normal;
}

/* 工具提示 */
.collapsible-material-btn {
    position: relative;
}

.collapsible-material-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.95);
    color: #e2e8f0;
    padding: 12px;
    border-radius: 8px;
    font-size: 12px;
    white-space: pre-line;
    border: 1px solid rgba(96, 165, 250, 0.3);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    z-index: 1002;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    min-width: 250px;
    max-width: 300px;
    text-align: left;
    line-height: 1.5;
    pointer-events: none;
}

.collapsible-material-btn:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-5px);
}

/* 滚动条 */
.collapsible-content::-webkit-scrollbar {
    width: 6px;
}

.collapsible-content::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5);
    border-radius: 3px;
}

.collapsible-content::-webkit-scrollbar-thumb {
    background: rgba(96, 165, 250, 0.5);
    border-radius: 3px;
}

.collapsible-content::-webkit-scrollbar-thumb:hover {
    background: rgba(96, 165, 250, 0.7);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .simple-search-input {
        max-width: 100%;
    }
    
    .simple-search-suggestions {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .collapsible-materials-grid {
        grid-template-columns: 1fr;
    }
    
    .collapsible-material-btn {
        min-height: 65px;
    }
    
    .collapsible-material-btn .material-btn-emoji {
        min-width: 45px;
        height: 45px;
        font-size: 20px;
    }
}

/* 动画关键帧 */
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(0.98); }
    100% { transform: scale(1); }
}

@keyframes successPulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}