/* Shop Products Grid Widget Styles */

.shop-products-grid-widget {
    width: 100%;
    max-width: 100%;
}

/* Toolbar Styles */
.shop-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 0;
    border-bottom: 1px solid #e0e0e0;
    flex-wrap: wrap;
    gap: 15px;
}

.result-count {
    font-size: 14px;
    color: #666;
}

.shop-sorting {
    display: flex;
    align-items: center;
    gap: 10px;
}

.shop-sorting label {
    font-size: 14px;
    color: #333;
    margin: 0;
}

.shop-sorting select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    font-size: 14px;
    min-width: 200px;
}

/* Products Grid */
.shop-products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

/* Product Card */
.product-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Product Image */
.product-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.sale-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #ff4444;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    z-index: 2;
}

/* Product Info */
.product-info {
    padding: 15px;
}

.product-title {
    margin: 0 0 10px 0;
    font-size: 16px;
    line-height: 1.4;
}

.product-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.product-title a:hover {
    color: #007cba;
}

.product-price {
    margin: 10px 0;
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

.product-price .woocommerce-Price-amount {
    color: #007cba;
}

.product-price del {
    color: #999;
    font-weight: normal;
    margin-right: 8px;
}

/* Color Swatches */
.product-swatches {
    margin: 12px 0;
}

.color-swatches-list {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.color-swatch {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #ddd;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.color-swatch:hover {
    transform: scale(1.2);
}

.more-colors {
    font-size: 12px;
    color: #666;
    margin-left: 4px;
    font-weight: 500;
}

/* Product Actions */
.product-actions {
    margin-top: 15px;
}

.customize-button {
    display: inline-block;
    width: 100%;
    padding: 10px 15px;
    background-color: #007cba;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.3s ease;
    border: none;
    cursor: pointer;
}

.customize-button:hover {
    background-color: #005a87;
    color: white;
}

/* Pagination */
.shop-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 30px;
    padding: 20px 0;
}

.shop-pagination .page-numbers {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 2px;
    background: #fff;
    border: 1px solid #ddd;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.shop-pagination .page-numbers:hover,
.shop-pagination .page-numbers.current {
    background: #007cba;
    color: white;
    border-color: #007cba;
}

.shop-pagination .page-numbers.prev,
.shop-pagination .page-numbers.next {
    font-weight: bold;
}

/* Infinite Scroll */
.infinite-scroll-trigger {
    text-align: center;
    padding: 30px 0;
}

.loading-spinner {
    display: inline-block;
    padding: 15px 30px;
    background: #f8f8f8;
    border-radius: 25px;
    color: #666;
    font-size: 14px;
}

.loading-spinner::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* No Products Found */
.no-products-found {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 16px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .shop-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .shop-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .shop-sorting {
        justify-content: space-between;
    }
    
    .shop-sorting select {
        min-width: auto;
        flex: 1;
        margin-left: 10px;
    }
}

@media (max-width: 768px) {
    .shop-products-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .product-info {
        padding: 12px;
    }
    
    .product-title {
        font-size: 15px;
    }
    
    .color-swatch {
        width: 18px;
        height: 18px;
    }
    
    .shop-pagination .page-numbers {
        padding: 6px 10px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .shop-toolbar {
        padding: 10px 0;
        margin-bottom: 15px;
    }
    
    .result-count,
    .shop-sorting label,
    .shop-sorting select {
        font-size: 13px;
    }
    
    .product-info {
        padding: 10px;
    }
    
    .customize-button {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* Loading States */
.shop-products-grid.loading {
    opacity: 0.6;
    pointer-events: none;
}

.shop-products-grid.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
    z-index: 10;
}

/* Filter Integration */
.shop-products-grid-widget.filtered .product-card {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.shop-products-grid-widget.filtered .product-card.hidden {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
}

/* Accessibility */
.customize-button:focus,
.shop-sorting select:focus,
.page-numbers:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .shop-toolbar,
    .shop-pagination,
    .infinite-scroll-trigger,
    .customize-button {
        display: none !important;
    }
    
    .shop-products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    
    .product-card {
        break-inside: avoid;
        border: 1px solid #ccc !important;
        box-shadow: none !important;
    }
}
