/* Breadcrumb Styles */
.breadcrumb-light {
    background: #242830;
    padding: 0.75rem 1.5rem;
    margin-top: -3rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.breadcrumb {
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    flex-wrap: nowrap; /* Prevent wrapping */
    white-space: nowrap; /* Prevent text wrapping */
    overflow-x: auto; /* Allow horizontal scrolling if needed */
    -ms-overflow-style: none; /* Hide scrollbar in IE and Edge */
    scrollbar-width: none; /* Hide scrollbar in Firefox */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.breadcrumb::-webkit-scrollbar {
    display: none;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    color: #adb5bd;
    font-size: 0.95rem;
    white-space: nowrap; /* Prevent text wrapping */
    flex-shrink: 0; /* Prevent items from shrinking */
}

.breadcrumb-item + .breadcrumb-item {
    padding-left: 1rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: '';
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    border-top: 2px solid #495057;
    border-right: 2px solid #495057;
    transform: rotate(45deg);
    margin-right: 1rem;
    margin-top: 1px;
}

.breadcrumb-item a {
    color: #adb5bd;
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
}

.breadcrumb-item a:hover {
    color: #0d6efd;
    background-color: rgba(13, 110, 253, 0.1);
}

.breadcrumb-item.active {
    color: #0d6efd;
    font-weight: 500;
    display: flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
}

.breadcrumb-item i {
    font-size: 0.9rem;
    margin-right: 0.4rem;
    opacity: 0.8;
    transition: all 0.3s ease;
}

.breadcrumb-item a:hover i {
    transform: translateX(2px);
    opacity: 1;
}

.breadcrumb-item.active i {
    color: #0d6efd;
    opacity: 1;
}

/* Responsive Breadcrumb Styles for Mobile Devices */
@media (max-width: 767.98px) {
    .breadcrumb-light {
        padding: 0.75rem 1rem;
        margin-top: -3rem;
        overflow-x: auto; /* Allow horizontal scrolling if needed */
    }

    .breadcrumb {
        flex-wrap: nowrap; /* Ensure no wrapping */
        width: max-content; /* Allow container to expand as needed */
        min-width: 100%; /* Ensure it takes at least full width */
    }

    .breadcrumb-item {
        font-size: 0.8rem; /* Reduced font size for mobile */
        flex-shrink: 0; /* Prevent items from shrinking */
    }

    .breadcrumb-item + .breadcrumb-item {
        padding-left: 0.6rem; /* Further reduced padding between items */
    }

    .breadcrumb-item + .breadcrumb-item::before {
        width: 0.4rem; /* Smaller arrow */
        height: 0.4rem;
        margin-right: 0.6rem;
    }

    .breadcrumb-item a {
        padding: 0.2rem 0.3rem; /* Smaller padding for links */
    }

    .breadcrumb-item.active {
        padding: 0.2rem 0.3rem; /* Smaller padding for active item */
    }

    .breadcrumb-item i {
        font-size: 0.8rem; /* Smaller icons */
        margin-right: 0.3rem;
    }
}

/* Extra Small Devices (phones under 576px) */
@media (max-width: 575.98px) {
    .breadcrumb-light {
        padding: 0.6rem 0.8rem;
        margin-top: -2.5rem;
        border-radius: 8px;
        overflow-x: auto; /* Allow horizontal scrolling if needed */
    }

    .breadcrumb {
        flex-wrap: nowrap; /* Ensure no wrapping */
        width: max-content; /* Allow container to expand as needed */
        min-width: 100%; /* Ensure it takes at least full width */
    }

    .breadcrumb-item {
        font-size: 0.7rem; /* Even smaller font size for very small screens */
        flex-shrink: 0; /* Prevent items from shrinking */
    }

    .breadcrumb-item + .breadcrumb-item {
        padding-left: 0.4rem; /* Further reduced padding between items */
    }

    .breadcrumb-item + .breadcrumb-item::before {
        width: 0.35rem; /* Even smaller arrow */
        height: 0.35rem;
        margin-right: 0.4rem;
        border-top: 1.5px solid #495057; /* Thinner border */
        border-right: 1.5px solid #495057;
    }

    .breadcrumb-item a {
        padding: 0.15rem 0.25rem; /* Smaller padding for links */
    }

    .breadcrumb-item.active {
        padding: 0.15rem 0.25rem; /* Smaller padding for active item */
    }

    .breadcrumb-item i {
        font-size: 0.7rem; /* Even smaller icons */
        margin-right: 0.2rem;
    }
}

/* My Pick Badge Styles */
.my-pick-badge {
    background-color: #fd5631;
    color: #ffffff;
    border-radius: 20px;
    padding: 0.4rem 0.75rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    letter-spacing: 0.3px;
    font-weight: 600;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    position: absolute;
    top: -10px; /* Original position for desktop */
    left: 10px;
    z-index: 50; /* Increased z-index to ensure it's above other elements */
    width: auto;
}

.my-pick-badge i {
    margin-right: 0.5rem;
    font-size: 0.9rem;
    color: #ffffff;
    opacity: 0.9;
}

@media (max-width: 767.98px) {
    .my-pick-badge {
        padding: 0.25rem 0.5rem; /* Reduced padding by ~15% */
        font-size: 0.64rem; /* Reduced font size by ~15% */
        top: 0; /* Position at the very top edge */
        left: 0; /* Position at the very left edge */
        border-radius: 0 0 8px 0; /* Only round the bottom-right corner */
    }

    .my-pick-badge i {
        font-size: 0.68rem; /* Reduced font size by ~15% */
        margin-right: 0.25rem; /* Reduced margin by ~15% */
    }

    .sticky-compare-card.is-sticky .my-pick-badge {
        top: 0; /* Position at the very top edge */
        left: 0; /* Position at the very left edge */
        border-radius: 0; /* No border radius for sticky state */
    }
}

/* Car Card Styles for Compare Page */
.col-md-3 {
    padding-top: 0.5rem; /* Reduced for better spacing with the badge */
}
@media (min-width: 768px) {
    .col-md-3 {
        padding-top: 1rem; /* Original padding for desktop */
    }
}
.car-card-compare {
    background: linear-gradient(145deg, #2a2837 0%, #1f1b2c 100%);
    border-radius: 15px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
    overflow: hidden;
    margin-bottom: 1.5rem; /* Add margin to separate cards on mobile */
    flex: 0 0 calc(33.333% - 8px); /* Default for large screens - 3 cards per row */
    max-width: calc(33.333% - 8px);
}

.car-card-compare:hover {
    transform: translateY(-5px);
}

.car-card-compare .card-img-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16/12;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
    background-color: #1f1b2c; /* Match card background to avoid black spaces */
}

.car-card-compare .card-img-top {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.4s ease;
}

.car-card-compare .card-img-wrapper:hover .card-img-top {
    transform: scale(1.05);
}

.car-card-compare .card-body {
    background-color: #282534;
    padding: 0.75rem;
    text-align: left;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.car-card-compare .car-year {
    color: #fd5631;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0;
    flex-shrink: 0; /* Prevent the year from shrinking */
    background-color: rgba(253, 86, 49, 0.1);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    margin-right: 0.35rem; /* Consistent spacing */
}

@media (min-width: 1200px) {
    .car-card-compare .car-year {
        font-size: 0.85rem;
    }
}

.car-card-compare .d-flex.align-items-center {
    flex-wrap: nowrap;
    gap: 0.25rem;
    width: 100%;
    overflow: hidden;
}

.car-card-compare .card-title {
    color: #fff;
    font-size: 0.8rem; /* Further reduced for 2 cards per row */
    font-weight: 500;
    margin-bottom: 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0; /* Required for text-overflow to work in a flex container */
}

@media (min-width: 576px) {
    .car-card-compare .card-title {
        font-size: 0.85rem;
    }
}

@media (min-width: 768px) {
    .car-card-compare .card-title {
        font-size: 0.9rem; /* For 3 cards per row */
    }
}

@media (min-width: 992px) {
    .car-card-compare .card-title {
        font-size: 0.85rem; /* Reduced for 4 cards per row */
    }
}

@media (min-width: 1200px) {
    .car-card-compare .card-title {
        font-size: 0.95rem; /* More space on extra large screens */
    }
}

.car-card-compare .car-specs {
    color: #fff;
    font-size: 0.65rem;
    font-weight: 300;
    margin-bottom: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

@media (min-width: 1200px) {
    .car-card-compare .car-specs {
        font-size: 0.7rem;
    }
}

.car-card-compare .car-price-container {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 0.1rem 0.25rem;
    position: relative;
}

.car-card-compare .car-price {
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    padding: 0.1rem 0.3rem;
    border-radius: 6px;
    width: fit-content;
    position: relative;
    overflow: hidden;
}

/* Add price tag styling like in userprofile.css */
.car-card-compare .car-price-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background-color: #fd5631;
    border-radius: 2px 0 0 2px;
}

@media (min-width: 1200px) {
    .car-card-compare .car-price {
        font-size: 1.1rem;
    }
}

.car-card-compare .features {
    padding: 0.15rem;
    border-radius: 8px;
    margin-top: 0.3rem;
    background-color: rgba(255, 255, 255, 0.03);
}

.car-card-compare .feature-box {
    display: flex;
    align-items: center;
    gap: 0.1rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.8rem;
    padding: 0.4rem;
    max-width: 90px; /* Reduced for 2 cards per row on mobile */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.car-card-compare .feature-box:hover {
    transform: translateY(-2px);
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
}

@media (min-width: 576px) {
    .car-card-compare .feature-box {
        max-width: 100px;
    }
}

@media (min-width: 768px) {
    .car-card-compare .feature-box {
        max-width: 110px; /* For 3 cards per row */
    }
}

@media (min-width: 992px) {
    .car-card-compare .feature-box {
        max-width: 90px; /* Reduced for 4 cards per row */
    }
}

@media (min-width: 1200px) {
    .car-card-compare .feature-box {
        max-width: 120px; /* More space on extra large screens */
    }
}

.car-card-compare .feature-icon {
    color: #fd5631;
    font-size: 0.95rem;
    margin-right: 0.1rem;
}

/* Special styling for wallet icon in price container */
.car-card-compare .car-price-container .feature-icon {
    margin-left: 0.3rem; /* Add some space after the red border */
}

.car-card-compare .feature-text {
    font-size: 0.75rem;
    font-weight: 400;
}

.car-card-compare .vertical-line {
    width: 1px;
    height: 20px;
    background-color: rgba(255, 255, 255, 0.2);
    margin: 0 0.25rem;
}

.car-card-compare .row.g-0 {
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.1rem;
    flex-wrap: nowrap;
    padding: 0.15rem 0;
}

/* Specific style for the sidebar card (the first card in the layout) */
.col-md-3 .car-card-compare {
    flex: 0 0 100%;
    max-width: 100%;
}

/* Sticky compare card container */
.sticky-compare-card {
    position: relative;
    z-index: 10;
    width: 100%;
    will-change: transform; /* Optimize for animations */
}

/* Mobile-specific adjustments - no sticky behavior */
@media (max-width: 767.98px) {
    /* Mobile-specific adjustments to reduce gap between breadcrumb and card */
    .breadcrumb-light {
        margin-bottom: 0;
    }

    .row.mt-2.g-3 {
        margin-top: 0 !important;
    }

    .col-12.col-md-3 {
        padding-top: 0;
    }

    .sticky-compare-card {
        margin-top: -15px; /* Negative margin on mobile to reduce gap */
        position: relative; /* Ensure normal positioning */
    }

    /* Keep the class for styling purposes but remove sticky positioning */
    .sticky-compare-card.is-sticky {
        position: relative; /* Normal flow positioning instead of fixed */
        background-color: transparent;
        padding: 0;
        border-radius: 0;
        transition: none;
        box-shadow: none;
        width: 100%;
        max-width: 100%;
    }

    /* Reduce gap between main card and comparison info */
    .col-md-9 .comparison-info {
        margin-top: -10px; /* Increased negative margin by 50% from -5px to -10px */
    }
}

/* Desktop styles - ensure vertical layout */
@media (min-width: 768px) {
    /* Basic styling for desktop - no sticky behavior */
    .sticky-compare-card {
        position: relative; /* Default position */
        height: fit-content;
        z-index: 990; /* Lower than dropdown (99999) but still high enough for other elements */
        align-self: flex-start;
        width: 100%; /* Ensure consistent width */
        transition: none !important; /* Prevent any transitions */
        transform: none !important; /* Prevent any transforms */
        box-sizing: border-box; /* Include padding and border in width */
        padding-right: 15px; /* Add padding to maintain gap with right column */
    }

    /* Keep the class for styling purposes but remove sticky positioning */
    .sticky-compare-card.is-sticky {
        position: relative; /* Normal flow positioning instead of sticky */
        width: 100%; /* Ensure consistent width */
        max-width: 100%; /* Prevent expanding */
        left: auto !important; /* Prevent horizontal shifting */
        right: auto !important; /* Prevent horizontal shifting */
        transition: none !important; /* Prevent any transitions */
        transform: none !important; /* Prevent any transforms */
        animation: none !important; /* Prevent any animations */
        box-shadow: none !important; /* Prevent any shadow changes */
    }

    /* Ensure the car card maintains its original vertical styling on desktop */
    .sticky-compare-card .car-card-compare,
    .sticky-compare-card.is-sticky .car-card-compare {
        margin: 0; /* Remove any margin */
        width: 100%; /* Ensure it fills the container */
        display: block !important; /* Force vertical layout */
        flex-direction: column !important; /* Force vertical layout */
        transition: none !important; /* Prevent any transitions except hover */
        transform: none !important; /* Prevent any transforms except hover */
        max-width: 100%; /* Prevent expanding */
        box-sizing: border-box; /* Include padding and border in width */
    }

    /* Maintain hover effect on desktop */
    .sticky-compare-card .car-card-compare:hover {
        transform: translateY(-5px) !important;
        transition: transform 0.3s ease !important;
    }

    /* Disable hover effect when sticky to prevent flickering */
    .sticky-compare-card.is-sticky .car-card-compare:hover {
        transform: none !important;
        transition: none !important;
    }

    /* Ensure the image wrapper maintains its original styling */
    .sticky-compare-card .card-img-wrapper,
    .sticky-compare-card.is-sticky .card-img-wrapper {
        width: 100% !important;
        position: relative !important;
        border-radius: 8px 8px 0 0 !important;
        aspect-ratio: 16/12;
        top: auto !important;
        left: auto !important;
        bottom: auto !important;
        transition: none !important; /* Prevent any transitions */
        transform: none !important; /* Prevent any transforms */
    }

    /* Ensure the card body maintains its original styling */
    .sticky-compare-card .car-card-compare .card-body,
    .sticky-compare-card.is-sticky .car-card-compare .card-body {
        width: 100% !important;
        margin-left: 0 !important;
        border-radius: 0 0 8px 8px !important;
        transition: none !important; /* Prevent any transitions */
        transform: none !important; /* Prevent any transforms */
    }

    /* Desktop-specific spacer for the sticky card */
    .sticky-spacer {
        display: none; /* Hide by default */
    }

    /* Ensure the row layout works with sticky positioning */
    .row {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start; /* Align items to the top */
    }

    /* Ensure the columns maintain their widths */
    .col-md-3 {
        width: 25%;
        max-width: 25%;
        flex: 0 0 25%;
        box-sizing: border-box;
        padding-right: 15px;
    }

    .col-md-9 {
        width: 75%;
        max-width: 75%;
        flex: 0 0 75%;
        box-sizing: border-box;
        padding-left: 15px;
    }

    /* Ensure the sticky card doesn't touch the right column */
    .sticky-compare-card.is-sticky .car-card-compare {
        margin-right: 15px !important;
    }
}

/* Additional styling for sticky state - mobile only */
@media (max-width: 767.98px) {
    .sticky-compare-card.is-sticky .my-pick-badge {
        top: 0; /* Position at the very top edge */
        left: 0; /* Position at the very left edge */
        border-radius: 0; /* No border radius for sticky state */
        padding: 0.25rem 0.5rem; /* Reduced padding */
        font-size: 0.64rem; /* Reduced font size */
    }
}

/* Make the car card fill the sticky container */
.sticky-compare-card .car-card-compare {
    width: 100%;
    max-width: 100%;
    margin: 0;
}

/* Control image behavior in sticky card */
.sticky-compare-card .card-img-wrapper {
    position: relative;
    overflow: hidden;
}

.sticky-compare-card .card-img-top {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Desktop styles for card image and badge */
@media (min-width: 768px) {
    /* Ensure normal image display on desktop */
    .sticky-compare-card .card-img-wrapper {
        max-height: none; /* Remove max-height restriction */
        position: relative; /* Ensure normal positioning */
    }

    /* Ensure badge is properly positioned on desktop */
    .sticky-compare-card .my-pick-badge,
    .sticky-compare-card.is-sticky .my-pick-badge {
        top: -10px !important; /* Original position for desktop */
        left: 10px !important;
        z-index: 30;
    }
}

/* Horizontal layout for mobile screens - regardless of sticky state */
@media (max-width: 767.98px) {
    .sticky-compare-card .car-card-compare {
        display: flex;
        flex-direction: row;
        align-items: center;
        max-width: 100%;
        overflow: hidden;
        margin-top: 10px;
    }

    .sticky-compare-card .car-card-compare .card-img-wrapper {
        width: 40%;
        flex: 0 0 40%;
        margin-right: 0; /* Remove margin */
        border-radius: 15px 0 0 15px; /* Round only left corners */
        overflow: hidden; /* Ensure image stays within bounds */
        height: 100%; /* Fill full height */
    }

    /* Ensure image fills the wrapper completely */
    .sticky-compare-card .car-card-compare .card-img-wrapper img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
        display: block; /* Remove any inline spacing */
    }

    .sticky-compare-card .car-card-compare .card-body {
        width: 60%;
        flex: 0 0 60%;
        padding: 0.5rem 0.75rem; /* Restore original padding */
        border-radius: 0 15px 15px 0; /* Round only right corners */
        height: 100%; /* Fill full height */
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    /* Adjust content to fit in horizontal layout */
    .sticky-compare-card .car-card-compare .card-title {
        font-size: 0.8rem;
    }

    .sticky-compare-card .car-card-compare .car-specs {
        font-size: 0.6rem;
        gap: 0.25rem; /* Restore original gap */
    }

    .sticky-compare-card .car-card-compare .car-price-container {
        padding: 0.1rem 0.25rem; /* Restore original padding */
        gap: 0.15rem; /* Restore original gap */
    }

    .sticky-compare-card .car-card-compare .car-price {
        font-size: 0.85rem;
        padding: 0.3rem 0.5rem; /* Restore original padding */
    }

    /* Style features for horizontal layout */
    .sticky-compare-card .car-card-compare .features {
        display: flex; /* Show features */
        margin-top: 0.3rem; /* Restore original margin */
        padding: 0.1rem; /* Restore original padding */
        background-color: rgba(255, 255, 255, 0.03);
        border-radius: 6px;
    }

    .sticky-compare-card .car-card-compare .feature-box {
        padding: 0.2rem; /* Restore original padding */
        font-size: 0.7rem;
    }

    .sticky-compare-card .car-card-compare .feature-icon {
        font-size: 0.8rem;
        margin-right: 0.1rem; /* Restore original margin */
    }

    .sticky-compare-card .car-card-compare .feature-text {
        font-size: 0.7rem;
    }

    /* When sticky on mobile, make sure it fills the width properly */
    .sticky-compare-card.is-sticky {
        width: calc(100% - 20px);
        left: 10px;
        right: 10px;
        padding: 0; /* Remove padding to ensure card fills container */
        background-color: transparent; /* Make container transparent */
    }

    /* Ensure the car card has a solid background and proper styling when sticky on mobile */
    .sticky-compare-card.is-sticky .car-card-compare {
        background: linear-gradient(145deg, #2a2837 0%, #1f1b2c 100%);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); /* Add shadow to the card instead of container */
        margin: 0; /* Remove any margin */
        padding-top: 8px; /* Increased from 5px to prevent content from being cropped */
        transform: none; /* Prevent hover transform when sticky */
        width: 100%; /* Ensure it fills the container */
        border-radius: 0 !important; /* Force remove border radius for edge-to-edge appearance */
        margin-top: 0; /* Remove top margin when sticky */
        overflow: hidden; /* Ensure nothing spills outside the card */
        display: flex; /* Ensure flex layout */
        flex-direction: row; /* Horizontal layout */
        align-items: stretch; /* Stretch items to fill height */
        position: relative; /* Ensure proper positioning context */
        min-height: 150px; /* Set minimum height to ensure card is visible */
    }

    /* Mobile-specific fixes for image and badge positioning */
    .sticky-compare-card .car-card-compare {
        position: relative; /* Create positioning context */
    }

    .sticky-compare-card .car-card-compare .card-img-wrapper {
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        height: 100%;
    }

    .sticky-compare-card .car-card-compare .card-img-wrapper img {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
    }

    .sticky-compare-card .car-card-compare .card-body {
        margin-left: 40%; /* Match the width of the image wrapper */
    }

    /* Ensure image wrapper fills the left side in sticky state */
    .sticky-compare-card.is-sticky .car-card-compare .card-img-wrapper {
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        height: 100%;
        width: 40%;
        border-radius: 0 !important; /* Force remove border radius for edge-to-edge appearance */
    }

    /* Force remove all border radius from all elements in the sticky card */
    .sticky-compare-card.is-sticky *,
    .sticky-compare-card.is-sticky .car-card-compare *,
    .sticky-compare-card.is-sticky .car-card-compare .card-img-wrapper *,
    .sticky-compare-card.is-sticky .car-card-compare .card-body * {
        border-radius: 0 !important;
    }

    /* Hide like button in the sticky card for both mobile and desktop */
    .sticky-compare-card .btn-like,
    .sticky-compare-card.is-sticky .btn-like {
        display: none !important;
    }

    /* Prevent hover effect when sticky on mobile */
    .sticky-compare-card.is-sticky .car-card-compare:hover {
        transform: none;
    }

    /* Add spacing for content below the sticky card on mobile */
    .sticky-spacer {
        display: none;
        visibility: hidden;
        opacity: 0;
    }
}

/* Responsive adjustments for all cards */
@media (max-width: 992px) {
    .car-card-compare {
        flex: 0 0 calc(50% - 6px);
        max-width: calc(50% - 6px);
    }

    .car-card-compare .card-body {
        padding: 0.75rem;
    }

    .col-md-3 .car-card-compare .card-body {
        padding: 0.85rem;
    }

    .car-card-compare .card-img-wrapper {
        aspect-ratio: 3/2;
    }
}

@media (max-width: 768px) {
    .car-card-compare {
        flex: 0 0 calc(50% - 6px);
        max-width: calc(50% - 6px);
    }

    .car-card-compare .card-body {
        padding: 0.75rem;
    }

    .col-md-3 .car-card-compare .card-body {
        padding: 0.85rem;
    }

    /* Adjust text sizes */
    .car-card-compare .card-title {
        font-size: 0.9rem;
    }

    .car-card-compare .car-price {
        font-size: 1rem;
    }

    .car-card-compare .feature-box {
        font-size: 0.8rem;
    }
}

@media (max-width: 576px) {
    /* Even more aggressive gap reduction for very small screens */
    .sticky-compare-card {
        margin-top: -20px;
    }

    /* Keep styling but remove sticky positioning for smaller screens */
    .sticky-compare-card.is-sticky {
        position: relative; /* Normal flow positioning */
    }

    /* Further reduce gap between main card and comparison info for extra small screens */
    .col-md-9 .comparison-info {
        margin-top: -16px; /* Increased negative margin by 50% from -8px to -16px */
    }

    /* Extra enforcement of sharp corners for very small screens */
    .sticky-compare-card.is-sticky,
    .sticky-compare-card.is-sticky *,
    .sticky-compare-card.is-sticky .car-card-compare,
    .sticky-compare-card.is-sticky .car-card-compare *,
    .sticky-compare-card.is-sticky .car-card-compare .card-img-wrapper,
    .sticky-compare-card.is-sticky .car-card-compare .card-body,
    .sticky-compare-card.is-sticky .car-card-compare .card-body * {
        border-radius: 0 !important;
    }

    /* Further reduce badge size for very small screens */
    .my-pick-badge {
        padding: 0.2rem 0.4rem !important; /* Even smaller padding */
        font-size: 0.6rem !important; /* Even smaller font */
    }

    .my-pick-badge i {
        font-size: 0.65rem !important; /* Even smaller icon */
        margin-right: 0.2rem !important; /* Even smaller margin */
    }

    /* Ensure breadcrumb is not cropped by navbar */
    .breadcrumb-light {
        margin-top: -2rem;
    }

    .car-card-compare {
        flex: 0 0 calc(50% - 4px);
        max-width: calc(50% - 4px);
        width: calc(50% - 4px);
    }

    .car-card-compare .card-body {
        padding: 0.075rem; /* Reduced by ~90% from 0.75rem */
        gap: 0.05rem; /* Reduced by ~90% from 0.5rem */
        display: flex;
        flex-direction: column;
        gap: 0.2rem; /* Add spacing between main sections */
    }

    .col-md-3 .car-card-compare .card-body {
        padding: 0.075rem; /* Reduced by ~90% from 0.75rem */
    }

    .car-card-compare .card-img-wrapper {
        aspect-ratio: 4/3;
    }

    /* Title and year section */
    .car-card-compare .d-flex.align-items-center {
        gap: 0.15rem; /* Increased from 0.025rem for better readability */
        margin-bottom: 0.15rem; /* Add space after title */
    }

    .car-card-compare .car-year {
        font-size: 0.8rem;
        padding: 0.02rem 0.04rem; /* Reduced by ~90% from 0.15rem 0.4rem */
        margin-right: 0.1rem; /* Increased from 0.035rem */
    }

    .car-card-compare .card-title {
        font-size: 0.75rem;
    }

    /* Car specs section */
    .car-card-compare .car-specs {
        gap: 0.1125rem; /* Reduced by 25% from 0.15rem */
        margin-bottom: 0.15rem; /* Add space after specs */
    }

    /* Price section */
    .car-card-compare .car-price-container {
        padding: 0.02rem 0.05rem; /* Reduced by ~90% from original */
        gap: 0.1rem; /* Increased from 0.02rem */
        margin-bottom: 0.15rem; /* Add space after price */
    }

    .car-card-compare .car-price {
        font-size: 0.9rem;
        padding: 0.03rem 0.05rem; /* Reduced by ~90% from 0.3rem 0.5rem */
    }

    /* Features section */
    .car-card-compare .features {
        padding: 0.04rem 0.04rem 0.15rem 0.04rem !important; /* Added more padding at the bottom */
        margin-top: 0.15rem !important; /* Increased from 0.03rem */
        display: flex !important; /* Ensure flex display */
        flex-direction: column !important; /* Stack content vertically within features container */
        width: 100% !important; /* Ensure full width */
        min-height: 2.5rem !important; /* Ensure minimum height to prevent cropping */
    }

    .car-card-compare .feature-box {
        font-size: 0.7rem;
        padding: 0.15rem 0.025rem 0.025rem 0.025rem !important; /* Added more padding at the top */
        white-space: normal;
        display: flex !important;
        flex-direction: column !important; /* Stack icon on top of text */
        align-items: center !important;
        justify-content: flex-start !important; /* Align to the top to prevent cropping */
        text-align: center !important;
        height: 100% !important; /* Ensure full height */
        box-sizing: border-box !important; /* Include padding in height calculation */
    }

    .car-card-compare .feature-icon {
        font-size: 0.8rem;
        margin-right: 0 !important; /* Remove right margin since icon is now above text */
        margin-bottom: 0.2rem !important; /* Add space between icon and text */
        display: block !important;
        margin-top: 0.1rem !important; /* Add space at the top to prevent cropping */
        padding-top: 0.1rem !important; /* Additional padding at the top */
    }

    .car-card-compare .feature-text {
        font-size: 0.7rem;
        white-space: normal;
        display: block !important;
        width: 100% !important;
        text-align: center !important;
        word-spacing: normal !important; /* Ensure normal word spacing */
        letter-spacing: normal !important; /* Ensure normal letter spacing */
    }

    .car-card-compare .vertical-line {
        height: 15px !important;
        margin: 0 0.0375rem !important; /* Reduced by 25% from 0.05rem */
        width: 1px !important; /* Ensure proper width */
        background-color: rgba(255, 255, 255, 0.2) !important; /* Ensure proper color */
        display: block !important; /* Ensure proper display */
    }

    .car-card-compare .feature-divider {
        display: flex !important; /* Ensure flex display */
        align-items: center !important; /* Center items vertically */
        justify-content: center !important; /* Center items horizontally */
        height: 100% !important; /* Ensure full height */
    }

    .car-card-compare .row.g-0 {
        flex-wrap: nowrap !important;
        justify-content: space-between !important;
        gap: 0.075rem !important; /* Reduced by 25% from 0.1rem */
        padding: 0.025rem 0 0.1rem 0 !important; /* Added more padding at the bottom */
        flex-direction: row !important; /* Force horizontal layout */
        display: flex !important; /* Ensure flex display */
        width: 100% !important; /* Ensure full width */
        min-height: 2.2rem !important; /* Ensure minimum height to prevent cropping */
        align-items: stretch !important; /* Stretch items to fill height */
    }

    .car-card-compare .row.g-0 > .col-auto {
        flex: 1 1 33% !important;
        max-width: 33% !important;
        width: auto !important;
        margin: 0 !important;
        display: flex !important; /* Ensure flex display */
        flex-direction: column !important; /* Stack content vertically within column */
        align-items: center !important; /* Center items horizontally */
        justify-content: flex-start !important; /* Align to the top to prevent cropping */
        padding-top: 0.1rem !important; /* Add padding at the top */
        height: 100% !important; /* Ensure full height */
    }
}

/* Specific style for the main selected car card */
.col-md-3 .car-card-compare .card-body {
    padding: 0.85rem;
}

/* Override for small screens - but NOT for the main car card */
@media (max-width: 576px) {
    /* Restore original padding for the main car card */
    #stickyCompareCard .car-card-compare .card-body {
        padding: 0.75rem; /* Restore original padding */
        gap: 0.5rem; /* Restore original gap */
    }

    #stickyCompareCard .car-card-compare .car-price-container {
        padding: 0.1rem 0.25rem; /* Restore original padding */
        gap: 0.15rem; /* Restore original gap */
    }

    #stickyCompareCard .car-card-compare .car-price {
        padding: 0.1rem 0.3rem; /* Restore original padding */
    }

    #stickyCompareCard .car-card-compare .car-year {
        padding: 0.15rem 0.4rem; /* Restore original padding */
        margin-right: 0.35rem; /* Restore original margin */
    }

    #stickyCompareCard .car-card-compare .d-flex.align-items-center {
        gap: 0.25rem; /* Restore original gap */
    }

    #stickyCompareCard .car-card-compare .car-specs {
        gap: 0.25rem; /* Restore original gap */
    }

    #stickyCompareCard .car-card-compare .features {
        padding: 0.15rem; /* Restore original padding */
        margin-top: 0.3rem; /* Restore original margin */
    }

    #stickyCompareCard .car-card-compare .feature-box {
        padding: 0.4rem; /* Restore original padding */
    }

    #stickyCompareCard .car-card-compare .feature-icon {
        margin-right: 0.1rem; /* Restore original margin */
    }

    #stickyCompareCard .car-card-compare .row.g-0 {
        gap: 0.1rem; /* Restore original gap */
        padding: 0.15rem 0; /* Restore original padding */
    }
}

/* Comparison Heading Styles */
.comparison-info {
    background-color: rgba(253, 86, 49, 0.08);
    color: #d1d1d1;
    border-radius: 4px;
    border-left: 3px solid #fd5631;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    letter-spacing: 0.3px;
    width: 100%;
    font-weight: 500;
    line-height: 1.4;
}

.comparison-info i {
    margin-right: 0.5rem;
    font-size: 0.9rem;
    color: #fd5631;
    opacity: 0.9;
}

@media (max-width: 767.98px) {
    .comparison-info {
        padding: 0.3rem 0.5rem; /* Reduced padding to further minimize visual gap */
        margin-bottom: 0.15rem; /* Further reduced by 50% from 0.3rem to 0.15rem */
        font-size: 0.8rem;
    }

    .comparison-info i {
        font-size: 0.85rem;
        margin-right: 0.4rem;
    }
}

/* Extra small screens - further reduce gap */
@media (max-width: 576px) {
    .comparison-info {
        padding: 0.25rem 0.4rem; /* Further reduced padding for extra small screens */
        margin-bottom: 0.15rem; /* Further reduced to match mobile reduction */
        font-size: 0.75rem;
    }

    .comparison-info i {
        font-size: 0.8rem;
        margin-right: 0.3rem;
    }
}

/* Compare Form Card Styles */
.compare-form-card {
    background: linear-gradient(145deg, #2a2837 0%, #1f1b2c 100%);
    border-radius: 7px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border: none;
    padding: 0.25rem 0.5rem;
    margin-bottom: 1.5rem;
}

.compare-form-card .card-body {
    padding: 1rem;
}

@media (min-width: 576px) {
    .compare-form-card {
        padding: 0.35rem 0.6rem;
    }

    .compare-form-card .card-body {
        padding: 1.5rem;
    }
}

@media (min-width: 768px) {
    .compare-form-card {
        padding: 0.5rem 0.75rem;
    }

    .compare-form-card .card-body {
        padding: 2rem;
    }
}

/* Mobile-specific card styles */
@media (max-width: 768px) {
    .compare-form-card {
        padding: 0.125rem 0.25rem; /* Reduced by 50% from 0.25rem 0.5rem */
        margin-bottom: 1rem;
        border-radius: 0; /* Remove border radius for edge-to-edge appearance */
    }
}

/* Navigation Tabs Styles */
.nav-tabs-custom {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.nav-tabs-custom .nav-item {
    flex: 1;
    min-width: 150px;
    text-align: center;
}

.nav-tabs-custom .nav-link {
    color: rgba(255, 255, 255, 0.7);
    border: none;
    padding: 0.5rem 0.75rem;
    margin-right: 0;
    background: transparent;
    position: relative;
    transition: all 0.3s ease;
    border-radius: 4px;
    width: 100%;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.3px;
}

/* Mobile-specific tab styles */
@media (max-width: 768px) {
    .nav-tabs-custom {
        margin-left: -0.25rem; /* Extend tabs to the left edge */
        margin-right: -0.25rem; /* Extend tabs to the right edge */
        width: calc(100% + 0.5rem); /* Ensure full width */
        gap: 0.25rem; /* Reduced by 50% from 0.5rem */
    }

    .nav-tabs-custom .nav-item {
        min-width: 100px; /* Reduced minimum width */
    }
}

.nav-tabs-custom .nav-link i {
    margin-right: 0.35rem;
}

.nav-tabs-custom .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.nav-tabs-custom .nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border: none;
}

.nav-tabs-custom .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: #fd5631;
    border-radius: 2px;
}

@media (min-width: 576px) {
    .nav-tabs-custom {
        margin-bottom: 2rem;
    }

    .nav-tabs-custom .nav-link {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }
}

@media (min-width: 768px) {
    .nav-tabs-custom {
        justify-content: center;
        margin-bottom: 2rem;
    }

    .nav-tabs-custom .nav-item {
        flex: 0 1 auto;
    }

    .nav-tabs-custom .nav-link {
        padding: 0.75rem 2rem;
        margin-right: 1.5rem;
        font-size: 1rem;
    }

    /* Remove margin from the last tab to ensure perfect centering */
    .nav-tabs-custom .nav-item:last-child .nav-link {
        margin-right: 0;
    }
}

/* Table Styles for Comparison Tabs */
.table-responsive {
    margin-top: 1rem;
    border-radius: 8px;
    overflow: hidden;
}

.table-hover {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    color: rgba(255, 255, 255, 0.9);
    border-collapse: separate;
    border-spacing: 0;
}

.table-hover thead {
    background: rgba(255, 255, 255, 0.08);
}

.table-hover th {
    padding: 1rem;
    font-weight: 600;
    color: #fd5631;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

.table-hover td {
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}

.table-hover tbody tr {
    transition: all 0.2s ease;
}

.table-hover tbody tr:hover {
    background: rgba(255, 255, 255, 0.08);
}

.table-hover .btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.85rem;
    border-radius: 4px;
}

/* Button Styles */
.d-flex.justify-content-between.mt-4 {
    flex-wrap: wrap;
    gap: 0.75rem;
}

@media (max-width: 576px) {
    .d-flex.justify-content-between.mt-4 {
        flex-direction: column;
        width: 100%;
    }

    #backToListingBtn,
    #refreshComparisonBtn {
        width: 100%;
    }
}

#backToListingBtn,
#refreshComparisonBtn {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Button styles for larger screens */
@media (min-width: 768px) {
    .action-buttons-container {
        padding: 0.35rem;
        border-radius: 9px; /* Maintain reduced border radius */
    }

    .btn-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .button-divider {
        height: 22px;
        margin: 0 0.6rem;
    }
}

/* Action buttons container */
.action-buttons-container {
    display: flex;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 9px; /* Reduced by 70% from 30px */
    padding: 0.3rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Icon button style */
.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    transition: all 0.3s ease;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
}

/* Button divider */
.button-divider {
    width: 1px;
    height: 20px;
    background-color: rgba(255, 255, 255, 0.2);
    margin: 0 0.5rem;
}

/* Back button specific style */
#backToListingBtn {
    background: rgba(52, 58, 64, 0.3);
    color: #fff;
}

#backToListingBtn:hover {
    background: rgba(52, 58, 64, 0.8);
    transform: translateY(-2px);
}

/* Refresh button specific style */
#refreshComparisonBtn {
    background: rgba(253, 86, 49, 0.3);
    color: #fff;
}

#refreshComparisonBtn:hover {
    background: rgba(253, 86, 49, 0.8);
    transform: translateY(-2px);
}

/* Alert Styles */
.alert-info {
    background: rgba(13, 202, 240, 0.1);
    border: 1px solid rgba(13, 202, 240, 0.2);
    color: rgba(255, 255, 255, 0.8);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

/* Tab-specific alert styling */
.tab-pane .alert {
    position: sticky;
    top: 0;
    z-index: 5;
    border-left: 4px solid #0dcaf0;
    background: rgba(13, 202, 240, 0.15);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
    padding: 0.75rem 1rem;
    font-weight: 500;
    border-radius: 6px;
    text-align: left;
    font-size: 0.95rem;
    letter-spacing: 0.2px;
}

/* Mobile-specific alert styling */
@media (max-width: 768px) {
    .tab-pane .alert {
        padding: 0.75rem 0.75rem 0.75rem 1rem; /* Increased left padding to prevent text cropping */
        margin: 0 0.5rem 1rem 0.5rem; /* Add left and right margin to prevent border cropping */
        border-radius: 0; /* Remove border radius for edge-to-edge appearance */
        border-left: 4px solid #0dcaf0; /* Keep left border to ensure it's visible */
        border-top: none; /* Remove top border */
        width: calc(100% - 1rem); /* Adjust width to account for margins */
    }
}

.tab-pane .alert strong {
    color: #fff;
    margin-right: 0.5rem;
}

.tab-pane .alert i {
    color: #0dcaf0;
    font-size: 1.1rem;
    margin-right: 0.5rem;
    vertical-align: -1px;
}

/* Mobile-specific alert icon styling */
@media (max-width: 768px) {
    .tab-pane .alert i {
        font-size: 0.95rem;
        margin-right: 0.3rem;
    }
}

@media (max-width: 576px) {
    .tab-pane .alert i {
        font-size: 0.85rem;
        margin-right: 0.2rem;
    }
}

.alert-warning {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.2);
    color: rgba(255, 255, 255, 0.8);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

/* Specific styling for warning alerts in comparison content */
#sellers-comparison-content > .alert-warning,
#price-comparison-content > .alert-warning {
    margin: 0.5rem 0;
    padding: 0.75rem;
    display: flex;
    align-items: center;
    min-height: auto;
    border-left: 4px solid rgba(255, 193, 7, 0.6);
}

/* Responsive adjustments for warning alerts in comparison content */
@media (max-width: 768px) {
    #sellers-comparison-content > .alert-warning,
    #price-comparison-content > .alert-warning {
        margin: 0.25rem;
        padding: 0.6rem 0.5rem 0.6rem 0.75rem;
        font-size: 0.85rem;
        line-height: 1.2;
    }
}

@media (max-width: 576px) {
    #sellers-comparison-content > .alert-warning,
    #price-comparison-content > .alert-warning {
        margin: 0.15rem;
        padding: 0.5rem 0.4rem 0.5rem 0.6rem;
        font-size: 0.8rem;
    }
}

.alert-danger {
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.2);
    color: rgba(255, 255, 255, 0.8);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

/* Loading Spinner */
.fa-spinner {
    animation: spin 1s linear infinite;
    color: #fd5631;
    font-size: 1.5rem;
    margin: 2rem 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Tab Content Container */
.tab-pane {
    padding: 1rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .compare-form-card .card-body {
        padding: 1.5rem 0; /* Removed left and right padding to better utilize space */
    }

    .tab-pane {
        padding: 1rem 0; /* Removed left and right padding to better utilize space */
    }

    .nav-tabs-custom .nav-link {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    /* Adjust action buttons for mobile */
    .action-buttons-container {
        padding: 0.25rem;
        border-radius: 9px; /* Maintain reduced border radius */
    }

    .btn-icon {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }

    .table-hover th,
    .table-hover td {
        padding: 0.5rem;
        font-size: 0.85rem;
    }
}

/* Additional responsive adjustments for very small screens */
@media (max-width: 576px) {
    .tab-pane {
        padding: 0.1rem 0; /* Removed left and right padding, kept top and bottom */
        margin-left: -0.125rem; /* Extend content to the left edge */
        margin-right: -0.125rem; /* Extend content to the right edge */
        width: calc(100% + 0.25rem); /* Ensure full width */
    }

    .compare-form-card .card-body {
        padding: 0.15rem 0; /* Removed left and right padding, kept top and bottom */
    }

    /* Reduce container padding on very small screens */
    .container {
        padding-left: 0.125rem !important; /* Reduced by 50% from mobile view */
        padding-right: 0.125rem !important; /* Reduced by 50% from mobile view */
    }

    /* Adjust alert for very small screens */
    .tab-pane .alert {
        padding: 0.5rem 0.4rem 0.5rem 0.8rem; /* Further reduced padding */
        margin: 0 0.2rem 0.5rem 0.2rem; /* Smaller margins */
        font-size: 0.8rem; /* Even smaller font size */
        width: calc(100% - 0.4rem); /* Adjust width to account for margins */
    }

    .nav-tabs-custom .nav-link {
        padding: 0.05rem 0.1rem; /* Reduced by ~90% */
        font-size: 0.85rem;
    }

    .table-hover th,
    .table-hover td {
        padding: 0.04rem; /* Reduced by ~90% from 0.4rem */
        font-size: 0.8rem;
    }

    .table-responsive {
        font-size: 0.8rem;
    }

    /* Adjust action buttons for very small screens */
    .action-buttons-container {
        padding: 0.15rem;
        border-radius: 9px; /* Maintain reduced border radius */
    }

    .btn-icon {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }

    .button-divider {
        height: 16px;
        margin: 0 0.3rem;
    }
}

/* Additional comparison-specific elements */
#sellers-comparison-content,
#price-comparison-content {
    min-height: 200px;
}

/* Adjust min-height when only an alert is present */
#sellers-comparison-content:only-child,
#price-comparison-content:only-child,
#sellers-comparison-content > .alert:only-child,
#price-comparison-content > .alert:only-child,
#sellers-comparison-content.empty-results,
#price-comparison-content.empty-results {
    min-height: auto !important;
}

/* Specific styling for empty results containers */
.empty-results {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0;
}

/* Specific styling for no-results-alert */
.no-results-alert {
    margin: 0.5rem;
    min-height: auto;
    max-width: 100%;
    width: auto;
}

.text-center {
    text-align: center !important;
}

/* Add nice borders to tables in small screens */
@media (max-width: 767px) {
    .table-responsive {
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
}

/* Hover button styles */
.card-img-wrapper .hover-view-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: rgba(253, 86, 49, 0.9);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-img-wrapper .hover-view-btn i {
    font-size: 0.95rem;
}

.card-img-wrapper:hover .hover-view-btn {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.card-img-wrapper .hover-view-btn:hover {
    background: rgba(253, 86, 49, 1);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4);
}

.card-img-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0) 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card-img-wrapper:hover::after,
.card-img-wrapper.mobile-hover::after {
    opacity: 1;
}

/* Top Search & Compare promotion icon */
.top-search-compare-icon {
    position: absolute;
    bottom: 0;
    left: 0;
    background-color: #1f1b2c;
    color: #fd5631;
    width: 20px;
    height: 20px;
    border-radius: 0 4px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    margin: 0;
    padding: 0;
}

.top-search-compare-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
}

/* Responsive adjustments for Top Search & Compare icon */
@media (max-width: 767.98px) {
    .top-search-compare-icon {
        width: 18px;
        height: 18px;
        font-size: 11px;
    }
}

@media (max-width: 575.98px) {
    .top-search-compare-icon {
        width: 16px;
        height: 16px;
        font-size: 10px;
    }
}

/* Car grid layout for responsive display */
.car-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 8px;
    width: 100%;
}

/* Remove padding on mobile for car grid */
@media (max-width: 768px) {
    .car-grid {
        padding: 8px 0; /* Remove left and right padding */
        gap: 8px; /* Reduce gap for better space utilization */
    }
}

/* Further reduce padding on very small screens */
@media (max-width: 576px) {
    .car-grid {
        padding: 4px 0; /* Further reduce top and bottom padding */
        gap: 6px; /* Further reduce gap */
    }
}

/* Responsive adjustments for the cards */
@media (max-width: 992px) {
    .row-cols-lg-4 > * {
        flex: 0 0 auto;
        width: 50%;
    }

    .row-cols-lg-3 > * {
        flex: 0 0 auto;
        width: 50%;
    }

    .card-img-wrapper {
        aspect-ratio: 3/2;
    }

    .car-card-compare .card-body {
        padding: 0.85rem;
    }
}

@media (max-width: 768px) {
    .row-cols-md-3 > * {
        flex: 0 0 auto;
        width: 50%;
    }

    .row-cols-md-2 > * {
        flex: 0 0 auto;
        width: 50%;
    }

    /* Improve main layout on mobile */
    .col-md-3, .col-md-9 {
        width: 100%;
        padding-left: 0.25rem; /* Reduced by 50% from 0.5rem */
        padding-right: 0.25rem; /* Reduced by 50% from 0.5rem */
    }

    /* Reduce container padding on mobile */
    .container {
        padding-left: 0.25rem !important; /* Reduced by 50% from default */
        padding-right: 0.25rem !important; /* Reduced by 50% from default */
    }

    /* Ensure the main car card is visible before scrolling */
    .col-md-3 {
        margin-bottom: 1.5rem;
    }

    /* Adjust card body padding */
    .car-card-compare .card-body {
        padding: 0.85rem;
    }

    /* Adjust text sizes */
    .car-card-compare .card-title {
        font-size: 0.9rem;
    }

    .car-card-compare .car-price {
        font-size: 1rem;
    }

    .car-card-compare .feature-box {
        font-size: 0.8rem;
    }

    /* View button should only appear on hover, even on mobile */
    /* Add touch-specific hover effect for mobile */
    .card-img-wrapper:active .hover-view-btn {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    .card-img-wrapper:active::after {
        opacity: 1;
    }

    /* Improve tab content spacing */
    .tab-pane {
        padding: 0.5rem 0; /* Remove left and right padding */
    }

    /* Adjust alert padding */
    .tab-pane .alert {
        padding: 0.6rem 0.5rem 0.6rem 1rem; /* Adjusted left padding */
        margin: 0 0.25rem 0.75rem 0.25rem; /* Add left and right margin to prevent border cropping */
        font-size: 0.85rem; /* Slightly smaller font size */
        border-radius: 0; /* Remove border radius for edge-to-edge appearance */
        line-height: 1.2; /* Tighter line height for better fit */
        width: calc(100% - 0.5rem); /* Adjust width to account for margins */
    }
}

@media (max-width: 576px) {
    .row-cols-sm-2 > * {
        flex: 0 0 auto;
        width: 50%;
        padding: 0 4px;
    }

    .row {
        margin-left: -4px;
        margin-right: -4px;
    }

    .g-3 {
        --bs-gutter-x: 0.5rem;
    }

    /* Adjust card body padding */
    .car-card-compare .card-body {
        padding: 0.65rem;
    }

    /* Adjust text sizes */
    .car-card-compare .card-title {
        font-size: 0.75rem;
    }

    .car-card-compare .car-price {
        font-size: 0.9rem;
    }

    .car-card-compare .feature-box {
        font-size: 0.7rem;
        padding: 0.25rem;
    }

    .car-card-compare .feature-icon {
        font-size: 0.8rem;
    }

    .car-card-compare .feature-text {
        font-size: 0.7rem;
    }

    .car-card-compare .vertical-line {
        height: 15px;
        margin: 0 0.15rem;
    }

    .car-card-compare .row.g-0 {
        gap: 0.1rem;
    }

    /* Ensure features are properly spaced on small screens */
    .car-card-compare .features .row.g-0 {
        justify-content: space-around;
    }
}

/* Comparison Card Body Styles */
#sellers-comparison-content .car-card-compare .card-body,
#price-comparison-content .car-card-compare .card-body {
    padding: 0.75rem !important;
    text-align: left;
}

/* Responsive adjustments for comparison cards */
@media (max-width: 992px) {
    #sellers-comparison-content .car-card-compare .card-body,
    #price-comparison-content .car-card-compare .card-body {
        padding: 0.75rem !important;
    }
}

@media (max-width: 768px) {
    #sellers-comparison-content .car-card-compare .card-body,
    #price-comparison-content .car-card-compare .card-body {
        padding: 0.75rem !important;
    }

    /* Improve spacing between cards */
    #sellers-comparison-content .col,
    #price-comparison-content .col {
        margin-bottom: 1rem;
    }
}

@media (max-width: 576px) {
    /* Reduce border radius of comparison cards by 25% */
    #sellers-comparison-content .car-card-compare,
    #price-comparison-content .car-card-compare {
        border-radius: 11.25px; /* Reduced by 25% from 15px */
    }

    #sellers-comparison-content .car-card-compare .card-body,
    #price-comparison-content .car-card-compare .card-body {
        padding: 0.075rem !important; /* Reduced by ~90% from 0.75rem */
        display: flex;
        flex-direction: column;
        gap: 0.2rem; /* Add spacing between main sections */
    }

    /* Title and year section in comparison cards */
    #sellers-comparison-content .car-card-compare .d-flex.align-items-center,
    #price-comparison-content .car-card-compare .d-flex.align-items-center {
        gap: 0.15rem; /* Increased for better readability */
        margin-bottom: 0.15rem; /* Add space after title */
    }

    /* Car specs section in comparison cards */
    #sellers-comparison-content .car-card-compare .car-specs,
    #price-comparison-content .car-card-compare .car-specs {
        gap: 0.1125rem; /* Reduced by 25% from 0.15rem */
        margin-bottom: 0.15rem; /* Add space after specs */
    }

    /* Price section in comparison cards */
    #sellers-comparison-content .car-card-compare .car-price-container,
    #price-comparison-content .car-card-compare .car-price-container {
        padding: 0.02rem 0.05rem; /* Reduced by ~90% */
        gap: 0.1rem; /* Increased for better readability */
        margin-bottom: 0.15rem; /* Add space after price */
        border-radius: 4.5px; /* Reduced by 25% from 6px */
    }

    /* Reduce border radius for car year badge */
    #sellers-comparison-content .car-card-compare .car-year,
    #price-comparison-content .car-card-compare .car-year {
        border-radius: 3px; /* Reduced by 25% from 4px */
    }

    /* Features section in comparison cards */
    #sellers-comparison-content .car-card-compare .features,
    #price-comparison-content .car-card-compare .features {
        padding: 0.04rem; /* Reduced by ~90% */
        margin-top: 0.15rem; /* Increased for better spacing */
        border-radius: 6px; /* Reduced by 25% from 8px */
    }

    /* Reduce border radius for card image wrapper */
    #sellers-comparison-content .car-card-compare .card-img-wrapper,
    #price-comparison-content .car-card-compare .card-img-wrapper {
        border-radius: 6px 6px 0 0; /* Reduced by 25% from 8px */
    }

    /* Adjust feature spacing on small screens */
    #sellers-comparison-content .car-card-compare .features .row.g-0,
    #price-comparison-content .car-card-compare .features .row.g-0 {
        justify-content: space-around;
        gap: 0.075rem; /* Reduced by 25% from 0.1rem */
        padding: 0.025rem 0; /* Reduced by ~90% */
    }

    #sellers-comparison-content .car-card-compare .feature-box,
    #price-comparison-content .car-card-compare .feature-box {
        padding: 0.025rem; /* Reduced by ~90% */
        border-radius: 3px; /* Added reduced border radius */
    }

    /* Reduce border radius for price tag */
    #sellers-comparison-content .car-card-compare .car-price-container::before,
    #price-comparison-content .car-card-compare .car-price-container::before {
        border-radius: 1.5px 0 0 1.5px; /* Reduced by 25% from 2px */
    }

    #sellers-comparison-content .car-card-compare .feature-icon,
    #price-comparison-content .car-card-compare .feature-icon {
        margin-right: 0.05rem; /* Increased for better spacing */
    }

    #sellers-comparison-content .car-card-compare .vertical-line,
    #price-comparison-content .car-card-compare .vertical-line {
        margin: 0 0.0375rem; /* Reduced by 25% from 0.05rem */
    }
}
