/* ==================== 货品选择弹窗组件样式 ==================== */

/* 货品选择弹窗基础样式 */
.goods-selection-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 20000;
    animation: modal-appear 0.3s ease-out;
}

@keyframes modal-appear {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.goods-selection-overlay.active {
    display: flex;
}

.goods-selection-modal .modal-container {
    width: 96vw;
    max-width: 1780px;
    height: 90vh;
    max-height: 850px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modal-slide-in 0.3s ease-out;
}

/* 单选模式下适当收窄弹窗宽度 */
.goods-selection-modal.single-mode .modal-container {
    width: 88vw;
    max-width: 1680px;
}

@keyframes modal-slide-in {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 头部区域 */
.goods-selection-modal .goods-modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid #e7e7e7;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fff;
    flex-shrink: 0;
}

.goods-selection-modal .goods-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #1d2129;
    display: flex;
    align-items: center;
    gap: 8px;
}

.goods-selection-modal .goods-close-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #86909c;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.goods-selection-modal .goods-close-btn:hover {
    background-color: #f2f3f5;
    color: #1d2129;
}

/* 主体区域 */
.goods-selection-modal .goods-modal-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: linear-gradient(135deg, #fafafa 0%, #fff 100%);
}

/* 左侧面板 - 货品列表 */
.goods-selection-modal .goods-panel {
    flex: 4;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e7e7e7;
    background-color: #fff;
}

/* 右侧面板 - 已选列表 */
.goods-selection-modal .selected-panel {
    flex: 0 0 280px;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    background-color: #fff;
}

/* 面板头部 */
.goods-selection-modal .panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e7e7e7;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: #fafafa;
    flex-shrink: 0;
}

.goods-selection-modal .panel-title {
    font-size: 16px;
    font-weight: 600;
    color: #1d2129;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* 搜索框 */
.goods-selection-modal .search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.goods-selection-modal .goods-search-input {
    flex: 1;
    padding: 8px 12px 8px 36px;
    border: 1px solid #dcdcdc;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s;
    background-color: #fff;
}

.goods-selection-modal .goods-search-input:focus {
    border-color: #0052d9;
    box-shadow: 0 0 0 3px rgba(0, 82, 217, 0.1);
}

.goods-selection-modal .search-icon {
    position: absolute;
    left: 12px;
    color: #86909c;
    font-size: 14px;
}

/* 面板内容区 */
.goods-selection-modal .panel-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: #fff;
}

/* 列表容器 */
.goods-selection-modal .list-container {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #c9cdd4 #f2f3f5;
}

.goods-selection-modal .list-container::-webkit-scrollbar {
    width: 6px;
}

.goods-selection-modal .list-container::-webkit-scrollbar-track {
    background: #f2f3f5;
    border-radius: 3px;
}

.goods-selection-modal .list-container::-webkit-scrollbar-thumb {
    background: #c9cdd4;
    border-radius: 3px;
}

.goods-selection-modal .list-container::-webkit-scrollbar-thumb:hover {
    background: #86909c;
}

/* 列表头部 */
    .goods-selection-modal .list-header {
        display: grid;
        grid-template-columns: 1fr 2fr 1.5fr 1.2fr 1.5fr 1fr 1fr 1fr 1fr 1fr 1fr 0.8fr;
        padding: 10px 16px;
        font-size: 12px;
        color: #86909c;
        border-bottom: 1px solid #e7e7e7;
        background-color: #fafafa;
        position: sticky;
        top: 0;
        z-index: 10;
        gap: 8px;
    }

    /* 列表项 */
    .goods-selection-modal .list-item {
        display: grid;
        grid-template-columns: 1fr 2fr 1.5fr 1.2fr 1.5fr 1fr 1fr 1fr 1fr 1fr 1fr 0.8fr;
        padding: 12px 16px;
        cursor: pointer;
        transition: all 0.3s;
        align-items: center;
        border-bottom: 1px solid #f6f6f6;
        position: relative;
        gap: 8px;
    }

.goods-selection-modal .list-item:hover {
    background-color: #f8f9fa;
}

.goods-selection-modal .list-item.selected {
    background-color: #ecf2fe;
    border-left: 3px solid #0052d9;
}

.goods-selection-modal .item-field {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    color: #4e5969;
}

.goods-selection-modal .item-field.item-code {
    font-weight: 500;
    color: #1d2129;
}

.goods-selection-modal .item-field.item-name {
    font-weight: 600;
    color: #1d2129;
}

/* 空状态 */
.goods-selection-modal .empty-state {
    padding: 60px 20px;
    text-align: center;
    color: #86909c;
}

.goods-selection-modal .empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    display: block;
    color: #c9cdd4;
    opacity: 0.7;
}

/* 分页 */
.goods-selection-modal .pagination-container {
    padding: 12px 20px;
    border-top: 1px solid #e7e7e7;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fff;
    flex-shrink: 0;
}

.goods-selection-modal .pagination-info {
    font-size: 13px;
    color: #86909c;
}

.goods-selection-modal .pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.goods-selection-modal .pagination-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid #dcdcdc;
    border-radius: 6px;
    background-color: #fff;
    color: #4e5969;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 13px;
}

.goods-selection-modal .pagination-btn:hover:not(:disabled) {
    border-color: #0052d9;
    color: #0052d9;
}

.goods-selection-modal .pagination-btn:disabled {
    color: #c9cdd4;
    cursor: not-allowed;
}

.goods-selection-modal .pagination-btn.active {
    background-color: #0052d9;
    color: #fff;
    border-color: #0052d9;
}

/* 已选列表项 */
.goods-selection-modal .selected-list-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s;
}

.goods-selection-modal .selected-list-item:hover {
    background-color: #f8f9fa;
}

.goods-selection-modal .selected-item-info {
    flex: 1;
    overflow: hidden;
}

.goods-selection-modal .selected-item-name {
    font-weight: 500;
    color: #1d2129;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.goods-selection-modal .selected-item-code {
    color: #86909c;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.goods-selection-modal .remove-btn {
    background: none;
    border: none;
    color: #ff4d4f;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.goods-selection-modal .remove-btn:hover {
    background-color: #fff2f0;
}

/* 底部操作区 */
.goods-selection-modal .goods-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e7e7e7;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fff;
    flex-shrink: 0;
}

.goods-selection-modal .selection-info {
    font-size: 14px;
    color: #4e5969;
    flex: 1;
}

.goods-selection-modal .selection-info strong {
    color: #0052d9;
    font-weight: 600;
}

.goods-selection-modal .action-buttons {
    display: flex;
    gap: 12px;
}

.goods-selection-modal .btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid transparent;
    font-weight: 600;
    min-width: 100px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.goods-selection-modal .btn-cancel {
    background-color: white;
    border: 1px solid #dcdcdc;
    color: #4e5969;
}

.goods-selection-modal .btn-cancel:hover {
    border-color: #0052d9;
    color: #0052d9;
}

.goods-selection-modal .btn-confirm {
    background-color: #0052d9;
    color: white;
    border: 1px solid #0052d9;
}

.goods-selection-modal .btn-confirm:hover:not(:disabled) {
    background-color: #1e6fff;
    border-color: #1e6fff;
}

.goods-selection-modal .btn-confirm:disabled {
    background-color: #f2f3f5;
    color: #c9cdd4;
    border-color: #f2f3f5;
    cursor: not-allowed;
}

/* 响应式设计 */
@media (max-width: 1400px) {
    .goods-selection-modal .list-header,
    .goods-selection-modal .list-item {
        grid-template-columns: 1fr 2fr 1.2fr 1.5fr 1fr 1fr 1fr 1fr 1fr;
    }
    
    /* 此档位隐藏最后一列（当前第12列） */
    .goods-selection-modal .item-field:nth-child(12),
    .goods-selection-modal .list-header .item-field:nth-child(12) {
        display: none;
    }
}

@media (max-width: 992px) {
    .goods-selection-modal .list-header,
    .goods-selection-modal .list-item {
        grid-template-columns: 1fr 2fr 1.2fr 1.5fr 1fr 1fr 1fr;
    }
    
    /* 此档位隐藏最后两列（当前第11、12列） */
    .goods-selection-modal .item-field:nth-child(11),
    .goods-selection-modal .item-field:nth-child(12),
    .goods-selection-modal .list-header .item-field:nth-child(11),
    .goods-selection-modal .list-header .item-field:nth-child(12) {
        display: none;
    }
}

@media (max-width: 768px) {
    .goods-selection-modal .modal-container {
        width: 98%;
        height: 95vh;
        max-height: none;
        border-radius: 0;
        margin: 10px;
    }
    
    .goods-selection-modal .goods-modal-body {
        flex-direction: column;
        height: auto;
    }
    
    .goods-selection-modal .goods-panel {
        border-right: none;
        border-bottom: 1px solid #e7e7e7;
        min-height: 300px;
    }
    
    .goods-selection-modal .list-header,
    .goods-selection-modal .list-item {
        grid-template-columns: 1fr 2fr 1.2fr 1fr;
        gap: 6px;
    }
    
    .goods-selection-modal .item-field:nth-child(5),
    .goods-selection-modal .item-field:nth-child(6),
    .goods-selection-modal .item-field:nth-child(7),
    .goods-selection-modal .item-field:nth-child(8),
    .goods-selection-modal .item-field:nth-child(9),
    .goods-selection-modal .item-field:nth-child(10),
    .goods-selection-modal .item-field:nth-child(11),
    .goods-selection-modal .list-header .item-field:nth-child(5),
    .goods-selection-modal .list-header .item-field:nth-child(6),
    .goods-selection-modal .list-header .item-field:nth-child(7),
    .goods-selection-modal .list-header .item-field:nth-child(8),
    .goods-selection-modal .list-header .item-field:nth-child(9),
    .goods-selection-modal .list-header .item-field:nth-child(10),
    .goods-selection-modal .list-header .item-field:nth-child(11) {
        display: none;
    }
    
    .goods-selection-modal .goods-modal-footer {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .goods-selection-modal .selection-info {
        text-align: center;
        margin-bottom: 8px;
    }
    
    .goods-selection-modal .action-buttons {
        width: 100%;
        justify-content: center;
    }
    
    .goods-selection-modal .action-buttons .btn {
        flex: 1;
        max-width: 140px;
    }
}

/* 单选模式样式 */
.goods-selection-modal.single-mode .selected-panel {
    display: none;
}

.goods-selection-modal.single-mode .goods-panel {
    border-right: none;
    flex: 1;
}

/* 深色主题适配 */
@media (prefers-color-scheme: dark) {
    .goods-selection-modal .modal-container {
        background-color: #1a1a1a;
        color: #ffffff;
    }
    
    .goods-selection-modal .goods-modal-header {
        background-color: #2d2d2d;
        border-bottom-color: #404040;
    }
    
    .goods-selection-modal .goods-modal-title {
        color: #ffffff;
    }
    
    .goods-selection-modal .panel-header {
        background-color: #2d2d2d;
        border-bottom-color: #404040;
    }
    
    .goods-selection-modal .list-container {
        scrollbar-color: #404040 #2d2d2d;
    }
    
    .goods-selection-modal .list-header {
        background-color: #2d2d2d;
        border-bottom-color: #404040;
        color: #a0a0a0;
    }
    
    .goods-selection-modal .list-item {
        background-color: #1a1a1a;
        border-bottom-color: #2d2d2d;
    }
    
    .goods-selection-modal .list-item:hover {
        background-color: #2d2d2d;
    }
    
    .goods-selection-modal .list-item.selected {
        background-color: rgba(0, 82, 217, 0.2);
    }
    
    .goods-selection-modal .pagination-container {
        background-color: #2d2d2d;
        border-top-color: #404040;
    }
    
    .goods-selection-modal .goods-modal-footer {
        background-color: #2d2d2d;
        border-top-color: #404040;
    }
}