/* ============== 材料选择器弹窗样式 ============== */

.picker-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: picker-fade-in 0.2s ease;
}
@keyframes picker-fade-in { from { opacity: 0; } to { opacity: 1; } }

.picker-modal {
    width: 95%;
    max-width: 1100px;
    max-height: 90vh;
    background: linear-gradient(160deg, #0f172a 0%, #1a0a1e 50%, #0f172a 100%);
    border: 2px solid rgba(59, 130, 246, 0.4);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: picker-slide-up 0.3s ease;
}
@keyframes picker-slide-up { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ---- 头部 ---- */
.picker-header {
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.picker-title { font-size: 18px; font-weight: 700; color: #f1f5f9; }
.picker-target { 
    font-size: 13px; color: #3B82F6; 
    padding: 3px 12px; background: rgba(59,130,246,0.12); 
    border-radius: 6px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.picker-close {
    margin-left: auto; width: 32px; height: 32px;
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
    color: #94a3b8; border-radius: 8px; cursor: pointer;
    font-size: 18px; line-height: 1; transition: all 0.2s;
}
.picker-close:hover { background: rgba(239,68,68,0.2); color: #EF4444; border-color: rgba(239,68,68,0.4); }

/* ---- 搜索栏 ---- */
.picker-search-bar {
    padding: 10px 24px; border-bottom: 1px solid rgba(255,255,255,0.05); flex-shrink: 0;
    display: flex; gap: 10px; align-items: center;
}
.picker-search-input {
    flex: 1; padding: 8px 14px;
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px; color: #e2e8f0; font-size: 13px; outline: none;
}
.picker-search-input::placeholder { color: #64748b; }
.picker-search-input:focus { border-color: rgba(59,130,246,0.5); }

.picker-search-count {
    font-size: 12px; color: #64748b; white-space: nowrap;
}

/* ---- 分类标签 ---- */
.picker-tabs {
    padding: 8px 24px; border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex; gap: 6px; flex-wrap: wrap; flex-shrink: 0;
    overflow-x: auto;
}
.picker-tab {
    padding: 5px 14px; font-size: 12px; font-weight: 600;
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08);
    color: #94a3b8; border-radius: 20px; cursor: pointer;
    white-space: nowrap; transition: all 0.2s;
}
.picker-tab:hover { background: rgba(255,255,255,0.06); color: #cbd5e1; }
.picker-tab.active {
    background: rgba(59,130,246,0.15); border-color: rgba(59,130,246,0.5); color: #60a5fa;
}

/* ---- 材料网格（可滚动区域） ---- */
.picker-body {
    flex: 1; overflow-y: auto; padding: 12px 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 8px; align-content: start;
}
.picker-body::-webkit-scrollbar { width: 6px; }
.picker-body::-webkit-scrollbar-track { background: transparent; }
.picker-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }

/* 单个材料卡片 */
.picker-item {
    background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px; padding: 8px; cursor: pointer; transition: all 0.2s;
    display: flex; gap: 8px; align-items: center;
}
.picker-item:hover { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.12); }
.picker-item.selected {
    background: rgba(59,130,246,0.1); border-color: rgba(59,130,246,0.5);
    box-shadow: 0 0 12px rgba(59,130,246,0.15);
}

.picker-item-img {
    width: 40px; height: 40px; object-fit: contain;
    border-radius: 6px; background: rgba(0,0,0,0.3); flex-shrink: 0;
}
.picker-item-info { flex: 1; min-width: 0; }
.picker-item-zh {
    font-size: 12px; font-weight: 600; color: #e2e8f0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.picker-item-en {
    font-size: 10px; color: #64748b;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.picker-item-type {
    font-size: 10px; color: #f1aa1c; margin-top: 1px;
}
.picker-item-check {
    width: 22px; height: 22px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.15); flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; color: transparent; transition: all 0.2s;
}
.picker-item.selected .picker-item-check {
    background: #3B82F6; border-color: #3B82F6; color: #fff;
}

/* ---- 底部已选区 ---- */
.picker-footer {
    padding: 12px 24px; border-top: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.2); flex-shrink: 0; display: flex;
    align-items: center; gap: 12px; flex-wrap: wrap;
}
.picker-selected-label {
    font-size: 13px; font-weight: 600; color: #94a3b8; flex-shrink: 0;
}
.picker-selected-chips {
    flex: 1; display: flex; gap: 6px; flex-wrap: wrap; min-width: 0;
}
.picker-chip {
    display: flex; align-items: center; gap: 4px;
    padding: 4px 8px 4px 10px; background: rgba(59,130,246,0.12);
    border: 1px solid rgba(59,130,246,0.3); border-radius: 16px;
    font-size: 11px; color: #93c5fd;
}
.picker-chip-qty {
    width: 30px; padding: 1px 4px; background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1); border-radius: 4px;
    color: #e2e8f0; font-size: 11px; text-align: center; outline: none;
}
.picker-chip-remove {
    width: 16px; height: 16px; border-radius: 50%; border: none;
    background: rgba(239,68,68,0.2); color: #f87171; cursor: pointer;
    font-size: 12px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.picker-chip-remove:hover { background: rgba(239,68,68,0.4); }

.picker-save-btn {
    padding: 8px 24px; background: linear-gradient(135deg, #3B82F6, #2563EB);
    border: none; border-radius: 8px; color: #fff; font-size: 13px; font-weight: 700;
    cursor: pointer; flex-shrink: 0; transition: all 0.2s;
}
.picker-save-btn:hover { box-shadow: 0 0 16px rgba(59,130,246,0.3); transform: translateY(-1px); }
.picker-save-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

.picker-empty {
    grid-column: 1 / -1; text-align: center; padding: 40px 20px; color: #64748b; font-size: 14px;
}

/* 响应式 */
@media (max-width: 768px) {
    .picker-modal { width: 100%; max-height: 100vh; border-radius: 0; }
    .picker-body { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); padding: 8px 12px; }
    .picker-header, .picker-search-bar, .picker-tabs, .picker-footer { padding-left: 12px; padding-right: 12px; }
}

/* 加载动画 */
.picker-loading {
    grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center;
    padding: 60px 20px; color: #64748b; gap: 12px;
}
.picker-spinner {
    width: 36px; height: 36px; border: 3px solid rgba(255,255,255,0.08);
    border-top-color: #3B82F6; border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
