/* ========== 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-form {
    display: block;
    align-items: stretch;
    gap: 1rem;
    flex-wrap: wrap;
}

.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;
}

.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;
}

/* ========== 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: 991px) {

    .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: 575px) {

    .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;
}

/* Prevenir interacción mientras carga inicialmente */
body.loading-active .categoria-link,
body.loading-active .fabricante-link,
body.loading-active .limpiar-filtros-link,
body.loading-active .badge-remove-link {
    pointer-events: none !important;
    opacity: 0.5 !important;
}

/* ========== TABLE STYLES ========== */
.table-container {
    background-color: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.table thead th {
    background-color: #056cc1;
    color: white;
    font-weight: 600;
    text-align: center;
    vertical-align: middle;
    padding: 1rem 0.75rem;
    white-space: nowrap;
}

.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: rgba(243, 156, 18, 0.1);
}

.table tbody td {
    vertical-align: middle;
    text-align: center;
    padding: 0.75rem;
}

.table tbody td:first-child {
    text-align: center;
}

/* Checkbox styles */
.product-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #f39c12;
}

/* Product name column - left align */
.table tbody td.product-name {
    text-align: left;
    max-width: 300px;
}

.table tbody td.product-name a {
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 500;
}

.table tbody td.product-name a:hover {
    color: #f39c12;
}

/* Description column - left align */
.table tbody td.product-description {
    text-align: left;
    max-width: 350px;
}

.table tbody td.product-description small {
    color: var(--text-muted);
}

/* Price styles */
.price-value {
    font-weight: 700;
    color: var(--promo-red);
    font-size: 1.1em;
}

.price-original {
    text-decoration: line-through;
    color: var(--text-muted);
    font-size: 0.9em;
    margin-left: 5px;
}

/* Stock badge */
.stock-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

.stock-badge.in-stock {
    background-color: #d4edda;
    color: #155724;
}

.stock-badge.low-stock {
    background-color: #fff3cd;
    color: #856404;
}

.stock-badge.out-of-stock {
    background-color: #f8d7da;
    color: #721c24;
}

/* Add selected button */
.btn-add-selected {
    background: linear-gradient(135deg, #056cc1 0%, #004987 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgb(74 121 195 / 30%);
}

.btn-add-selected:hover {
    background: linear-gradient(135deg, #056cc1 0%, #004987 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(74, 130, 195, 0.4);
    color: white;
}

.btn-add-selected:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Pagination styles */
.pagination-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.pagination-wrapper .page-link {
    color: var(--text-dark);
    border: 1px solid #dee2e6;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.pagination-wrapper .page-link:hover {
    background-color: #f39c12;
    color: white;
    border-color: #f39c12;
}

.pagination-wrapper .page-item.active .page-link {
    background-color: #1a5f7a;
    border-color: #1a5f7a;
    color: white;
}

.pagination-wrapper .page-item.disabled .page-link {
    color: #adb5bd;
    pointer-events: none;
}

.pagination-info {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 1rem;
}

/* Selected count badge */
.selected-count-badge {
    background-color: #f39c12;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

/* Out of stock row style */
table tbody tr.out-of-stock {
    background-color: #f8d7da !important;
    opacity: 0.7;
}

table tbody tr.out-of-stock:hover {
    background-color: #f5c6cb !important;
    opacity: 1;
}

/* Disabled checkbox style */
.product-checkbox:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Responsive adjustments for table */
@media (max-width: 1200px) {
    .table tbody td.product-name {
        max-width: 250px;
    }

    .table tbody td.product-description {
        max-width: 250px;
    }
}

@media (max-width: 992px) {
    .table tbody td.product-name {
        max-width: 200px;
    }

    .table tbody td.product-description {
        max-width: 200px;
    }
}

@media (max-width: 768px) {
    .table thead th {
        font-size: 0.85rem;
        padding: 0.75rem 0.5rem;
    }

    .table tbody td {
        font-size: 0.85rem;
        padding: 0.5rem;
    }

    .btn-add-selected {
        width: 100%;
        margin-top: 1rem;
    }

    /* Modal de selección styles */
    #selectionModal .modal-header {
        border-bottom: none;
    }
    
    #selectionModal .modal-footer {
        border-top: 1px solid #e9ecef;
    }
    
    #selectionModal .table th {
        font-weight: 600;
    }
    
    #selectionModal .table tbody tr:hover {
        background-color: rgba(243, 156, 18, 0.05);
    }
    
    #selectionModal .btn-remove-from-selection {
        transition: all 0.3s ease;
    }
    
    #selectionModal .btn-remove-from-selection:hover {
        background-color: #c0392b;
        border-color: #c0392b;
        transform: scale(1.1);
    }
    
    #selectionModal .modal-cantidad-input:focus {
        border-color: #f39c12;
        box-shadow: 0 0 0 0.2rem rgba(243, 156, 18, 0.25);
    }
    
    /* Responsive adjustments for modal */
    @media (max-width: 576px) {
        #selectionModal .table {
            font-size: 0.85rem;
        }
        
        #selectionModal .table th,
        #selectionModal .table td {
            padding: 0.5rem;
        }
        
        #selectionModal .modal-cantidad-input {
            width: 60px !important;
        }
    }
}

/* ========== SIDEBAR CHEVRON ANIMATION ========== */

.sidebar-chevron {
    transition: transform 0.2s ease;
}

.sidebar-header[aria-expanded="true"] .sidebar-chevron {
    transform: rotate(-180deg);
}