/**
 * Dynamic SKU Table - 清理版样式
 * 彻底重写，解决所有问题
 */

/* ==================== 1. 基础重置 ==================== */
.dst-sku-table-container * {
    box-sizing: border-box;
}

/* ==================== 2. 主容器 ==================== */
.dst-sku-table-container {
    width: 100%;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

/* ==================== 3. 桌面端布局 ==================== */
.dst-desktop-layout {
    display: block;
}

.dst-table-main {
    display: flex;
    align-items: stretch;
}

/* 左侧表格区域 */
.dst-sku-table-section {
    flex: 2;
    min-width: 0;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

.dst-sku-table {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ==================== 4. 表格滚动容器 - 关键修复 ==================== */
.dst-table-scroll-container {
    flex: 1;
    overflow: auto;
    max-height: 450px;
    position: relative;
}

/* ==================== 5. 表格样式 - 关键修复 ==================== */
.dst-variation-table,
.dst-body-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto; /* 自动列宽 */
}

/* 表头 - sticky定位，低z-index */
.dst-variation-table thead,
.dst-body-table thead {
    position: sticky;
    top: 0;
    z-index: 2; /* 低z-index，不覆盖导航和弹窗 */
    background: #f5f5f5;
}

.dst-variation-table thead th,
.dst-body-table thead th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: #333;
    border-bottom: 2px solid #ddd;
    background: #f5f5f5;
    white-space: break-spaces;
}

/* 表格行 - 紧凑高度 */
.dst-variation-table tbody tr,
.dst-body-table tbody tr {
    cursor: pointer;
    transition: background 0.15s;
}

.dst-variation-table tbody tr:hover,
.dst-body-table tbody tr:hover {
    background: #f9f9f9;
}

.dst-variation-table tbody tr.dst-active,
.dst-body-table tbody tr.dst-active {
    background: #e3f2fd;
}

/* 表格单元格 - 紧凑padding，自适应宽度 */
.dst-variation-table tbody td,
.dst-body-table tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
    line-height: 1.4;
}

/* 属性列 - 允许换行 */
.dst-attribute-cell {
    white-space: normal;
    word-break: break-word;
}

/* 价格和库存列 - 不换行，居中 */
.dst-price-cell,
.dst-stock-cell {
    text-align: center;
    white-space: nowrap;
}

.dst-price-cell {
    font-weight: 600;
    color: #1976d2;
}

/* 库存状态标签 */
.dst-stock-status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
}

.dst-stock-status.dst-in-stock {
    background: #e8f5e9;
    color: #2e7d32;
}

.dst-stock-status.dst-out-of-stock {
    background: #ffebee;
    color: #c62828;
}

/* ==================== 6. 右侧详情面板 ==================== */
.dst-details-panel {
    flex: 1;
    min-width: 280px;
    max-width: 350px;
    background: #fafafa;
    padding: 15px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dst-details-content {
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* 产品详情 */
.dst-product-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dst-product-image {
    text-align: center;
}

.dst-product-image img {
    max-width: 120px;
    max-height: 120px;
    border-radius: 6px;
}

.dst-sku-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 8px;
    color: #333;
}

.dst-sku-number {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
}

.dst-price-info {
    margin: 10px 0;
}

.dst-current-price {
    font-size: 20px;
    font-weight: 700;
    color: #e53935;
}

.dst-stock-info {
    font-size: 13px;
    margin-bottom: 10px;
}

/* ==================== 7. 操作按钮 ==================== */
.dst-actions {
    margin-top: 12px;
}

.dst-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dst-button {
    display: block;
    width: 100%;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s;
}

.dst-add-to-cart {
    background: #1976d2;
    color: #fff;
}

.dst-add-to-cart:hover {
    background: #1565c0;
}

.dst-add-to-cart.dst-disabled {
    background: #bdbdbd;
    cursor: not-allowed;
}

.dst-add-to-quote {
    background: #43a047;
    color: #fff;
}

.dst-add-to-quote:hover {
    background: #388e3c;
}

/* ==================== 8. Show More/Less 按钮 ==================== */
.dst-show-more-btn,
.dst-show-less-btn {
    background: none;
    border: none;
    color: #1976d2;
    font-size: 13px;
    cursor: pointer;
    padding: 5px 0;
    text-decoration: underline;
    margin-top: 10px;
}

.dst-show-more-btn:hover,
.dst-show-less-btn:hover {
    color: #0d47a1;
}

/* 默认隐藏 show less */
.dst-show-less-btn {
    display: none;
}

/* 默认隐藏描述 */
.dst-description {
    display: none;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.dst-description h5 {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 5px;
    color: #333;
}
.dst-dimensions h5 {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 5px;
    color: #333;
}
.dst-dimensions ul {
    margin-left: -20px;
    font-size: 13px;
}
.dst-description p {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    margin: 0;
}

/* 展开状态 */
.dst-expanded .dst-description {
    display: block;
}

.dst-expanded .dst-show-more-btn {
    display: none;
}

.dst-expanded .dst-show-less-btn {
    display: inline;
}

/* ==================== 9. 隐藏数量选择器 ==================== */
.dst-quantity-selector {
    display: none;
}

/* ==================== 10. 移动端布局 ==================== */
.dst-mobile-layout {
    display: none;
}

.dst-mobile-title {
    font-size: 16px;
    font-weight: 600;
    padding: 15px;
    margin: 0;
    border-bottom: 1px solid #eee;
}

/* 属性选择器 */
.dst-variant-selector {
    padding: 15px;
}

.dst-attribute-group {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 10px;
    overflow: hidden;
}

.dst-attribute-group .dst-attribute-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #f5f5f5;
    cursor: pointer;
}

.dst-attribute-group .dst-attribute-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.dst-attribute-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #666;
}

.dst-toggle-icon {
    transition: transform 0.2s;
}

.dst-attribute-group.dst-expanded .dst-toggle-icon {
    transform: rotate(180deg);
}

.dst-attribute-options {
    padding: 10px 15px;
    display: none;
}

.dst-attribute-group.dst-expanded .dst-attribute-options {
    display: block;
}

.dst-attribute-option {
    display: block;
    padding: 10px 12px;
    margin-bottom: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    cursor: pointer;
}

.dst-attribute-option:last-child {
    margin-bottom: 0;
}

.dst-attribute-option input[type="radio"] {
    display: none;
}

.dst-attribute-option input:checked + .dst-option-label {
    color: #1976d2;
    font-weight: 600;
}

.dst-attribute-option.dst-unavailable {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 选中状态摘要 */
.dst-selection-summary {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 8px;
    padding: 12px 15px;
    margin: 15px;
}

.dst-selection-summary h4 {
    margin: 0 0 8px 0;
    color: #1976d2;
    font-size: 14px;
    font-weight: 600;
}

.dst-selected-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.dst-selected-option-tag {
    background: #1976d2;
    color: white;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
}

/* SKU结果区域 */
.dst-mobile-results {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    margin: 15px;
}

.dst-result-header {
    background: #f8f9fa;
    padding: 12px 15px;
    border-bottom: 1px solid #e5e5e5;
}

.dst-result-header h4 {
    margin: 0;
    color: #333;
    font-size: 14px;
    font-weight: 600;
}

.dst-mobile-skus {
    padding: 0;
}

/* 移动端SKU卡片样式 */
.dst-sku-card {
    background: white;
    border-bottom: 1px solid #f0f0f0;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dst-sku-card:last-child {
    border-bottom: none;
}

.dst-sku-card:hover {
    background: #f8f9fa;
}

.dst-sku-card.dst-active {
    background: #e3f2fd;
    border-left: 4px solid #1976d2;
}

.dst-sku-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.dst-sku-card-title {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.dst-sku-card-price {
    font-weight: 700;
    color: #e74c3c;
    font-size: 16px;
}

.dst-sku-card-info {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: #666;
}

/* 移动端详情 */
.dst-mobile-details {
    margin: 15px;
    padding: 15px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
}

.dst-mobile-details .dst-product-details {
    padding: 0;
}

.dst-mobile-details .dst-product-image {
    margin-bottom: 15px;
    text-align: center;
}

.dst-mobile-details .dst-product-image img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

.dst-mobile-details .dst-sku-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: #333;
}

.dst-mobile-details .dst-price-info {
    margin-bottom: 10px;
}

.dst-mobile-details .dst-current-price {
    font-size: 20px;
    font-weight: 700;
    color: #e74c3c;
}

.dst-mobile-details .dst-stock-info {
    margin-bottom: 15px;
}

.dst-mobile-details .dst-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.dst-mobile-details .dst-button {
    width: 100%;
    padding: 12px;
    font-size: 14px;
    border-radius: 6px;
    text-align: center;
}

.dst-mobile-details .dst-add-to-cart {
    background: #1976d2;
    color: #fff;
    border: none;
}

.dst-mobile-details .dst-add-to-quote {
    background: #fff;
    color: #1976d2;
    border: 1px solid #1976d2;
}

.dst-mobile-details .dst-show-more-btn,
.dst-mobile-details .dst-show-less-btn {
    background: none;
    border: none;
    color: #1976d2;
    font-size: 13px;
    cursor: pointer;
    padding: 10px 0;
    text-align: center;
    width: 100%;
}

.dst-mobile-details .dst-collapsible-content {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.dst-mobile-details .dst-description h5,
.dst-mobile-details .dst-dimensions h5 {
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: #333;
}

.dst-mobile-details .dst-description p {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    margin: 0;
}

.dst-mobile-details .dst-dimensions ul {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 13px;
    color: #666;
}

.dst-mobile-details .dst-dimensions li {
    margin-bottom: 4px;
}

/* ==================== 11. 响应式断点 ==================== */
@media (max-width: 768px) {
    .dst-desktop-layout {
        display: none;
    }
    
    .dst-mobile-layout {
        display: block;
    }
}

@media (min-width: 769px) {
    .dst-desktop-layout {
        display: block;
    }
    
    .dst-mobile-layout {
        display: none;
    }
}

/* 平板端 */
@media (min-width: 769px) and (max-width: 1024px) {
    .dst-table-main {
        flex-direction: column;
    }
    
    .dst-sku-table-section {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .dst-details-panel {
        max-width: none;
        border-top: 1px solid #e0e0e0;
    }
}

/* ==================== 12. 报价弹窗 ==================== */
.dst-quote-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: none;
}

.dst-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
}

.dst-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 10px;
    width: 90%;
    max-width: 580px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 15px 40px rgba(0,0,0,0.25);
}

.dst-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    color: #fff;
    flex-shrink: 0;
}

.dst-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.dst-modal-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    font-size: 18px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.dst-modal-close:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.dst-modal-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    max-height: calc(80vh - 50px);
}

.dst-modal-left {
    flex: 1;
    padding: 15px;
    border-right: 1px solid #f0f0f0;
    min-width: 0;
    overflow-y: auto;
}

.dst-modal-right {
    flex: 0 0 200px;
    padding: 15px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-y: auto;
}

.dst-form-group {
    margin-bottom: 12px;
}

.dst-form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    color: #333;
    font-size: 12px;
}

.dst-form-group input,
.dst-form-group textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.dst-form-group input:focus,
.dst-form-group textarea:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.dst-form-group textarea {
    min-height: 60px;
    resize: vertical;
}

/* 报价摘要 */
.dst-quote-summary {
    background: #f0f7ff;
    border: 1px solid #e3f2fd;
    border-radius: 4px;
    padding: 10px;
    margin: 12px 0;
}

.dst-quote-summary h4 {
    margin: 0 0 8px 0;
    color: #1976d2;
    font-size: 13px;
    font-weight: 600;
}

.dst-quote-product-info > div {
    margin-bottom: 4px;
    font-size: 12px;
}

.dst-quote-product-name {
    font-weight: 600;
    color: #333;
}

.dst-quote-product-sku {
    color: #666;
    font-size: 13px;
}

.dst-quote-product-price {
    font-weight: 700;
    color: #e74c3c;
    font-size: 14px;
}

.dst-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.dst-submit-quote {
    flex: 1;
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dst-submit-quote:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
}

.dst-cancel-quote {
    background: #f8f9fa;
    color: #666;
    border: 1px solid #ddd;
    padding: 10px 16px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dst-cancel-quote:hover {
    background: #e9ecef;
    border-color: #ccc;
}

/* 右侧介绍内容 */
.dst-quote-info h4 {
    margin: 0 0 12px 0;
    color: #333;
    font-size: 14px;
    font-weight: 600;
}

.dst-quote-features {
    flex: 1;
}

.dst-feature-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
}

.dst-feature-icon {
    font-size: 16px;
    margin-right: 8px;
    flex-shrink: 0;
    margin-top: 1px;
}

.dst-feature-content h5 {
    margin: 0 0 3px 0;
    color: #333;
    font-size: 12px;
    font-weight: 600;
}

.dst-feature-content p {
    margin: 0;
    color: #666;
    font-size: 11px;
    line-height: 1.3;
}

.dst-quote-contact {
    background: #fff;
    border-radius: 4px;
    padding: 10px;
    border: 1px solid #e5e5e5;
}

.dst-quote-contact h5 {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 12px;
    font-weight: 600;
}

.dst-quote-contact > p {
    margin: 0 0 8px 0;
    color: #666;
    font-size: 11px;
}

.dst-contact-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dst-contact-item {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: #555;
}

.dst-icon-phone,
.dst-icon-email {
    margin-right: 6px;
    font-size: 14px;
}

/* 报价弹窗响应式 */
@media (max-width: 768px) {
    .dst-modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .dst-modal-body {
        flex-direction: column;
    }
    
    .dst-modal-left {
        border-right: none;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .dst-modal-right {
        display: none;
    }
}

/* ==================== 13. 加载状态 ==================== */
.dst-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.9);
    z-index: 10;
}

.dst-details-panel {
    position: relative;
}

.dst-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #eee;
    border-top-color: #1976d2;
    border-radius: 50%;
    animation: dst-spin 0.8s linear infinite;
    margin: 0 auto 10px;
}

@keyframes dst-spin {
    to { transform: rotate(360deg); }
}

.dst-original-price {
    text-decoration: line-through;
    color: #999;
    margin-left: 3px;
    font-size: 12px;
}

/* ==================== 14. 隐藏不需要的元素 ==================== */
.dst-table-header-container {
    display: none;
}
.dst-description ul {
    margin-left: -20px;
    font-size: 13px;
}