/**
 * Product Catalog Styles
 * 
 * Styles for the product catalog display, compatible with Spectra theme
 */

/* Product Catalog Container */
.product-catalog-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: inherit;
}

/* Filter Form Styles */
.product-catalog-filters {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: end;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    width: 100%;
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

.filter-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
    font-size: 14px;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2);
}

.filter-actions {
    display: flex;
    gap: 10px;
    align-items: end;
}

.filter-submit,
.filter-reset {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.filter-submit {
    background: #007cba;
    color: white;
}

.filter-submit:hover {
    background: #005a87;
}

.filter-reset {
    background: #6c757d;
    color: white;
}

.filter-reset:hover {
    background: #545b62;
}

/* Results Header */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
}

.results-count {
    font-size: 16px;
    color: #666;
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Product Card */
.product-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.product-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16/9;
}

.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);
}

.product-content {
    padding: 20px;
}

.product-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
}

.product-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.product-title a:hover {
    color: #007cba;
}

.product-excerpt {
    color: #666;
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 15px;
}

.product-details {
    margin-bottom: 20px;
}

.product-details > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
}

.product-details .price-label,
.product-details .quantity-label,
.product-details .location-label {
    font-weight: 500;
    color: #666;
}

.product-details .price-value {
    font-weight: 600;
    color: #28a745;
    font-size: 16px;
}

.product-details .quantity-value,
.product-details .location-value {
    font-weight: 500;
    color: #333;
}

.product-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.contact-seller-btn,
.view-details-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s ease;
    min-width: 80px;
}

.contact-seller-btn {
    background: #007cba;
    color: white;
}

.contact-seller-btn:hover {
    background: #005a87;
    color: white;
}

.view-details-btn {
    background: #6c757d;
    color: white;
}

.view-details-btn:hover {
    background: #545b62;
    color: white;
}

/* Contact Modal */
.contact-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.contact-modal-content {
    background: white;
    border-radius: 8px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.contact-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    transition: color 0.3s ease;
}

.contact-modal-close:hover {
    color: #333;
}

.contact-modal h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 20px;
}

.contact-info {
    margin-bottom: 20px;
}

.contact-details p {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #666;
}

.contact-details strong {
    color: #333;
}

.contact-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.email-link,
.phone-link {
    padding: 10px 20px;
    background: #007cba;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.3s ease;
}

.email-link:hover,
.phone-link:hover {
    background: #005a87;
    color: white;
}

.phone-link {
    background: #28a745;
}

.phone-link:hover {
    background: #1e7e34;
}

/* No Products Message */
.no-products {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 16px;
}

/* Pagination */
.product-catalog-pagination {
    display: flex;
    justify-content: center;
    margin-top: 30px;
}

.product-catalog-pagination .page-numbers {
    display: flex;
    gap: 5px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.product-catalog-pagination .page-numbers li {
    margin: 0;
}

.product-catalog-pagination .page-numbers a,
.product-catalog-pagination .page-numbers span {
    display: block;
    padding: 8px 12px;
    border: 1px solid #ddd;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.product-catalog-pagination .page-numbers a:hover {
    background: #007cba;
    color: white;
    border-color: #007cba;
}

.product-catalog-pagination .page-numbers .current {
    background: #007cba;
    color: white;
    border-color: #007cba;
}

/* Loading State */
.product-catalog-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.product-catalog-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .product-catalog-container {
        padding: 15px;
    }
    
    .filter-form {
        flex-direction: column;
    }
    
    .filter-row {
        flex-direction: column;
    }
    
    .filter-group {
        min-width: 100%;
    }
    
    .filter-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .filter-submit,
    .filter-reset {
        width: 100%;
    }
    
    .product-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .product-actions {
        flex-direction: column;
    }
    
    .contact-seller-btn,
    .view-details-btn {
        width: 100%;
    }
    
    .contact-modal-content {
        margin: 20px;
        padding: 20px;
    }
    
    .contact-actions {
        flex-direction: column;
    }
    
    .email-link,
    .phone-link {
        text-align: center;
    }
}

@media (max-width: 480px) {
    .product-catalog-container {
        padding: 10px;
    }
    
    .product-catalog-filters {
        padding: 15px;
    }
    
    .product-content {
        padding: 15px;
    }
    
    .product-title {
        font-size: 16px;
    }
    
    .product-details > div {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
}

/* Spectra Theme Compatibility */
.wp-block-group .product-catalog-container {
    max-width: none;
}

.wp-block-columns .product-catalog-container {
    max-width: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .product-card {
        border: 2px solid #000;
    }
    
    .filter-group input:focus,
    .filter-group select:focus {
        border-color: #000;
        box-shadow: 0 0 0 2px #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .product-card,
    .product-image img,
    .filter-group input,
    .filter-group select,
    .contact-seller-btn,
    .view-details-btn,
    .email-link,
    .phone-link {
        transition: none;
    }
    
    .product-card:hover {
        transform: none;
    }
    
    .product-card:hover .product-image img {
        transform: none;
    }
}
