
/* ========== VARIABLES ========== */
:root {
    --primary-blue: #1a5f7a;
    --primary-blue-dark: #134b61;
    --accent-orange: #f39c12;
    --accent-yellow: #f1c40f;
    --promo-red: #c0392b;
    --light-gray: #f8f9fa;
    --border-gray: #e9ecef;
    --text-dark: #2c3e50;
    --text-muted: #6c757d;
    --transition-speed: 0.3s;
    --header-container-width: 1400px;
}


/* ========== GARAGE SEARCH SECTION ========== */
.garage-search-section {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    padding: 1.5rem 0;
    position: relative;
}

.garage-search-form {
    display: flex;
    align-items: stretch;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Force single row on desktop */
@media (min-width: 992px) {
    .garage-search-form {
        flex-wrap: nowrap;
    }
}

.garage-search-form .form-select,
.garage-search-form .form-control {
    border: none;
    border-radius: 4px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    min-width: 0 !important;
}

.garage-search-form .form-select:focus,
.garage-search-form .form-control:focus {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
    border-color: transparent;
}

.garage-search-btn {
    background-color: #056CC1;
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 4px;
    font-weight: 600;
    transition: all var(--transition-speed) ease;
    white-space: nowrap;
}

.garage-search-btn:hover {
    background-color: #0455a3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(5, 108, 193, 0.3);
}

.vin-search-divider {
    display: flex;
    align-items: center;
    color: white;
    font-weight: 700;
    padding: 0 0.5rem;
}

.reset-link {
    color: white;
    text-decoration: underline;
    font-size: 0.85rem;
    margin-left: auto;
    transition: opacity var(--transition-speed) ease;
}

.reset-link:hover {
    opacity: 0.8;
    color: white;
}

/* ========== SIDEBAR STYLES ========== */
.sidebar {
    /*background-color: #f8f9fa;*/
    border-radius: 8px;
    overflow: hidden;
}

.sidebar-header {
    background-color: #e9ecef;
    padding: 1rem 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
    border-bottom: 1px solid var(--border-gray);
}

.category-accordion .accordion-item {
    border: none;
    border-bottom: 1px solid var(--border-gray);
}

.category-accordion .accordion-button {
    background-color: transparent;
    padding: 1rem 1.25rem;
    font-weight: 500;
    color: var(--text-dark);
    box-shadow: none;
}

.category-accordion .accordion-button:not(.collapsed) {
    background-color: white;
    color: var(--accent-orange);
}

.category-accordion .accordion-button::after {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='%232c3e50' d='M5.5 9.5l3 3 3-3'/%3e%3c/svg%3e");
    background-size: 1.25rem;
}

.category-accordion .accordion-button:not(.collapsed)::after {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='%23f39c12' d='M5.5 5.5l3 3 3-3'/%3e%3c/svg%3e");
}

.category-accordion .accordion-body {
    padding: 0 1.25rem 1rem;
    background-color: white;
}

.category-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
    margin-right: 0.75rem;
}

.subcategory-link {
    display: block;
    padding: 0.5rem 0;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color var(--transition-speed) ease;
}

.subcategory-link:hover {
    color: var(--accent-orange);
}

/* ========== FILTER WIDGETS STYLES ========== */
.filter-widget {
    background-color: white;
    /*border: 1px solid #e0e0e0;*/
    border-radius: 6px;
    margin-bottom: 1rem;
    overflow: hidden;
    /*box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);*/
}

.filter-widget:last-child {
    margin-bottom: 0;
}

.filter-header {
    background-color: #ebebeb;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
}

.filter-title {
    font-weight: 700;
    color: #333;
    font-size: 0.9rem;
    margin: 0;
}

.filter-clear {
    font-size: 0.8rem;
    color: #333;
    text-decoration: underline;
    cursor: pointer;
    transition: color var(--transition-speed) ease;
}

.filter-clear:hover {
    color: #056CC1;
}

.filter-body {
    padding: 1rem;
}

/* Price Filter Styles */
.price-filter .price-inputs {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.price-input-wrapper {
    flex: 1;
    position: relative;
}

.price-input-wrapper label {
    display: block;
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.price-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.price-input:focus {
    outline: none;
    border-color: #056CC1;
}

.price-range-slider {
    margin-bottom: 1rem;
}

.slider-track {
    position: relative;
    height: 6px;
    background-color: #004B8D;
    border-radius: 3px;
}

.slider-handle {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 18px;
    height: 18px;
    background-color: #004B8D;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-filter {
    width: 100%;
    padding: 0.75rem;
    background-color: #004987;
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color var(--transition-speed) ease;
}

.btn-filter:hover {
    background-color: #003d6e;
}

/* Brand Filter Styles */
.filter-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.filter-item:last-child {
    border-bottom: none;
}

.filter-checkbox {
    width: 18px;
    height: 18px;
    margin-right: 0.75rem;
    cursor: pointer;
    accent-color: #004B8D;
}

.filter-checkbox:checked {
    accent-color: #004B8D;
}

.brand-logo {
    width: 40px;
    height: 24px;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    background-color: #f8f8f8;
    font-size: 0.65rem;
    font-weight: 700;
    color: #333;
}

.brand-name {
    flex: 1;
    font-weight: 700;
    color: #333;
    font-size: 0.9rem;
}

.item-count {
    color: #999;
    font-size: 0.85rem;
}

/* Condition Filter Styles */
.condition-text {
    flex: 1;
    font-weight: 700;
    color: #333;
    font-size: 0.9rem;
    text-transform: capitalize;
}

/* Responsive adjustments for filter widgets */
@media (max-width: 991px) {
    .filter-widget {
        margin-bottom: 0.75rem;
    }
}

@media (max-width: 575px) {
    .filter-header {
        padding: 0.6rem 0.75rem;
    }

    .filter-title {
        font-size: 0.85rem;
    }

    .filter-body {
        padding: 0.75rem;
    }

    .price-filter .price-inputs {
        gap: 0.5rem;
    }
}

/* ========== TOOLBAR STYLES ========== */
.toolbar {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    /*display: flex;*/
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.view-toggle .btn {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-gray);
    background-color: white;
    color: var(--text-muted);
}

.view-toggle .btn.active {
    background-color: var(--accent-orange);
    border-color: var(--accent-orange);
    color: white;
}

.sort-select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-gray);
    border-radius: 4px;
    font-size: 0.9rem;
    background-color: white;
}

.results-count {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ========== PRODUCT CARD STYLES ========== */
.product-card {
    background-color: white;
    border: 1px solid var(--border-gray);
    border-radius: 8px;
    overflow: hidden;
    transition: all var(--transition-speed) ease;
    height: 100%;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-color: var(--accent-orange);
}

.product-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: var(--accent-orange);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 10;
}

.product-image-container {
    position: relative;
    padding: 1.5rem;
    text-align: center;
    background-color: #f8f9fa;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image {
    max-width: 100%;
    max-height: 150px;
    object-fit: contain;
}

.product-info {
    padding: 1.25rem;
}

.product-category {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.product-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--promo-red);
    margin-bottom: 1rem;
}

.product-price .old-price {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-decoration: line-through;
    margin-left: 0.5rem;
    font-weight: 400;
}

.btn-add-cart {
    width: 100%;
    padding: 0.75rem;
    background-color: transparent;
    border: 2px solid #056CC1;
    color: #056CC1;
    font-weight: 600;
    border-radius: 4px;
    transition: all var(--transition-speed) ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-add-cart:hover {
    background-color: #056CC1;
    color: white;
}

/* ========== ORDENAMIENTO (SELECTS) ========== */
#ordenarPor {
    font-size: 0.9rem;
}

.select-icon-wrapper {
    position: relative;
}

.select-icon-wrapper svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    width: 16px;
    height: 16px;
    color: #6c757d;
}

.select-icon-wrapper select {
    padding-left: 34px;
}

/* ========== FILTER TAGS ========== */
.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.filter-tag {
    background-color: #f8f9fa;
    border: 1px solid var(--border-gray);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all var(--transition-speed) ease;
}

.filter-tag:hover {
    background-color: #e9ecef;
}

.filter-tag .remove-tag {
    cursor: pointer;
    color: var(--text-muted);
    transition: color var(--transition-speed) ease;
}

.filter-tag .remove-tag:hover {
    color: var(--promo-red);
}

/* ========== FLOATING WIDGETS ========== */
.floating-widgets {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 100;
}

.floating-widget {
    width: 50px;
    height: 50px;
    background-color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    color: var(--text-dark);
    text-decoration: none;
}

.floating-widget:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.floating-widget.cart-widget {
    background-color: #8BC34A;
    color: white;
}

.chat-widget {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background-color: #056CC1;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px rgba(5, 108, 193, 0.3);
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    z-index: 100;
    text-decoration: none;
}

.chat-widget:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(5, 108, 193, 0.4);
    color: white;
}

.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    background-color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    color: var(--text-dark);
    border: none;
    z-index: 100;
}

.back-to-top:hover {
    background-color: var(--accent-orange);
    color: white;
}

/* ========== MOBILE FILTERS TOGGLE ========== */
.mobile-filters-toggle {
    display: none;
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: #e9ecef;
    color: #333;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    margin-bottom: 1rem;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all var(--transition-speed) ease;
}

.mobile-filters-toggle:hover {
    background-color: #dee2e6;
    color: #333;
}

.mobile-filters-toggle[aria-expanded="true"] {
    background-color: #056CC1;
    color: white;
    border-color: #056CC1;
}

/* MANUAL COLLAPSE CSS - No dependemos de Bootstrap */
#asideFiltersCollapse {
    display: none;
}

#asideFiltersCollapse.show {
    display: block;
}

/* En escritorio, siempre visible */
@media (min-width: 992px) {
    #asideFiltersCollapse {
        display: block !important;
    }
}

/* Hamburger menu icon animation */
.mobile-filters-toggle[aria-expanded="true"] .hamburger-icon::before {
    transform: rotate(45deg);
    top: 0;
}

.mobile-filters-toggle[aria-expanded="true"] .hamburger-icon::after {
    transform: rotate(-45deg);
    bottom: 0;
}

.mobile-filters-toggle[aria-expanded="true"] .hamburger-icon {
    background-color: transparent;
}

.hamburger-icon {
    position: relative;
    width: 20px;
    height: 2px;
    background-color: currentColor;
    transition: all 0.3s ease;
}

.hamburger-icon::before,
.hamburger-icon::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: currentColor;
    transition: all 0.3s ease;
}

.hamburger-icon::before {
    top: -6px;
}

.hamburger-icon::after {
    bottom: -6px;
}

/* ========== RESPONSIVE STYLES ========== */
@media (max-width: 991px) {
    .mobile-filters-toggle {
        display: flex;
    }
}

@media (max-width: 1399px) {

    .garage-search-form .form-select,
    .garage-search-form .form-control {
        font-size: 0.85rem;
    }
}

@media (max-width: 1199px) {
    .garage-search-form {
        gap: 0.75rem;
    }
}

@media (max-width: 991px) {
    .garage-search-section {
        padding: 1.25rem 0;
    }

    .garage-search-form {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .garage-search-form .form-select,
    .garage-search-form .form-control {
        flex: 1 1 calc(33.333% - 0.75rem);
        min-width: 140px;
        padding: 0.65rem 0.75rem;
    }

    .garage-search-form .garage-search-btn {
        flex: 1 1 calc(33.333% - 0.75rem);
        min-width: 140px;
    }

    .vin-search-divider {
        display: none;
    }

    .reset-link {
        margin-left: auto;
    }

    .sidebar {
        margin-bottom: 1.5rem;
    }

    .floating-widgets {
        display: none;
    }

    .chat-widget {
        left: 15px;
        bottom: 15px;
    }

    .back-to-top {
        right: 15px;
        bottom: 15px;
    }
}

@media (max-width: 767px) {
    .garage-search-form {
        flex-direction: column;
    }

    .garage-search-form .form-select,
    .garage-search-form .form-control,
    .garage-search-form .garage-search-btn {
        flex: 1 1 100%;
        width: 100%;
    }

    .toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .results-count {
        order: -1;
        width: 100%;
    }

    .product-image-container {
        min-height: 160px;
        padding: 1rem;
    }

    .product-info {
        padding: 1rem;
    }

    .product-price {
        font-size: 1.1rem;
    }
}

@media (max-width: 575px) {

    .garage-search-form .form-select,
    .garage-search-form .form-control {
        flex: 1 1 100%;
        min-width: 100%;
    }

    .filter-tags {
        gap: 0.25rem;
    }

    .filter-tag {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }

    .chat-widget {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
}

/* ========== SMOOTH TRANSITIONS ========== */
a,
button,
.btn,
.nav-link,
.accordion-button,
.product-card {
    transition: all var(--transition-speed) ease;
}

/* ========== LOADING OVERLAY ========== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #f39c12;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.loading-text {
    font-size: 1rem;
    color: #333;
    font-weight: 500;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ========== DISABLED STATE FOR INPUTS DURING LOAD ========== */
body.loading-active .form-select,
body.loading-active .form-control,
body.loading-active .filter-checkbox,
body.loading-active .btn-filter,
body.loading-active .mobile-filters-toggle {
    pointer-events: none;
    opacity: 0.6;
}

/* ========== SIDEBAR CHEVRON ANIMATION ========== */

.sidebar-chevron {
    transition: transform 0.2s ease;
}

.sidebar-header[aria-expanded="true"] .sidebar-chevron {
    transform: rotate(-180deg);
}