@media (max-width: 800px) {
    .filter-box {
        flex-wrap: wrap;
    }

    .keyword-search {
        width: 100%;
        margin-left: 0;
    }

    .keyword-search input {
        width: 100%;
    }

    .brand-menu {
        width: min(360px, 90vw);
    }

    /* Header trên máy tính bảng và điện thoại */
    header {
        padding: 16px 20px;
        gap: 16px;
        flex-wrap: wrap;
    }

    header h1 {
        min-width: 0;
        max-width: 100%;
        font-size: 22px;
        line-height: 1.35;
        overflow-wrap: anywhere;
    }

    header nav {
        display: flex;
        flex-wrap: wrap;
        gap: 12px 18px;
    }

    header nav a {
        white-space: nowrap;
    }
}

/* Trên điện thoại: các nút xếp dọc */
@media (max-width: 600px) {
    .detail-cart-actions {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .detail-cart-actions #addToCartButton,
    .detail-cart-actions #viewCartButton,
    .detail-cart-actions #contactZaloButton {
        width: 100%;
        max-width: 100%;
    }
}

/* Footer tự điều chỉnh trên điện thoại */
@media (max-width: 768px) {
    footer .footer-container {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    footer .footer-column {
        width: 100%;
        min-width: 0;
    }

    footer p,
    footer a,
    footer h3,
    footer h4 {
        overflow-wrap: anywhere;
    }
}


/* HIỂN THỊ SẢN PHẨM TRÊN ĐIỆN THOẠI */
@media (max-width: 768px) {

    /* Sản phẩm nổi bật tại trang chủ */
    .products .product-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        width: 100%;
        min-width: 0;
    }

    /* Bánh răng, Cóc ben và các carousel sản phẩm */
    .carousel-product-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        width: 100%;
    }

    /* Ngăn thẻ sản phẩm gây tràn ngang */
    .products .product-list > *,
    .carousel-product-list > * {
        min-width: 0;
        max-width: 100%;
    }

    .products .product-list img,
    .carousel-product-list img {
        max-width: 100%;
        height: auto;
    }
}

/* =========================================
   TỐI ƯU TRANG SẢN PHẨM TRÊN ĐIỆN THOẠI
   ========================================= */
@media (max-width: 768px) {

    /* Lưới sản phẩm: 2 sản phẩm mỗi hàng */
    .product-page .product-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        width: 100%;
        min-width: 0;
    }

    .product-page .product-list > * {
        min-width: 0;
        max-width: 100%;
    }

    .product-page .product-list img {
        max-width: 100%;
        height: auto;
    }

    /* Bộ lọc tự xuống dòng */
    .filter-box {
        flex-wrap: wrap;
        padding: 15px;
        gap: 12px;
    }

    .filter-dropdown {
        min-width: 0;
    }

    .filter-button {
        width: 100%;
        min-width: 0;
    }

    .keyword-search {
        width: 100%;
        margin-left: 0;
    }

    .keyword-search input {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Footer: các cột xếp dọc */
    .footer-container {
        display: grid;
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .footer-column {
        width: 100%;
        min-width: 0;
        overflow-wrap: anywhere;
    }
}

/* HERO trên điện thoại */
@media (max-width: 768px) {
    .hero {
        padding: 35px 16px;
    }

    .hero-content {
        grid-template-columns: minmax(0, 1fr);
        gap: 28px;
    }

    .hero-visual {
        min-width: 0;
        padding: 20px;
    }

    .hero-copy {
        min-width: 0;
    }

}

/* =========================================================
   TRANG SẢN PHẨM - ĐIỆN THOẠI
   ========================================================= */

@media (max-width: 768px) {

    /* KHUNG TRANG */
    .product-page {
        width: 100%;
        max-width: 100%;
        padding: 25px 12px;
        overflow: visible;
    }

    /* BỘ LỌC */
   .filter-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    width: 100%;
    padding: 12px;
    gap: 8px;
    margin-bottom: 25px;
    }

    /* HAI NÚT HÃNG XE VÀ LOẠI PHỤ TÙNG */
    .filter-dropdown {
    position: relative;
    width: auto;
    flex: 1;
    min-width: 0;
    }

    .filter-button {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 10px 6px;
    font-size: 13px;
    text-align: center;
    white-space: nowrap;
}

    /* MENU HÃNG XE */
    .brand-menu,
    .brand-menu.show {
        width: 100%;
        max-width: calc(100vw - 54px);
        left: 0;
        right: auto;
        box-sizing: border-box;
        display: none;
    }

    .brand-menu.show {
    display: flex !important;
    }

    .brand-list {
        width: 100%;
        min-width: 0;
        flex-shrink: 0;
    }

    .brand-item {
        padding: 12px 10px;
        font-size: 13px;
        overflow-wrap: break-word;
    }

    

    .vehicle-line-item {
        padding: 12px 10px;
        font-size: 13px;
    }

    /* MENU LOẠI PHỤ TÙNG */
    .category-menu {
        width: 100%;
        max-width: calc(100vw - 54px);
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: none;
        grid-auto-flow: row;
        grid-auto-columns: auto;
        gap: 0;
        box-sizing: border-box;
    }

    .category-item {
        padding: 12px 15px;
        font-size: 14px;
        white-space: normal;
    }

    /* DANH SÁCH SẢN PHẨM */
    .product-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        gap: 12px;
    }

    /* TỪNG SẢN PHẨM */
    .product {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        padding: 10px;
        box-sizing: border-box;
        overflow: hidden;
    }

    .product-image {
        width: 100%;
        height: 130px;
        margin-bottom: 12px;
    }

    .product-image img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    .product h3 {
        font-size: 14px;
        line-height: 1.4;
        overflow-wrap: break-word;
    }

    .product p {
        font-size: 12px;
        overflow-wrap: break-word;
    }

    .product .price {
        font-size: 15px;
    }

    .product button {
        padding: 10px 5px;
        font-size: 12px;
    }

    .filter-dropdown:hover .brand-menu:not(.show) {
    display: none !important;
}

.filter-dropdown:hover .category-menu:not(.show) {
    display: none !important;
}
}
/* =================================
   SEARCH BAR - TRANG CHỦ ĐIỆN THOẠI
   ================================= */

@media (max-width: 768px) {

    .search-box {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        max-width: 100%;
        gap: 10px;
        box-sizing: border-box;
    }

    #homeSearchInput {
        display: block;
        width: 100%;
        min-width: 0;
        height: 48px;
        padding: 0 14px;
        box-sizing: border-box;
        font-size: 15px;
    }

    #homeSearchButton {
        display: block;
        width: 100%;
        min-width: 0;
        height: 48px;
        box-sizing: border-box;
        font-size: 15px;
    }

}

@media (max-width: 768px) {
    .site-logo img {
        width: 150px;
        max-height: 48px;
    }
}

/* =========================================
   ĐIỀU CHỈNH GRADIENT KHI THU NHỎ MÀN HÌNH
   ========================================= */

@media (max-width: 1200px) {

    header {
        background:
            radial-gradient(
                circle at 15% 250px,
                rgba(37, 99, 235, 0.35),
                transparent 85%
            ),
            linear-gradient(
                120deg,
                #172b46 100%,
                #111827 100%
            );
    }

    .hero {
        background:
            radial-gradient(
                circle at 15% 150px,
                rgba(37, 99, 235, 0.35),
                transparent 85%
            ),
            linear-gradient(
                120deg,
                #172b46 100%,
                #111827 100%
            );
    }
}

/* Màn hình nhỏ hơn */
@media (max-width: 800px) {

    header {
        background:
            radial-gradient(
                circle at -20% 350px,
                rgba(37, 99, 235, 0.35),
                transparent 185%
            ),
            linear-gradient(
                120deg,
                #172b46 100%,
                #111827 100%
            );
    }

    .hero {
        background:
            radial-gradient(
                circle at 15% 150px,
                rgba(37, 99, 235, 0.35),
                transparent 85%
            ),
            linear-gradient(
                120deg,
                #172b46 100%,
                #111827 100%
            );
    }
}