.cars-page-wrapper {
    display: flex;
    gap: 20px;
    width: 95%;
    margin: 20px auto;
    max-width: 1400px;
    min-height: calc(100vh - 120px);
    position: relative;
    transition: opacity 0.3s ease;
    align-items: flex-start;
}

.cars-page-wrapper.loading {
    opacity: 0.6;
    pointer-events: none;
}

.cars-page-wrapper.loading::after {
    content: "Loading...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, .8);
    color: #fff;
    padding: 15px 30px;
    border-radius: 30px;
    font-weight: bold;
    z-index: 100;
    backdrop-filter: blur(4px);
}

.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.ads-sidebar-placeholder {
    width: 300px;
    flex-shrink: 0;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    position: sticky;
    top: 100px;
    align-self: flex-start;
}

.filter-bar {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 70px;
    z-index: 90;
    transition: top .2s;
}

.filter-bar-main {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-end;
    width: 100%;
}

.filter-bar-advanced {
    display: none;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-end;
    width: 100%;
    padding-top: 15px;
    margin-top: 15px;
    border-top: 1px dashed #e0e0e0;
}

.filter-bar-advanced.show {
    display: flex;
    animation: fadeInDown 0.3s ease;
}

.toggle-advanced-btn {
    height: 42px;
    padding: 0 15px;
    background: #fff;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
    margin-left: auto;
}

.toggle-advanced-btn:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.toggle-advanced-btn.active {
    background: #FFF5F5;
    color: #C62828;
    border-color: #C62828;
}

.toggle-advanced-btn svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s;
}

.toggle-advanced-btn.active svg {
    transform: rotate(180deg);
}

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

.filter-group {
    flex: 1;
    min-width: 110px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
}

.filter-wrapper {
    position: relative;
    width: 100%;
}

.filter-label {
    font-size: 13px;
    font-weight: 700;
    color: #333;
    white-space: nowrap;
}

input#searchInput.filter-select {
    background-image: none;
    padding-right: 15px; 
}

.filter-select {
    width: 100%;
    padding: 10px 30px 10px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    color: #333;
    background-color: #fff;
    outline: none;
    height: 42px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23333%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 10px top 50%;
    background-size: 10px auto;
}

.clear-single-filter {
    position: absolute;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    color: #999;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10;
    display: none;
    border-radius: 50%;
    background: transparent;
    transition: color .2s;
}

.clear-single-filter:hover {
    color: #C62828;
    background: #FFF5F5;
}

.clear-single-filter.visible {
    display: block;
}

.clear-filter-btn {
    height: 42px;
    width: 42px;
    padding: 0;
    background: #fff;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all .2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear-filter-btn:hover {
    border-color: #C62828;
    color: #C62828;
    background: #FFF5F5;
}

.custom-dropdown-container {
    position: relative;
    width: 100%;
}

.custom-dropdown-trigger {
    width: 100%;
    padding: 5px 35px 5px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    color: #333;
    background-color: #fff;
    cursor: pointer;
    height: 42px;
    display: flex;
    align-items: center;
    position: relative;
}

.custom-dropdown-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
}

.option-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
    margin-right: 8px;
    flex-shrink: 0;
}

.custom-dropdown-trigger:after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #333;
}

.custom-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, .1);
    z-index: 1000;
    margin-top: 5px;
    display: none;
    overflow: hidden;
}

.custom-dropdown-menu.open {
    display: block;
}

.dropdown-search-wrapper {
    padding: 10px;
    background: #f9f9f9;
    border-bottom: 1px solid #eee;
}

.dropdown-search-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    outline: none;
}

.dropdown-options-list {
    max-height: 250px;
    overflow-y: auto;
}

.dropdown-option {
    padding: 8px 12px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    min-height: 40px;
}

.dropdown-option:hover {
    background-color: #f5f5f5;
}

.dropdown-option.selected {
    background-color: #FFF5F5;
    color: #C62828;
    font-weight: 600;
}

.dropdown-option.hidden {
    display: none;
}

select[data-customized="true"] {
    display: none !important;
}

.cars-list-container {
    background: white;
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .05);
    flex-grow: 1;
    position: relative;
    z-index: 1;
}

.car-list-item-wrapper {
    position: relative;
}

.car-list-item {
    display: flex;
    align-items: center;
    gap: 25px;
    padding: 25px;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
    transition: background .2s;
}

.car-list-item:hover {
    background: #fafafa;
}

.car-link-area {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 25px;
    flex: 1;
}

.car-rank {
    font-size: 32px;
    font-weight: 900;
    color: #C62828;
    font-style: italic;
    min-width: 50px;
    text-align: center;
}

.car-image {
    width: 200px;
    height: 120px;
    object-fit: contain;
    background: #fff;
}

.car-info {
    flex: 1;
}

.car-title {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 8px;
    color: #000;
    line-height: 1.4;
}

.car-subtitle {
    color: #666;
    font-size: 13px;
    margin-top: 5px;
}

.car-price-from {
    color: #C62828;
    font-size: 15px;
    font-weight: 700;
    margin-top: 6px;
}

.car-variants-count {
    color: #888;
    font-size: 12px;
    margin-top: 3px;
}

.car-actions-group {
    display: flex;
    flex-direction: row;
    gap: 15px;
    align-items: center;
    justify-content: flex-end;
    margin-left: 20px;
    flex-shrink: 0;
}

.car-action-compare {
    padding: 8px 20px;
    border: 1px solid #C62828;
    border-radius: 6px;
    color: #C62828;
    font-size: 14px;
    font-weight: 600;
    background: white;
    cursor: pointer;
    white-space: nowrap;
    display: inline-block;
    text-align: center;
    transition: all .2s;
    min-width: 100px;
}

.car-action-compare:hover {
    background: #FFF5F5;
}

.car-action-compare.in-cart {
    background: #e53935 !important;
    color: #fff !important;
    border-color: #e53935 !important;
}

.car-action {
    padding: 8px 20px;
    border: 1px solid #C62828;
    border-radius: 6px;
    color: #C62828;
    font-size: 14px;
    font-weight: 600;
    background: #fff;
    text-decoration: none;
    white-space: nowrap;
    display: inline-block;
    text-align: center;
    transition: all .2s;
    min-width: 100px;
}

.car-action:hover {
    background: #C62828;
    border-color: #B71C1C;
    color: white;
}

.car-hot-badge {
    position: absolute;
    top: 15px;
    right: 20px;
    background: #FFF0F0;
    color: #C62828;
    font-size: 16px;
    font-weight: 800;
    padding: 6px 16px;
    border-radius: 30px;
    border: 1px solid #FFCDD2;
    pointer-events: none;
    z-index: 2;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.loading-indicator {
    text-align: center;
    padding: 20px;
    color: #C62828;
    display: none;
}

.loading-indicator.active {
    display: block;
}

.compare-panel {
    position: fixed;
    right: 30px;
    bottom: 110px;
    top: auto;
    transform: none;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.compare-tab {
    background: #e53935;
    color: #fff;
    padding: 0;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(229, 57, 53, 0.4);
    transition: all .2s;
    position: relative;
    flex-shrink: 0;
}

.compare-tab:hover {
    background: #c62828;
    transform: scale(1.05);
}

.compare-tab .tab-icon {
    font-size: 15px;
    line-height: 1;
    transition: transform .3s;
}

.compare-tab .tab-label {
    display: none;
}

.compare-tab .tab-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #fff;
    color: #e53935;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 12px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.compare-tab .tab-count.hidden {
    display: none;
}

@keyframes cartPulse {
    0% { transform: scale(1); }
    40% { transform: scale(1.45); }
    100% { transform: scale(1); }
}

.compare-tab .tab-count.pulse {
    animation: cartPulse .35s ease;
}

.compare-drawer {
    width: 280px;
    background: #ffffff;
    color: #333333;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .15);
    border-radius: 16px;
    transition: all .32s cubic-bezier(.4, 0, .2, 1);
    display: flex;
    flex-direction: column;
    position: absolute;
    bottom: 75px;
    right: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
}

.compare-panel.open .compare-drawer {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.compare-drawer-inner {
    width: 100%;
    padding: 18px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-sizing: border-box;
}

.compare-drawer-title {
    font-size: 12px;
    font-weight: 700;
    color: #333333;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, .08);
    white-space: nowrap;
}

.compare-slot {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, .03);
    border: 1.5px dashed rgba(0, 0, 0, .15);
    border-radius: 8px;
    padding: 8px 10px;
    min-height: 58px;
    transition: border-color .2s, background .2s;
}

.compare-slot.filled {
    border-color: #e53935;
    background: rgba(229, 57, 53, .12);
}

.compare-slot img {
    width: 56px;
    height: 38px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.compare-slot .slot-info {
    flex: 1;
    min-width: 0;
}

.compare-slot .slot-title {
    font-size: 11px;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    color: #333333;
}

.compare-slot .slot-empty {
    font-size: 12px;
    color: rgba(0, 0, 0, .4);
}

.compare-slot .slot-remove {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    background: rgba(229, 57, 53, .7);
    border-radius: 50%;
    border: none;
    color: #fff;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
}

.compare-slot .slot-remove:hover {
    background: #b71c1c;
}

.compare-drawer-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, .08);
}

.compare-count-badge {
    font-size: 11px;
    color: rgba(0, 0, 0, .5);
    text-align: center;
}

.btn-compare-now {
    background: #e53935;
    color: #fff;
    border: none;
    padding: 11px;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s;
    width: 100%;
}

.btn-compare-now:hover {
    background: #c62828;
}

.btn-compare-now:disabled {
    background: #f5f5f5;
    color: rgba(0, 0, 0, .3);
    cursor: not-allowed;
}

.btn-compare-clear {
    background: transparent;
    color: rgba(0, 0, 0, .5);
    border: 1px solid rgba(0, 0, 0, .15);
    padding: 8px;
    border-radius: 7px;
    font-size: 13px;
    cursor: pointer;
    transition: color .2s, border-color .2s;
    width: 100%;
}

.btn-compare-clear:hover {
    color: #000;
    border-color: rgba(0, 0, 0, .4);
}

.compare-toast {
    position: fixed;
    bottom: 50px;
    right: 100px;
    background: #1a1a2e;
    color: #fff;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.4;
    opacity: 0;
    transform: translateX(10px);
    transition: opacity .3s, transform .3s;
    z-index: 10000;
    pointer-events: none;
    max-width: 240px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .3);
    border-left: 3px solid #e53935;
}

.compare-toast.show {
    opacity: 1;
    transform: translateX(0);
}

@media (max-width: 768px) {
    .car-list-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .car-link-area {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
    }

    .car-actions-group {
        width: 100%;
        margin-left: 0;
        margin-top: 15px;
        justify-content: space-between;
    }

    .car-action,
    .car-action-compare {
        flex: 1;
    }

    .car-image {
        width: 100%;
        height: auto;
    }

    .compare-panel {
        right: 20px;
        bottom: 20px;
    }

    .compare-drawer {
        width: 240px;
        bottom: 70px;
    }

    .compare-drawer-inner {
        width: 100%;
    }

    .compare-toast {
        bottom: 100px;
        right: 20px;
    }
}