/* Modern Filter Card Styles */
.modern-filter-card {
    border: none;
    border-radius: 15px;
    overflow: hidden;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

/* Filter Tabs Navigation */
.filter-tabs {
    display: flex;
    background: transparent;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.filter-tab {
    flex: 1;
    padding: 1rem;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.filter-tab:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.filter-tab.active {
    color: #fff;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
}

.filter-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #25D366;
}

/* Tab Content */
.filter-tab-content {
    background: white;
    min-height: auto;
    position: relative;
}

.tab-pane {
    display: none;
    opacity: 0;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 1.5rem 1.5rem 1rem 1.5rem;
}

.tab-pane.active {
    display: block;
    opacity: 1;
    position: relative;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Adjust padding for mobile */
@media (max-width: 768px) {
    .filter-tab-content {
        min-height: auto;
    }

    .tab-pane {
        padding: 1rem 1rem 0.75rem 1rem;
    }
}

/* Filter Icon Container */
.filter-icon-container {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3);
}

.filter-icon-container i {
    font-size: 2.5rem;
    color: white;
}

/* Form Labels */
.filter-tab-content .form-label {
    color: #2c3e50;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

/* Search Button */
.btn-search-turbo {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    border: none;
    color: white;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3);
    transition: all 0.3s ease;
}

.btn-search-turbo:hover {
    background: linear-gradient(135deg, #128C7E 0%, #0da354 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
}

.btn-search-turbo:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(37, 211, 102, 0.3);
}

/* Reset Button */
.btn-reset-filters {
    background: white;
    border: 2px solid #e9ecef;
    color: #6c757d;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.btn-reset-filters:hover {
    background: #f8f9fa;
    border-color: #dee2e6;
    color: #495057;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Form Controls */
.filter-tab-content .form-control,
.filter-tab-content .form-select {
    border-radius: 8px;
    border: 2px solid #e9ecef;
    padding: 0.75rem;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.filter-tab-content .form-control:focus,
.filter-tab-content .form-select:focus {
    border-color: #25D366;
    box-shadow: 0 0 0 0.25rem rgba(37, 211, 102, 0.25);
}

/* Responsive Design */
@media (max-width: 992px) {
    .filter-tab {
        font-size: 0.75rem;
        padding: 0.75rem 0.5rem;
    }

    .filter-icon-container {
        width: 60px;
        height: 60px;
    }

    .filter-icon-container i {
        font-size: 2rem;
    }
}

@media (max-width: 576px) {
    .filter-tabs {
        flex-direction: column;
    }

    .filter-tab {
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .filter-tab:last-child {
        border-bottom: none;
    }

    .filter-tab.active::after {
        display: none;
    }
}

/* Filter container styles */
.filter-container {
    overflow: hidden !important;
    position: relative;
}

/* Select2 container constraints */
.filter-container .select2-container {
    width: 100% !important;
    max-width: 100%;
}

/* Dropdown width constraint */
.filter-container .select2-container .select2-dropdown {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    left: 0 !important;
    right: 0 !important;
}

/* Fix dropdown rendering */
.select2-container--bootstrap-5 .select2-dropdown {
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    margin-top: 0;
    max-width: 100% !important;
    width: 100% !important;
}

/* Select2 Clear Button Fix */
.select2-selection__clear {
    margin-right: 10px;
    cursor: pointer !important;
    color: #999;
    font-weight: bold;
    font-size: 18px;
    z-index: 100;
}

.select2-selection__clear:hover {
    color: #333;
}

/* Grid/List View Styles */
.product-card {
    transition: transform 0.2s, box-shadow 0.2s;
    border: none;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.1) !important;
}

.product-image-container {
    position: relative;
    overflow: hidden;
    background: #f8f9fa;
    min-height: 200px;
}

.display-5 {
    color: #2c3e50;
    font-weight: 600;
}

/* Optional shadow for the card containing the H1 */
.card.bg-light {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: none;
}

.product-img {
    transition: transform 0.3s ease;
}

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

.product-title {
    font-weight: 600;
    line-height: 1.3;
    color: #2c3e50;
    font-size: 1.25rem;
}

.price-container {
    line-height: 1.2;
}

.badge {
    font-weight: 500;
    padding: 0.5em 0.75em;
    font-size: 0.85rem;
}

.btn {
    padding: 0.6rem 1.2rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary {
    background-color: #2c3e50;
    border-color: #2c3e50;
}

.btn-primary:hover {
    background-color: #34495e;
    border-color: #34495e;
    transform: translateY(-1px);
}

.btn-outline-primary {
    color: #2c3e50;
    border-color: #2c3e50;
}

.btn-outline-primary:hover {
    background-color: #2c3e50;
    border-color: #2c3e50;
    transform: translateY(-1px);
}

/* Grid view styles */
#products-grid.grid-view .product-item {
    width: 33.333%;
    padding: 12px;
}

#products-grid.grid-view .product-card .row {
    flex-direction: column;
}

#products-grid.grid-view .product-image-container {
    height: 200px;
}

#products-grid.grid-view .col-lg-3,
#products-grid.grid-view .col-lg-6 {
    width: 100%;
    max-width: 100%;
}

#products-grid.grid-view .border-start {
    border: none !important;
}

/* List view styles */
#products-grid.list-view .product-item {
    width: 100%;
    margin-bottom: 1rem;
}

#products-grid.list-view .product-card {
    margin-bottom: 1rem;
}

#products-grid.list-view .product-image-container {
    height: 100%;
    min-height: 200px;
    border-top-right-radius: 0;
    border-bottom-left-radius: calc(0.25rem - 1px);
}

#products-grid.list-view .card-body {
    padding: 1.5rem;
}

#products-grid.list-view .border-start {
    border-left: 1px solid rgba(0, 0, 0, .125) !important;
}

@media (max-width: 992px) {
    #products-grid.grid-view .product-item {
        width: 50%;
    }

    #products-grid.list-view .row {
        flex-direction: column;
    }

    #products-grid.list-view .border-start {
        border-left: none !important;
        border-top: 1px solid rgba(0, 0, 0, .125) !important;
    }

    #products-grid.list-view .product-image-container {
        height: 200px;
    }

    #products-grid.list-view .card-body {
        padding: 1rem;
    }
}

@media (max-width: 576px) {
    #products-grid.grid-view .product-item {
        width: 100%;
    }
}

/* Engine code dropdown styling */
#engine_code + .select2-container .select2-results__option {
    padding: 8px 12px;
}

.engine-option {
    padding: 5px 0;
}

.engine-name {
    font-weight: bold;
    font-size: 0.95rem;
}

.engine-power {
    font-size: 0.85rem;
    color: #555;
}

/* Make dropdown wider for engine code */
#engine_code + .select2-container {
    max-width: 100%;
}

#engine_code + .select2-container .select2-dropdown {
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border-color: rgba(70, 130, 180, 0.5);
}

/* Style for the dropdown items with highlighted background */
.select2-container--bootstrap-5 .select2-results__option--highlighted {
    color: #000000;
    background-color: #4682B4;
}

/* Style for the active/selected item */
.select2-container--bootstrap-5 .select2-results__option[aria-selected=true] {
    background-color: #4682B4;
    color: #000000;
}

/* Fix for the container to match width of parent */
.select2-container {
    width: 100% !important;
}

/* Ensure the dropdown appears directly below the input without any offset */
.select2-container--bootstrap-5 .select2-dropdown {
    margin-top: 0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

/* Car model dropdown specific styles */
#car_model + .select2-container .select2-dropdown {
    width: 100% !important;
    min-width: 100%;
    max-width: 100%;
    border-color: rgba(70, 130, 180, 0.5);
    box-shadow: 0 0 0 0.25rem rgba(70, 130, 180, 0.25);
}

/* Style for the selected item in the dropdown */
#car_model + .select2-container .select2-results__option--selected,
#car_model + .select2-container .select2-results__option[aria-selected=true] {
    background-color: #4682B4;
    color: #000000;
}

/* Style for the highlighted/hovered item */
#car_model + .select2-container .select2-results__option--highlighted[aria-selected] {
    background-color: rgba(70, 130, 180, 0.1);
    color: #212529;
}

/* Engine code specific styles for highlighted and selected items */
#engine_code + .select2-container .select2-results__option--highlighted[aria-selected] {
    background-color: rgba(70, 130, 180, 0.1);
    color: #212529;
}

#engine_code + .select2-container .select2-results__option[aria-selected=true] {
    background-color: #4682B4;
    color: #000000;
}

/* Add better styling for the model and power info in dropdowns */
.model-info {
    font-weight: bold;
    font-size: 14px;
    color: #212529;
}

.power-info, .code-info {
    font-size: 13px;
    color: #666;
}

/* Additional styling for selected items in dropdown */
.select2-results__option[aria-selected=true] .model-info,
.select2-results__option[aria-selected=true] .power-info,
.select2-results__option[aria-selected=true] .code-info {
    color: #000000;
}

/* Select2 focus state styling */
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: rgba(70, 130, 180, 0.5);
    box-shadow: 0 0 0 0.25rem rgba(70, 130, 180, 0.25);
}

/* Style for selected item in dropdown */
#engine_code + .select2-container .select2-selection--single .select2-selection__rendered {
    padding-top: 5px;
    padding-bottom: 5px;
    line-height: 1.3;
}

/* Remove background colors from labels */
.form-label {
    background-color: transparent;
    color: #212529;
    padding: 0;
    margin-bottom: 0.5rem;
    border-radius: 0;
    font-weight: normal;
}

/* Ensure dropdown text doesn't exceed the width */
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0.375rem 0.75rem;
    line-height: 1.5;
}

/* Ensure the selected option text is properly truncated */
.select2-container--bootstrap-5 .select2-selection {
    overflow: hidden;
}

/* Make the dropdown properly sized */
.select2-dropdown {
    width: auto !important;
    min-width: 100%;
}

/* Style for dropdown text */
.engine-option {
    padding: 5px 0;
    white-space: normal;
    max-width: 100%;
}

/* Fix for engine code dropdown width and styling */
.select2-container--bootstrap-5 .select2-dropdown {
    width: 100% !important;
    min-width: 100%;
    max-width: 100%;
    border-color: rgba(70, 130, 180, 0.5);
    box-shadow: 0 0 0 0.25rem rgba(70, 130, 180, 0.25);
}

/* Style for the dropdown items with highlighted background */
.select2-container--bootstrap-5 .select2-results__option--highlighted {
    color: #000000;
    background-color: #4682B4;
}

/* Style for the active/selected item */
.select2-container--bootstrap-5 .select2-results__option[aria-selected=true] {
    background-color: #4682B4;
    color: #000000;
}

/* Fix for the container to match width of parent */
.select2-container {
    width: 100% !important;
}

/* Ensure the dropdown appears directly below the input without any offset */
.select2-container--bootstrap-5 .select2-dropdown {
    margin-top: 0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

/* Car model dropdown specific styles */
#car_model + .select2-container .select2-dropdown {
    width: 100% !important;
    min-width: 100%;
    max-width: 100%;
    border-color: rgba(70, 130, 180, 0.5);
    box-shadow: 0 0 0 0.25rem rgba(70, 130, 180, 0.25);
}

/* Style for the selected item in the dropdown */
#car_model + .select2-container .select2-results__option--selected,
#car_model + .select2-container .select2-results__option[aria-selected=true] {
    background-color: #4682B4;
    color: #000000;
}

/* Style for the highlighted/hovered item */
#car_model + .select2-container .select2-results__option--highlighted[aria-selected] {
    background-color: rgba(70, 130, 180, 0.1);
    color: #212529;
}

/* Ensure dropdown appears correctly below input */
#car_model + .select2-container .select2-dropdown {
    margin-top: 0;
    border-top: none;
}

/* Style for the search box */
#car_model + .select2-container .select2-search--dropdown .select2-search__field {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 0.375rem 0.75rem;
    width: 100%;
}

/* Ensure all text elements in dropdown have proper color */
.select2-container--bootstrap-5 .select2-results__option--highlighted,
.select2-container--bootstrap-5 .select2-results__option--highlighted *,
.select2-container--bootstrap-5 .select2-results__option[aria-selected=true],
.select2-container--bootstrap-5 .select2-results__option[aria-selected=true] * {
    color: #000000 !important;
}
