/**
 * 产品描述表格显示修复样式
 * 确保Giga平台产品的规格表格在前端正确显示
 */

/* 产品描述区域表格基础样式 */
.woocommerce-product-details__short-description table,
.woocommerce-Tabs-panel--description table,
.product-description table,
.entry-content table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin: 20px 0 !important;
    background: #fff !important;
    border: 1px solid #ddd !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08) !important;
    display: table !important; /* 强制显示为表格 */
    visibility: visible !important; /* 确保可见 */
    opacity: 1 !important; /* 确保不透明 */
    position: static !important; /* 防止被定位到屏幕外 */
}

/* 表格单元格样式 */
.woocommerce-product-details__short-description table td,
.woocommerce-Tabs-panel--description table td,
.product-description table td,
.entry-content table td {
    padding: 12px 15px !important;
    border: 1px solid #e1e5e9 !important;
    vertical-align: top !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    color: #333 !important;
    background: transparent !important;
    display: table-cell !important; /* 强制显示为表格单元格 */
}

/* 表格行样式 */
.woocommerce-product-details__short-description table tr,
.woocommerce-Tabs-panel--description table tr,
.product-description table tr,
.entry-content table tr {
    display: table-row !important; /* 强制显示为表格行 */
    border: none !important;
}

/* 表格行交替背景色 */
.woocommerce-product-details__short-description table tr:nth-child(even) td,
.woocommerce-Tabs-panel--description table tr:nth-child(even) td,
.product-description table tr:nth-child(even) td,
.entry-content table tr:nth-child(even) td {
    background: #f8f9fa !important;
}

/* 表格行悬停效果 - 低调灰色 */
.woocommerce-product-details__short-description table tr:hover td,
.woocommerce-Tabs-panel--description table tr:hover td,
.product-description table tr:hover td,
.entry-content table tr:hover td {
    background: #f5f5f5 !important;
    transition: background-color 0.2s ease !important;
}

/* 第一列（标签列）样式 */
.woocommerce-product-details__short-description table td:first-child,
.woocommerce-Tabs-panel--description table td:first-child,
.product-description table td:first-child,
.entry-content table td:first-child {
    font-weight: 600 !important;
    background: #f1f3f4 !important;
    color: #2c3e50 !important;
    width: 35% !important;
    min-width: 150px !important;
}

/* 第二列（值列）样式 */
.woocommerce-product-details__short-description table td:last-child,
.woocommerce-Tabs-panel--description table td:last-child,
.product-description table td:last-child,
.entry-content table td:last-child {
    color: #495057 !important;
    width: 65% !important;
}

/* 表格标题样式（如果有th元素） - 低调简洁风格 */
.woocommerce-product-details__short-description table th,
.woocommerce-Tabs-panel--description table th,
.product-description table th,
.entry-content table th {
    background: #f8f9fa !important;
    color: #495057 !important;
    padding: 12px 15px !important;
    text-align: left !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    border: 1px solid #e1e5e9 !important;
    border-bottom: 2px solid #dee2e6 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}

/* 移动端响应式 - 平板设备 */
@media (max-width: 1024px) {
    .woocommerce-product-details__short-description table,
    .woocommerce-Tabs-panel--description table,
    .product-description table,
    .entry-content table {
        font-size: 13px !important;
        margin: 18px 0 !important;
    }

    .woocommerce-product-details__short-description table td,
    .woocommerce-Tabs-panel--description table td,
    .product-description table td,
    .entry-content table td {
        padding: 10px 12px !important;
        font-size: 13px !important;
    }
}

/* 移动端响应式 - 手机设备 */
@media (max-width: 768px) {
    /* 表格容器水平滚动 */
    .woocommerce-product-details__short-description,
    .woocommerce-Tabs-panel--description,
    .product-description,
    .entry-content {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .woocommerce-product-details__short-description table,
    .woocommerce-Tabs-panel--description table,
    .product-description table,
    .entry-content table {
        font-size: 12px !important;
        margin: 15px 0 !important;
        min-width: 400px !important; /* 确保表格有最小宽度 */
        border-radius: 6px !important;
    }

    .woocommerce-product-details__short-description table td,
    .woocommerce-Tabs-panel--description table td,
    .product-description table td,
    .entry-content table td {
        padding: 8px 10px !important;
        font-size: 12px !important;
        line-height: 1.4 !important;
        white-space: nowrap !important; /* 防止文字换行 */
    }

    .woocommerce-product-details__short-description table td:first-child,
    .woocommerce-Tabs-panel--description table td:first-child,
    .product-description table td:first-child,
    .entry-content table td:first-child {
        width: 35% !important;
        min-width: 120px !important;
        font-weight: 700 !important;
        font-size: 11px !important;
    }

    .woocommerce-product-details__short-description table td:last-child,
    .woocommerce-Tabs-panel--description table td:last-child,
    .product-description table td:last-child,
    .entry-content table td:last-child {
        width: 65% !important;
        min-width: 150px !important;
    }
}

/* 超小屏幕设备 */
@media (max-width: 480px) {
    .woocommerce-product-details__short-description table,
    .woocommerce-Tabs-panel--description table,
    .product-description table,
    .entry-content table {
        font-size: 11px !important;
        margin: 12px 0 !important;
        min-width: 350px !important;
    }

    .woocommerce-product-details__short-description table td,
    .woocommerce-Tabs-panel--description table td,
    .product-description table td,
    .entry-content table td {
        padding: 6px 8px !important;
        font-size: 11px !important;
        line-height: 1.3 !important;
    }

    .woocommerce-product-details__short-description table td:first-child,
    .woocommerce-Tabs-panel--description table td:first-child,
    .product-description table td:first-child,
    .entry-content table td:first-child {
        font-size: 10px !important;
        min-width: 100px !important;
    }
}

/* 特殊情况：覆盖可能的主题冲突 */
.woocommerce div.product .woocommerce-tabs .woocommerce-Tabs-panel table {
    display: table !important;
    width: 100% !important;
    border-collapse: collapse !important;
}

.woocommerce div.product .woocommerce-tabs .woocommerce-Tabs-panel table td {
    display: table-cell !important;
    padding: 12px 15px !important;
    border: 1px solid #e1e5e9 !important;
}

/* 确保表格在所有容器中都能正确显示 */
.woocommerce-product-details__short-description,
.woocommerce-Tabs-panel--description,
.product-description,
.entry-content {
    overflow-x: auto !important; /* 允许水平滚动 */
}

/* 表格容器样式 */
.woocommerce-product-details__short-description table,
.woocommerce-Tabs-panel--description table,
.product-description table,
.entry-content table {
    min-width: 400px !important; /* 最小宽度 */
    max-width: 100% !important;
}

/* 防止表格被隐藏的通用规则 */
table[cellspacing="0"] {
    display: table !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: static !important;
    width: 100% !important;
    border-collapse: collapse !important;
    margin: 20px 0 !important;
    background: #fff !important;
    border: 1px solid #ddd !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08) !important;
}

table[cellspacing="0"] td {
    display: table-cell !important;
    padding: 12px 15px !important;
    border: 1px solid #e1e5e9 !important;
    vertical-align: top !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    color: #333 !important;
    background: transparent !important;
}

table[cellspacing="0"] tr {
    display: table-row !important;
    border: none !important;
}

table[cellspacing="0"] tr:nth-child(even) td {
    background: #f8f9fa !important;
}

table[cellspacing="0"] tr:hover td {
    background: #f5f5f5 !important;
    transition: background-color 0.2s ease !important;
}

table[cellspacing="0"] td:first-child {
    font-weight: 600 !important;
    background: #f1f3f4 !important;
    color: #2c3e50 !important;
    width: 35% !important;
    min-width: 150px !important;
}

table[cellspacing="0"] td:last-child {
    color: #495057 !important;
    width: 65% !important;
}

/* 产品规格表格特殊标识 - 低调边框 */
.product-specifications-table {
    border: 1px solid #dee2e6 !important;
    border-radius: 8px !important;
    margin: 25px 0 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08) !important;
}

.product-specifications-table td:first-child {
    background: #f8f9fa !important;
    border-right: 1px solid #dee2e6 !important;
}

/* 移动端卡片式布局（可选方案） */
@media (max-width: 360px) {
    /* 隐藏原始表格，显示卡片式布局 */
    .mobile-card-layout .woocommerce-product-details__short-description table,
    .mobile-card-layout .woocommerce-Tabs-panel--description table,
    .mobile-card-layout .product-description table,
    .mobile-card-layout .entry-content table {
        display: none !important;
    }

    /* 卡片式规格显示 */
    .mobile-specs-cards {
        display: block !important;
        margin: 20px 0 !important;
    }

    .mobile-spec-card {
        background: #fff !important;
        border: 1px solid #e1e5e9 !important;
        border-radius: 8px !important;
        margin-bottom: 12px !important;
        padding: 15px !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05) !important;
    }

    .mobile-spec-label {
        font-weight: 600 !important;
        color: #2c3e50 !important;
        font-size: 12px !important;
        margin-bottom: 5px !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
    }

    .mobile-spec-value {
        color: #495057 !important;
        font-size: 13px !important;
        line-height: 1.4 !important;
    }
}

/* 滚动提示已删除 */
