/**
 * Frontend Styles
 *
 * @package WBT_SPB
 */

/* Sale Page Container */
.wbt-spb-sale-page {
    margin: 0 0 30px 0;
    font-family: inherit;
}

/* Group Title */
.wbt-spb-group-title-wrap {
    margin: 0 0 14px;
    text-align: center;
}

.wbt-spb-group-title {
    display: inline-block;
    margin: 0;
    padding: 12px 34px;
    border-radius: 20px 20px 0 0;
    background: #ff8b00;
    color: #fff;
    font-size: 36px;
    line-height: 1.2;
    font-weight: 700;
}

/* Toolbar */
.wbt-spb-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    margin-bottom: 20px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    flex-wrap: wrap;
    gap: 15px;
}

.wbt-spb-toolbar-left {
    display: flex;
    align-items: center;
}

.wbt-spb-count {
    color: #666;
    font-size: 14px;
}

.wbt-spb-toolbar-right {
    display: flex;
    gap: 10px;
}

/* Buttons */
.wbt-spb-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    background: #fff;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wbt-spb-btn:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.wbt-spb-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.wbt-spb-btn-icon {
    font-size: 16px;
}

/* Table Layout */
.wbt-spb-table-wrapper {
    overflow-x: auto;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
}

.wbt-spb-products-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.wbt-spb-products-table thead {
    background: #f8f8f8;
}

.wbt-spb-products-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e5e5e5;
}

.wbt-spb-products-table td {
    padding: 15px;
    vertical-align: middle;
    border-bottom: 1px solid #eee;
}

.wbt-spb-products-table tr:last-child td {
    border-bottom: none;
}

.wbt-spb-products-table tr:hover {
    background: #fafafa;
}

/* Product Image */
.wbt-spb-cell-image {
    width: 80px;
}

.wbt-spb-product-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #eee;
}

/* Product Title */
.wbt-spb-product-title {
    color: #333;
    text-decoration: none;
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.wbt-spb-product-title:hover {
    color: #0073aa;
}

.wbt-spb-product-excerpt {
    color: #666;
    font-size: 13px;
    line-height: 1.4;
}

/* Price */
.wbt-spb-price-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wbt-spb-price-regular {
    text-decoration: line-through;
    color: #999;
    font-size: 12px;
}

.wbt-spb-price-sale {
    color: #dc3545;
    font-weight: 600;
    font-size: 16px;
}

/* Sale Badge */
.wbt-spb-sale-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #dc3545;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 3px;
}

/* Stock Badge */
.wbt-spb-stock-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
}

.wbt-spb-stock-badge.in-stock {
    background: #d4edda;
    color: #155724;
}

.wbt-spb-stock-badge.out-of-stock {
    background: #f8d7da;
    color: #721c24;
}

.wbt-spb-stock-badge.on-back-order {
    background: #fff3cd;
    color: #856404;
}

.wbt-spb-stock-badge.low-stock {
    background: #fff3cd;
    color: #856404;
}

/* Add to Cart */
.wbt-spb-add-to-cart-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.wbt-spb-quantity {
    width: 60px !important;
    padding: 6px 8px !important;
    border: 1px solid #ccc !important;
    border-radius: 4px;
    text-align: center;
}

/* Cart Message */
.wbt-spb-cart-message {
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 4px;
}

.wbt-spb-cart-message.wbt-spb-success {
    background: #d4edda;
    color: #155724;
}

.wbt-spb-cart-message.wbt-spb-error {
    background: #f8d7da;
    color: #721c24;
}

/* Empty State */
.wbt-spb-empty-state {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
}

.wbt-spb-empty-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.wbt-spb-empty-title {
    font-size: 18px;
    color: #333;
    margin: 0 0 10px 0;
}

.wbt-spb-empty-message {
    color: #666;
    margin: 0;
}

/* Card Layout */
.wbt-spb-cards-grid {
    display: grid;
    grid-template-columns: repeat(var(--columns, 4), 1fr);
    gap: 20px;
}

@media (max-width: 768px) {
    .wbt-spb-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .wbt-spb-cards-grid {
        grid-template-columns: 1fr;
    }
}

.wbt-spb-product-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.wbt-spb-product-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.wbt-spb-card-image {
    position: relative;
    aspect-ratio: 1;
    background: #f8f8f8;
}

.wbt-spb-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wbt-spb-card-image .wbt-spb-sale-badge {
    position: absolute;
    top: 10px;
    right: 10px;
}

.wbt-spb-card-content {
    padding: 15px;
}

.wbt-spb-card-title {
    font-size: 16px;
    margin: 0 0 10px 0;
}

.wbt-spb-card-title a {
    color: #333;
    text-decoration: none;
}

.wbt-spb-card-title a:hover {
    color: #0073aa;
}

.wbt-spb-card-price {
    margin-bottom: 10px;
}

.wbt-spb-card-stock {
    margin-bottom: 15px;
}

.wbt-spb-card-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* List Layout (Thai sale-style) */
.wbt-spb-layout-list {
    background: transparent;
    border-radius: 0;
    padding: 18px 22px;
}

.wbt-spb-layout-list .wbt-spb-group-title-wrap {
    margin-bottom: 0;
}

.wbt-spb-price-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.wbt-spb-price-list-shell {
    padding: 24px;
    border: 1px solid #0066CC;
    border-radius: 24px;
    background:#fff;
}

.wbt-spb-price-list--auto {
    column-gap: 38px;
}

.wbt-spb-price-list--auto.columns-1 {
    column-count: 1;
}

.wbt-spb-price-list--auto.columns-2 {
    column-count: 2;
}

.wbt-spb-price-list--auto.columns-3 {
    column-count: 3;
}

.wbt-spb-price-list-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 38px;
}

.wbt-spb-price-list--column {
    margin: 0;
}

.wbt-spb-price-list-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 12px;
    color: #1f2937;
    font-size: 16px;
    line-height: 1.35;
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
}

.wbt-spb-price-list-main {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
}

.wbt-spb-price-list-index {
    flex: 0 0 auto;
    min-width: 2ch;
    text-align: right;
}

.wbt-spb-price-list-item:last-child {
    margin-bottom: 0;
}

.wbt-spb-price-list-title {
    color: #1f2937;
    text-decoration: none;
    font-weight: 400;
}

.wbt-spb-price-list-title:hover {
    text-decoration: underline;
}

.wbt-spb-price-list-price {
    color: #005bd3;
    font-weight: 500;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .wbt-spb-group-title {
        font-size: 24px;
        padding: 10px 20px;
        border-radius: 14px 14px 0 0;
    }

    .wbt-spb-layout-list {
        padding: 14px 16px;
    }

    .wbt-spb-price-list-shell {
        padding: 16px;
    }

    .wbt-spb-price-list-item {
        font-size: 15px;
        gap: 12px;
    }

    .wbt-spb-price-list--auto {
        column-count: 1 !important;
    }

    .wbt-spb-price-list-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}
