/* Listings Layout */
.listings-layout {
    display: flex;
    gap: 30px;
    margin-top: 30px;
}

.listings-main {
    flex: 1;
    min-width: 0; /* Prevents flex item from overflowing */
}

.listings-sidebar {
    width: 320px;
    flex-shrink: 0;
}

/* Filters Section Styles */
.filters-section {
    background: #fff;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
    border: 1px solid #e5e7eb;
    position: sticky;
    top: 20px;
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f3f4f6;
}

.filters-header h3 {
    margin: 0;
    color: #1f2937;
    font-size: 1.2rem;
    font-weight: 600;
}

.clear-filters-btn {
    background: transparent;
    color: #ef4444;
    border: 2px solid #ef4444;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.clear-filters-btn:hover {
    background: #ef4444;
    color: white;
}

.filters-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 25px;
    max-height: 80vh;
    overflow-y: auto;
    padding-right: 10px;
}

.filters-grid::-webkit-scrollbar {
    width: 6px;
}

.filters-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.filters-grid::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.filters-grid::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.filter-group {
    background: #f9fafb;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.filter-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
    font-size: 13px;
}

.filter-group select,
.filter-group input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    background: white;
    transition: border-color 0.3s ease;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Price range filter */
/* Price Range Slider */
.price-range-container {
    margin-top: 10px;
}

.price-range-slider {
    position: relative;
    height: 40px;
    margin-bottom: 15px;
}

.slider-track {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    transform: translateY(-50%);
}

.slider-range {
    position: absolute;
    height: 6px;
    background: var(--primaryColor);;
    border-radius: 3px;
    top: 0;
    left: 0;
    width: 100%;
}

.slider-dots {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
}

.slider-dot {
    position: absolute;
    width: 20px;
    height: 20px;
    background: var(--primaryColor);;
    border: 3px solid white;
    border-radius: 50%;
    cursor: grab;
    transform: translateX(-50%);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 10;
}

.slider-dot:hover {
    transform: translateX(-50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.slider-dot:active {
    cursor: grabbing;
    transform: translateX(-50%) scale(1.2);
}

.min-dot {
    left: 0%;
}

.max-dot {
    left: 100%;
}

.price-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.price-inputs input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    transition: border-color 0.2s ease;
}

.price-inputs input:focus {
    outline: none;
    border-color: var(--primaryColor);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.price-inputs span {
    color: #6b7280;
    font-size: 13px;
    font-weight: 500;
}

.price-display {
    text-align: center;
    padding: 8px;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.current-range {
    color: var(--primaryColor);;
    font-weight: 600;
    font-size: 14px;
}
.price-range {
    display: flex;
    gap: 8px;
    align-items: center;
}

.price-range input {
    flex: 1;
}

.price-range span {
    color: #6b7280;
    font-size: 12px;
}

/* Year range filter */
.year-range {
    display: flex;
    gap: 8px;
    align-items: center;
}

.year-range input {
    flex: 1;
}

/* Checkbox filters */
.checkbox-group {
    max-height: 150px;
    overflow-y: auto;
    padding-right: 5px;
}

.checkbox-group::-webkit-scrollbar {
    width: 4px;
}

.checkbox-group::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.checkbox-group::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.checkbox-group::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.checkbox-item {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
}

.checkbox-item input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
    margin-bottom: 0;
}

.checkbox-item label {
    margin-bottom: 0;
    font-weight: 400;
    cursor: pointer;
    flex: 1;
    font-size: 12px;
}

.filters-actions {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #f3f4f6;
}

.apply-filters-btn {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.apply-filters-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

/* Loading state */
.filters-loading {
    text-align: center;
    padding: 30px;
    color: #6b7280;
}

.filters-loading .spinner {
    width: 25px;
    height: 25px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

/* No filters state */
.no-filters {
    text-align: center;
    padding: 20px;
    color: #6b7280;
    font-style: italic;
    font-size: 13px;
}

/* Active filter indicators */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 15px;
}

.active-filter-tag {
    background: var(--primaryColor);;
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.active-filter-tag .remove-filter {
    cursor: pointer;
    font-weight: bold;
    margin-left: 4px;
}

.active-filter-tag .remove-filter:hover {
    color: #fbbf24;
}

/* Responsive adjustments */
@media (max-width: 1199px) {
   .listng-wrapper .grid-row#allTruckListings {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 1024px) {
    .listings-layout {
        flex-direction: column;
    }
    
    .listings-sidebar {
        width: 100%;
        order: -1; /* Show filters first on mobile */
    }
    
    .filters-section {
        position: static;
        margin-bottom: 30px;
    }
    
    .filters-grid {
        max-height: none;
        overflow-y: visible;
    }
}

@media (max-width: 768px) {
    .filters-section {
        padding: 20px;
    }
    
    .filters-grid {
        gap: 15px;
    }
    
    .filters-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .price-range,
    .year-range {
        flex-direction: column;
        gap: 8px;
    }
    
    .price-range span,
    .year-range span {
        align-self: center;
    }
}
@media (max-width: 599px) {
    .listng-wrapper .grid-row#allTruckListings {
        grid-template-columns: repeat(1, 1fr);
    }
}

@media (max-width: 480px) {
    .filters-section {
        padding: 15px;
    }
    
    .filters-actions {
        padding-top: 15px;
    }
    
    .apply-filters-btn {
        padding: 12px;
        font-size: 13px;
    }
}
