/**
 * Product Grid Styles
 */

/* Container */
.bagus-product-grid {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Category Filter */
.bagus-product-categories {
    display: flex;
    gap: 12px;
    margin-bottom: 40px;
    flex-wrap: wrap;
    justify-content: center;
}

.bagus-category-btn {
    padding: 10px 24px;
    border: none;
    background: #f3f4f6;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bagus-category-btn:hover {
    background: #e5e7eb;
}

.bagus-category-btn.active {
    background: #000;
    color: #fff;
}

.bagus-product-categories br {
    display: none;
}

/* Products Grid */
.bagus-products-container {
    position: relative;
}

.bagus-products-grid {
    display: grid;
    grid-template-columns: repeat(var(--columns, 4), 1fr);
    gap: 24px;
    margin-bottom: 40px;
    transition: opacity 0.3s ease;
}

@media (max-width: 1024px) {
    .bagus-products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .bagus-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .bagus-products-grid {
        grid-template-columns: 1fr;
    }
}

/* Product Card */
.bagus-product-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.bagus-product-card:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transform: translateY(-4px);
}

/* Thumbnail */
.bagus-card-thumbnail {
    position: relative;
    aspect-ratio: 3/2;
    overflow: hidden;
    background: #f9fafb;
}

.bagus-card-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.bagus-card-thumbnail:hover img {
    transform: scale(1.05);
}

/* Label Badge */
.bagus-card-label {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 6px 12px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    z-index: 10;
    width: fit-content;
    /* Colors now applied via inline styles from settings */
}

/* Discount Badge */
.bagus-card-discount {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 6px 12px;
    background: #ef4444;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    border-radius: 6px;
    z-index: 10;
}

/* Card Body */
.bagus-card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

/* Title */
.bagus-card-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 2.8em; /* 2 lines * 1.4 line-height */
}

.bagus-card-title a {
    color: #111827;
    text-decoration: none;
    transition: color 0.2s ease;
}

.bagus-card-title a:hover {
    color: #6366f1;
}

/* Price */
.bagus-card-price {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0;
}

.bagus-price-sale {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}

.bagus-price-regular {
    font-size: 16px;
    color: #9ca3af;
    text-decoration: line-through;
}

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

/* Footer */
.bagus-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid #f3f4f6;
    margin-top: auto;
}

/* Sales Count */
.bagus-card-sales {
    font-size: 13px;
    color: #6b7280;
}

/* Star Rating */
.bagus-card-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
}

.bagus-stars {
    color: #fbbf24;
    font-size: 14px;
    line-height: 1;
}

.bagus-stars.empty {
    color: #d1d5db; /* Gray for empty stars */
}

.bagus-rating-value {
    color: #111827;
    font-weight: 600;
}

.bagus-review-count {
    color: #9ca3af;
}

/* Live Demo Button */
.bagus-card-button {
    --background-color: attr(data-button-color raw-string, inherit);
    display: block;
    width: 100%;
    padding: 12px;
    margin-top: 12px;
    /* background: #fff; */
    background: var(--background-color);
    border: 1px solid #e5e7eb;
    color: #374151;
    text-align: center;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.bagus-card-button:hover {
    background: #000;
    color: #fff;
    border-color: #000;
}

/* Pagination */
.bagus-products-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 40px;
}

.bagus-pagination {
    display: flex;
    gap: 8px;
}

.bagus-page-btn {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bagus-page-btn:hover {
    background: #f3f4f6;
}

.bagus-page-btn.active {
    background: #000;
    color: #fff;
    border-color: #000;
}

/* Loading Indicator */
.bagus-products-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
}

.bagus-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f3f4f6;
    border-top-color: #000;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* No Products */
.bagus-no-products {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
    font-size: 16px;
    grid-column: 1 / -1;
}

/* No Image Placeholder */
.bagus-card-no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    color: #9ca3af;
    font-size: 14px;
}
