/**
 * 自定义比较页面样式
 * 匹配设计图：每个字段独立一行
 * 行顺序：图片(含删除)、名称、SKU、价格、库存、加入购物车
 */

/* ========================================
   比较表格基础样式
   ======================================== */
.wd-compare-table {
    display: table !important;
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    margin-bottom: 30px;
}

.wd-compare-table tbody {
    display: table-row-group !important;
}

.wd-compare-table tr {
    display: table-row !important;
    border-bottom: 1px solid #e5e5e5;
}

.wd-compare-table tr:last-child {
    border-bottom: none;
}

/* 字段标题列 - 左侧标签 */
.wd-compare-table th.compare-field {
    display: table-cell !important;
    width: 100px;
    min-width: 100px;
    padding: 15px 20px;
    background: transparent;
    border-right: none;
    font-weight: 400;
    font-size: 14px;
    color: #333;
    text-align: left;
    vertical-align: middle;
    text-transform: none;
    flex: none !important;
}

/* 产品数据列 */
.wd-compare-table td.compare-value {
    display: table-cell !important;
    padding: 15px 20px;
    text-align: left;
    vertical-align: middle;
    border-right: 1px solid #e5e5e5;
    min-width: 250px;
    max-width: none !important;
    flex: none !important;
}

.wd-compare-table td.compare-value:last-child {
    border-right: none;
}

/* ========================================
   图片行 (basic) - 包含删除按钮和图片
   ======================================== */
.wd-compare-table .compare-basic th.compare-field {
    vertical-align: top;
    padding-top: 20px;
}

.wd-compare-table .compare-basic td.compare-value {
    padding-top: 10px;
    padding-bottom: 20px;
    vertical-align: top;
    text-align: left;
}

/* 删除按钮样式 - "× 删除" */
.wd-compare-table .wd-compare-remove-action {
    margin-bottom: 10px;
    text-align: left;
}

.wd-compare-table .wd-compare-remove-action a {
    color: #a94442;
    font-size: 13px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.wd-compare-table .wd-compare-remove-action a:hover {
    color: #c9302c;
    text-decoration: underline;
}

/* 产品图片样式 - 居左显示 */
.wd-compare-table .product-image {
    display: block;
    margin-bottom: 0;
    text-align: left;
}

.wd-compare-table .product-image img {
    max-width: 200px;
    width: auto;
    height: auto;
    border-radius: 0;
    margin: 0;
    object-fit: contain;
}

/* 隐藏basic行中的标题、评分、价格、加入购物车（在单独行显示） */
.wd-compare-table .compare-basic .wd-entities-title,
.wd-compare-table .compare-basic .star-rating,
.wd-compare-table .compare-basic .price,
.wd-compare-table .compare-basic .add_to_cart_button,
.wd-compare-table .compare-basic .add-to-cart-loop,
.wd-compare-table .compare-basic .button {
    display: none !important;
}

/* ========================================
   SKU行样式
   ======================================== */
.wd-compare-table .compare-sku td.compare-value {
    font-size: 14px;
    color: #333;
}

/* ========================================
   价格行样式
   ======================================== */
.wd-compare-table td.compare-value .price {
    font-size: 14px;
    color: #333;
}

.wd-compare-table td.compare-value .price del {
    color: #999;
    font-size: 14px;
    font-weight: normal;
    margin-right: 5px;
    text-decoration: line-through;
}

.wd-compare-table td.compare-value .price del .woocommerce-Price-amount {
    color: #999;
}

.wd-compare-table td.compare-value .price ins {
    text-decoration: none;
    color: #c9302c;
    font-weight: 500;
}

.wd-compare-table td.compare-value .price ins .woocommerce-Price-amount {
    color: #c9302c;
}

/* ========================================
   库存状态行样式
   ======================================== */
.wd-compare-table .compare-availability td.compare-value {
    font-size: 14px;
}

.wd-compare-table .compare-availability .stock {
    margin: 0;
}

.wd-compare-table .compare-availability .in-stock {
    color: #333;
}

.wd-compare-table .compare-availability .out-of-stock {
    color: #d9534f;
}

/* ========================================
   加入购物车按钮样式 - 使用主题颜色
   ======================================== */
.wd-compare-table .add_to_cart_button,
.wd-compare-table .add-to-cart-loop,
.wd-compare-table a.button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: #c9302c !important;
    color: #fff !important;
    font-size: 14px;
    font-weight: 500;
    border: none !important;
    border-radius: 3px;
    cursor: pointer;
    text-decoration: none !important;
    transition: background 0.3s ease;
    line-height: 1.4;
}

.wd-compare-table .add_to_cart_button:hover,
.wd-compare-table .add-to-cart-loop:hover,
.wd-compare-table a.button:hover {
    background: #a52521 !important;
    color: #fff !important;
}

/* 添加购物车图标 */
.wd-compare-table .add_to_cart_button::before,
.wd-compare-table .add-to-cart-loop::before {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M7 18c-1.1 0-1.99.9-1.99 2S5.9 22 7 22s2-.9 2-2-.9-2-2-2zM1 2v2h2l3.6 7.59-1.35 2.45c-.16.28-.25.61-.25.96 0 1.1.9 2 2 2h12v-2H7.42c-.14 0-.25-.11-.25-.25l.03-.12.9-1.63h7.45c.75 0 1.41-.41 1.75-1.03l3.58-6.49c.08-.14.12-.31.12-.48 0-.55-.45-1-1-1H5.21l-.94-2H1zm16 16c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
}

/* ========================================
   隐藏不需要的字段行
   ======================================== */
.wd-compare-table .compare-description,
.wd-compare-table .compare-dimensions,
.wd-compare-table .compare-weight,
.wd-compare-table tr[class*="pa_"] {
    display: none !important;
}

/* ======================================
   重新组织比较表格布局 - 匹配设计图
   每个产品列显示：删除、图片、名称、SKU、价格、库存、加入购物车
   ====================================== */

/* 比较页面专用样式 */
.custom-compare-page .wd-compare-table {
    border: none;
    border-top: 1px solid #e5e5e5;
}

.custom-compare-page .wd-compare-table tr {
    border-bottom: 1px solid #e5e5e5;
}

/* 调整basic行显示所有内容 */
.custom-compare-page .wd-compare-table .compare-basic .price {
    display: block !important;
    margin: 10px 0;
}

.custom-compare-page .wd-compare-table .compare-basic .add_to_cart_button,
.custom-compare-page .wd-compare-table .compare-basic .add-to-cart-loop,
.custom-compare-page .wd-compare-table .compare-basic .button {
    display: inline-block !important;
}

/* 创建新行标签样式 */
.custom-compare-page .wd-compare-table .compare-basic th.compare-field {
    position: relative;
}

/* 名称行 - 在basic行的标题单元格中显示 */
.custom-compare-page .wd-compare-table .compare-basic ~ .compare-sku th::before {
    content: none;
}

/* 价格行标签 */
.custom-compare-page .wd-compare-table tr.compare-price th.compare-field {
    font-weight: 400;
}

/* 加入购物车行标签 */
.custom-compare-page .wd-compare-table tr.compare-add-to-cart th.compare-field {
    font-weight: 400;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .wd-compare-table {
        display: block !important;
        overflow-x: auto;
    }
    
    .wd-compare-table th.compare-field {
        min-width: 100px;
        padding: 10px 15px;
        font-size: 13px;
    }
    
    .wd-compare-table td.compare-value {
        min-width: 150px;
        padding: 10px 15px;
    }
    
    .wd-compare-table .product-image img {
        max-width: 150px;
    }
}

/* 空比较页面样式 */
.wd-empty-compare {
    text-align: center;
    padding: 60px 20px;
    font-size: 18px;
    color: #666;
}

/* 比较页面容器 */
.wd-compare-page {
    margin-bottom: 30px;
}

/* 比较页面头部（分类选择） */
.wd-compare-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f8f8;
    border-radius: 4px;
}

.wd-compare-select-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wd-compare-select-wrap label {
    font-weight: 500;
    color: #333;
}

.wd-compare-select {
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* 比较页面操作按钮 */
.wd-compare-actions {
    display: flex;
    gap: 10px;
}

.wd-compare-actions .btn {
    padding: 8px 20px;
    font-size: 14px;
}

/* ========================================
   自定义比较表格样式 [custom_compare_table]
   精确匹配设计图布局 - 无上左右边框
   ======================================== */

.custom-compare-wrapper {
    width: 100%;
    overflow-x: auto;
    margin-bottom: 30px;
}

.custom-compare-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    min-width: 600px;
    border: none;
}

.custom-compare-table tr {
    border-bottom: 1px solid #e5e5e5;
}

.custom-compare-table tr:last-child {
    border-bottom: none;
}

/* 删除按钮行 - 无底边框 */
.custom-compare-table tr.compare-remove {
    border-bottom: none;
}

/* 左侧行标签 */
.custom-compare-table th.row-label {
    width: 100px;
    min-width: 100px;
    padding: 15px 20px;
    font-weight: 400;
    font-size: 14px;
    color: #333;
    text-align: left;
    vertical-align: middle;
    background: transparent;
    border: none;
}

/* 产品单元格 - 无左右边框，只有列间分隔 */
.custom-compare-table td.product-cell {
    padding: 15px 20px;
    text-align: left;
    vertical-align: middle;
    border: none;
    border-right: 1px solid #e5e5e5;
    min-width: 250px;
}

.custom-compare-table td.product-cell:last-child {
    border-right: none;
}

/* 删除按钮行样式 */
.custom-compare-table .compare-remove td.product-cell {
    padding-bottom: 5px;
    vertical-align: bottom;
}

/* 删除按钮 */
.custom-compare-table .remove-from-compare {
    color: #a94442;
    font-size: 13px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.custom-compare-table .remove-from-compare:hover {
    color: #c9302c;
    text-decoration: underline;
}

/* 图片行样式 */
.custom-compare-table .compare-image th.row-label {
    vertical-align: middle;
}

.custom-compare-table .compare-image td.product-cell {
    vertical-align: top;
    padding-top: 10px;
    padding-bottom: 20px;
}

/* 产品图片 */
.custom-compare-table .product-image-link {
    display: block;
}

.custom-compare-table .product-image-link img {
    max-width: 200px;
    width: auto;
    height: auto;
    border-radius: 0;
}

/* 产品名称 - 黑色链接 */
.custom-compare-table .product-title {
    color: #333;
    font-size: 14px;
    font-weight: 400;
    text-decoration: none;
    line-height: 1.5;
}

.custom-compare-table .product-title:hover {
    color: #000;
    text-decoration: underline;
}

/* 库存状态样式 - 黑色 */
.custom-compare-table .stock-status {
    font-size: 14px;
    color: #333;
}

.custom-compare-table .stock-status.in-stock {
    color: #333;
}

.custom-compare-table .stock-status.out-of-stock {
    color: #333;
}

.custom-compare-table .stock-status.on-backorder {
    color: #333;
}

/* SKU样式 */
.custom-compare-table .compare-sku td.product-cell {
    font-size: 14px;
    color: #333;
}

/* 价格样式 */
.custom-compare-table .compare-price td.product-cell {
    font-size: 14px;
}

.custom-compare-table .compare-price del {
    color: #999;
    font-size: 14px;
    margin-right: 5px;
}

.custom-compare-table .compare-price ins {
    text-decoration: none;
    color: #c9302c;
    font-weight: 500;
}

.custom-compare-table .compare-price .woocommerce-Price-amount {
    font-size: 14px;
}

/* 库存样式 */
.custom-compare-table .compare-stock td.product-cell {
    font-size: 14px;
    color: #333;
}

/* 加入购物车按钮 - 红色主题色 */
.custom-compare-table .compare-add-to-cart .button,
.custom-compare-table .compare-add-to-cart .add_to_cart_button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: #c9302c !important;
    color: #fff !important;
    font-size: 14px;
    font-weight: 500;
    border: none !important;
    border-radius: 3px;
    cursor: pointer;
    text-decoration: none !important;
    transition: background 0.3s ease;
    line-height: 1.4;
}

.custom-compare-table .compare-add-to-cart .button:hover,
.custom-compare-table .compare-add-to-cart .add_to_cart_button:hover {
    background: #a52521 !important;
    color: #fff !important;
}

/* 购物车图标 */
.custom-compare-table .compare-add-to-cart .cart-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M7 18c-1.1 0-1.99.9-1.99 2S5.9 22 7 22s2-.9 2-2-.9-2-2-2zM1 2v2h2l3.6 7.59-1.35 2.45c-.16.28-.25.61-.25.96 0 1.1.9 2 2 2h12v-2H7.42c-.14 0-.25-.11-.25-.25l.03-.12.9-1.63h7.45c.75 0 1.41-.41 1.75-1.03l3.58-6.49c.08-.14.12-.31.12-.48 0-.55-.45-1-1-1H5.21l-.94-2H1zm16 16c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    margin-right: 5px;
}

/* 响应式 */
@media (max-width: 768px) {
    .custom-compare-table th.row-label {
        min-width: 80px;
        padding: 10px 15px;
        font-size: 13px;
    }
    
    .custom-compare-table td.product-cell {
        min-width: 180px;
        padding: 10px 15px;
    }
    
    .custom-compare-table .product-image-link img {
        max-width: 150px;
    }
}

/* ========================================
   自定义收藏表格样式 [woodmart_wishlist]
   精确匹配设计图布局
   ======================================== */

.custom-wishlist-wrapper {
    width: 100%;
    overflow-x: auto;
    margin-bottom: 30px;
}

.custom-wishlist-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

/* 表头样式 */
.custom-wishlist-table thead th {
    padding: 15px 20px;
    font-weight: 400;
    font-size: 14px;
    color: #333;
    text-align: left;
    border-bottom: 1px solid #e5e5e5;
    background: transparent;
}

.custom-wishlist-table thead th.product-col {
    min-width: 350px;
}

.custom-wishlist-table thead th.price-col {
    min-width: 120px;
}

.custom-wishlist-table thead th.date-col {
    min-width: 100px;
}

.custom-wishlist-table thead th.stock-col {
    min-width: 80px;
}

.custom-wishlist-table thead th.cart-col {
    min-width: 140px;
}

.custom-wishlist-table thead th.remove-col {
    width: 40px;
}

/* 表格行样式 */
.custom-wishlist-table tbody tr {
    border-bottom: 1px solid #e5e5e5;
}

.custom-wishlist-table tbody tr:last-child {
    border-bottom: none;
}

.custom-wishlist-table tbody td {
    padding: 15px 20px;
    vertical-align: middle;
}

/* 产品信息列 */
.custom-wishlist-table .product-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.custom-wishlist-table .product-image {
    flex-shrink: 0;
}

.custom-wishlist-table .product-image img {
    width: 60px;
    height: auto;
    border-radius: 0;
}

.custom-wishlist-table .product-name {
    color: #333;
    font-size: 14px;
    text-decoration: none;
    line-height: 1.4;
}

.custom-wishlist-table .product-name:hover {
    color: #000;
    text-decoration: underline;
}

/* 价格样式 */
.custom-wishlist-table .price-col del {
    color: #999;
    font-size: 14px;
    margin-right: 5px;
}

.custom-wishlist-table .price-col ins {
    text-decoration: none;
    color: #333;
    font-weight: 400;
}

.custom-wishlist-table .price-col ins .woocommerce-Price-amount {
    text-decoration: underline;
}

/* 日期样式 */
.custom-wishlist-table .date-col {
    font-size: 14px;
    color: #333;
}

/* 库存状态样式 */
.custom-wishlist-table .stock-status {
    font-size: 14px;
    color: #333;
}

/* 加入购物车按钮 - span标签 */
.custom-wishlist-table .cart-col {
    vertical-align: middle;
}

.custom-wishlist-table .wishlist-cart-btn {
    display: inline-block;
    padding: 8px 16px;
    background: #f5f5f5;
    color: #333;
    font-size: 13px;
    font-weight: 400;
    border: 1px solid #ddd;
    border-radius: 0;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    line-height: 1.4;
    vertical-align: middle;
}

.custom-wishlist-table .wishlist-cart-btn:hover {
    background: #e5e5e5;
    border-color: #ccc;
}

.custom-wishlist-table .wishlist-cart-btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 移除按钮 - 红色圆圈X */
.custom-wishlist-table .remove-from-wishlist {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #c9302c;
    color: #fff;
    font-size: 16px;
    font-weight: 300;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s ease;
    line-height: 1;
}

.custom-wishlist-table .remove-from-wishlist:hover {
    background: #a52521;
}

/* 收藏页面响应式 */
@media (max-width: 768px) {
    .custom-wishlist-table thead th,
    .custom-wishlist-table tbody td {
        padding: 10px 15px;
    }
    
    .custom-wishlist-table .product-image img {
        width: 50px;
    }
    
    .custom-wishlist-table .product-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}
