/**
 * ExhaustHub Elementor Integration Styles
 * Styling for vehicle filters in Elementor pages
 */

/* Main Filter Container */
.exhausthub-elementor-filter {
    background: #ffffff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Filter Form */
.vehicle-filter-form {
    width: 100%;
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

/* Filter Groups */
.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    text-transform: capitalize;
}

/* Select Styling */
.vehicle-filter-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    color: #374151;
    appearance: none;
    cursor: pointer;
    transition: all 0.2s ease;
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 4 5"><path fill="%23666" d="M2 0L0 2h4zm0 5L0 3h4z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 40px;
}

.vehicle-filter-select:focus {
    outline: none;
    border-color: #8B5CF6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.vehicle-filter-select:disabled {
    background: #f9fafb;
    color: #9ca3af;
    cursor: not-allowed;
    border-color: #e5e7eb;
}

/* Filter Actions */
.filter-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.filter-products-btn,
.clear-filters-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-products-btn {
    background: #8B5CF6;
    color: white;
}

.filter-products-btn:hover:not(:disabled) {
    background: #7C3AED;
    transform: translateY(-1px);
}

.filter-products-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

.clear-filters-btn {
    background: white;
    color: #8B5CF6;
    border: 1px solid #8B5CF6;
}

.clear-filters-btn:hover {
    background: #f8f5ff;
}

/* Filter Results */
.filter-results {
    margin-top: 20px;
    padding: 15px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    color: #166534;
}

.results-count {
    margin: 0;
    font-weight: 600;
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .filter-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .filter-actions {
        flex-direction: column;
    }
    
    .filter-products-btn,
    .clear-filters-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .filter-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .exhausthub-elementor-filter {
        padding: 15px;
    }
}

/* Integration with Elementor Themes */
.elementor-widget-container .exhausthub-elementor-filter {
    margin: 0;
}

/* Loading States */
.filter-group.loading .vehicle-filter-select {
    position: relative;
    overflow: hidden;
}

.filter-group.loading .vehicle-filter-select::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.1), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Custom Elementor Styling */
.elementor-section .exhausthub-elementor-filter {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.elementor-section.elementor-section-dark .exhausthub-elementor-filter {
    background: #1f2937;
    color: white;
}

.elementor-section.elementor-section-dark .filter-group label {
    color: #e5e7eb;
}

.elementor-section.elementor-section-dark .vehicle-filter-select {
    background: #374151;
    color: white;
    border-color: #4b5563;
}

.elementor-section.elementor-section-dark .vehicle-filter-select:disabled {
    background: #1f2937;
    color: #6b7280;
}

/* Hide/Show Animation for Filtered Products */
.elementor-post,
.product,
.woocommerce-loop-product {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.elementor-post.filtered-hidden,
.product.filtered-hidden,
.woocommerce-loop-product.filtered-hidden {
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;
}

/* Success/Error States */
.filter-results.success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.filter-results.error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

.filter-results.warning {
    background: #fffbeb;
    border-color: #fed7aa;
    color: #d97706;
}

/* AJAX Loading States */
.loading-products {
    position: relative;
    opacity: 0.6;
    pointer-events: none;
}

.products-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    min-height: 200px;
}

.products-loading-overlay .loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #8B5CF6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.products-loading-overlay p {
    margin: 0;
    font-size: 16px;
    color: #666;
    font-weight: 500;
}

/* Error States */
.filter-error {
    text-align: center;
    padding: 40px 20px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #dc2626;
}

.filter-error p {
    margin: 0;
    font-size: 16px;
}

.no-products-found {
    text-align: center;
    padding: 40px 20px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #6b7280;
}

.no-products-found p {
    margin: 0;
    font-size: 16px;
}

/* Smooth Transitions */
.elementor-posts-container,
.elementor-posts,
.elementor-grid {
    transition: opacity 0.3s ease;
}

.loading-products .elementor-posts-container,
.loading-products .elementor-posts,
.loading-products .elementor-grid {
    opacity: 0.3;
}
