* {
    margin: 0;
    padding: 0;
    font-family: 'Oswald', sans-serif;
    box-sizing: border-box;
}

body {
    background-color: black;
}

.car-types {
    padding-top: 15px;
    padding-bottom: 10px;
    position: relative;
    display: flex;
    height: auto;
    margin-top: 0 10vw;
}

.category-container {
    width: 100vw;
    position: relative;
    overflow-x: auto;
    padding: 0 10vw;
}
.categories {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 40px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.categories::-webkit-scrollbar {
    display: none; 
}

.category-item:hover {
    color: #676767;
}

.category {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 120px;
    height: 120px;
    padding: 10px;
    background-color: #dbdbdb; 
    border-radius: 8px;
    transition: transform 0.3s ease;
}
.category-item {
    display: inline-block;
    text-align: center;
    text-decoration: none;
    color: inherit;
}

.category-item img {
    display: block;
    width: 100%;
    border-radius: 16px;
}

.category-item span {
    display: block;
}


.category:hover {
    transform: scale(1.05);
    background-color: #444;
}

.category img {
    height: 70px;
    width: auto;
    border-radius: 16px;
}

.category-item {
    color: #000000;
    text-decoration: none;
    font-size: 16px;
}

.category-item:hover {
    color: lightskyblue;
}
.scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgb(0, 0, 0, 0.6);
    color: white;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.car-types:hover .scroll-btn,
.latest-news:hover .scroll-btn {
    opacity: 1;
}

.scroll-btn.left {
    left: 6vw;
}

.scroll-btn.right {
    left: 90vw
}
.latest-news{
    width: 80vw;
    margin: 0 10vw;
    padding-top: -50px;
}

/* Remove all text decoration from links in cards */
.latest-news a,
.latest-news a:hover,
.latest-news a:visited,
.latest-news a:link,
.latest-news a:active {
    text-decoration: none !important;
    color: inherit;
}
.latest-news .hr2{
    width: 75vw;
    background-color: lightskyblue;
    border: 1px solid lightskyblue;
    height: 2px;
}
.latest-news hr {
    width: 20%;
    margin-top: -1px;
    margin-left: 0px;
    height: 10px;
    background-color: lightskyblue;
    border: 1px solid lightskyblue;
}
.latest-news h1 {
    text-align: left;
    color: #fff;
    font-size: 50px;
}
.latest-news h2 {
    padding-top: 5px;
    text-align: left;
    color: #fff;
    font-size: 40px;
}

.latest-news .cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 40px;
    margin: 25px auto;
    width: 100%;
}

.latest-news .card {
    position: relative;
    padding: 7px;
    border-radius: 16px;
}

/* Ensure card links have no underlines */
.latest-news .card a {
    text-decoration: none !important;
    color: inherit;
    border: none;
    outline: none;
}

.latest-news .card a:hover,
.latest-news .card a:visited,
.latest-news .card a:link,
.latest-news .card a:active {
    text-decoration: none !important;
}
.latest-news .image-section {
    width: 100%;
    height: 200px;
    overflow: hidden;
    border-radius: 16px;
}

.latest-news .image-section img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: filter 0.3s ease;
    border-radius: 16px;
}
.latest-news .name{
    color:white;
    font-weight: bold;
    font-size: 25px;
    padding-left: 10px;
}
.latest-news .price{
    padding-top: 10px;
    color:white;
    font-size: 18px;
    padding-left: 10px;
}
.latest-news .full-button {
    font-size: medium;
    background-color: transparent;
    padding: 7px 30px;
    color: white;
    height: 50px;
    width: auto;
    text-align: right;
    display: block;
    margin-left: 64.6vw;
    border-color: white;
    border-width: 1px;
    cursor: pointer;
    border-radius: 12px;
}

.latest-news .full-button:hover{
    background-color: lightskyblue;
    border-radius: 12px;
}
.latest-news p {
    color: lightskyblue;
    font-size: 30px;
    padding-top: 5px;
}
.latest-news h3 {
    color: #fff;
    font-size: 22px;
    padding-top: 5px;
    transition: filter 0.3s ease;
}
.latest-news .card:hover img {
    filter: grayscale(50%);
    border-radius: 16px;
}
.latest-news .card:hover h3 {
    text-decoration: none;
    color: lightskyblue;
}
.latest-news .card hr {
    height: 2px;
    margin-top: 7px;
    color: rgb(128, 206, 255);
    width: 40px;
}

.mid-hr hr{
    width: 100%;
    color: #065586
}

.hr{
    width: 80vw;
    margin-left: 9.5vw;
    background-color: lightskyblue;
    border: 1px solid lightskyblue;
    height: 2px;
}

@media (max-width: 768px) {
    /* Car categories mobile */
    .car-types {
        width: 100vw;
        margin: 0;
        padding: 15px 0 10px 0;
    }

    /* Hide scroll buttons on mobile */
    .scroll-btn {
        display: none;
    }

    /* Update category container for grid layout */
    .category-container {
        width: 90vw;
        padding: 0 5vw;
        overflow: hidden;
    }
    
    .categories {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important; /* 3 columns */
        grid-template-rows: repeat(3, 1fr) !important;    /* 3 rows */
        gap: 10px !important;
        overflow: hidden !important;
        width: 100% !important;
        max-width: 100% !important;
        flex-wrap: unset !important;
        flex-direction: unset !important;
    }
    
    .category {
        width: auto; /* Let grid control the width */
        height: 40px; /* Smaller height for mobile grid */
        padding: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Hide images in category cards on mobile */
    .category img {
        display: none;
    }
    
    .category-item {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 100%;
    }
    
    .category-item span {
        font-size: 12px; /* Smaller text for mobile */
        text-align: center;
        color: #000000;
    }

    .heading {
        font-size: x-large;
        padding-left: 20px;
        margin: 0 3vw;
    }
    
    .latest-news .image-section {
        height: 180px;
    }
    
    .cards-container {
        padding: 0 10px;
    }
    
    .cards {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* ========== Mobile Card Limits ========== */
    /* Limit cards to 3 per section while maintaining side margins */
    .latest-news {
        width: 80vw; /* Keep same side margins as desktop */
        margin: 0 10vw; /* Keep same side margins as desktop */
    }

    .latest-news .cards {
        display: grid;
        grid-template-columns: 1fr; /* Single column layout for mobile */
        gap: 20px;
        margin: 25px auto;
        width: 100%;
    }

    /* Limit review cards to 3 for all categories */
    #reviews-luxury .card:nth-child(n+4),
    #reviews-hybrids .card:nth-child(n+4),
    #reviews-minivan .card:nth-child(n+4),
    #reviews-pickups .card:nth-child(n+4),
    #reviews-performance .card:nth-child(n+4),
    #reviews-sedan .card:nth-child(n+4),
    #reviews-suv .card:nth-child(n+4),
    #reviews-electric .card:nth-child(n+4) {
        display: none;
    }

    /* Limit news cards to 3 for all categories */
    #luxury-news-cards .card:nth-child(n+4),
    #hybrid-news-cards .card:nth-child(n+4),
    #minivan-news-cards .card:nth-child(n+4),
    #pickup-news-cards .card:nth-child(n+4),
    #performance-news-cards .card:nth-child(n+4),
    #sedan-news-cards .card:nth-child(n+4),
    #suv-news-cards .card:nth-child(n+4),
    #ev-news-cards .card:nth-child(n+4),
    #hatchback-news-cards .card:nth-child(n+4) {
        display: none;
    }

    /* Adjust typography for mobile */
    .latest-news h1 {
        font-size: 36px;
    }

    .latest-news h2 {
        font-size: 28px;
    }

    .latest-news p {
        font-size: 24px;
    }

    .latest-news h3 {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .heading {
        font-size: large;
        padding-left: 15px;
    }
    
    .categories {
        grid-template-columns: 1fr;
        padding: 0 15px;
    }
    
    .latest-news .image-section {
        height: 160px;
    }
}