/* Màu sắc chủ đạo - Màu sắc Việt Nam */
:root {
    --red-vietnam: #610c0c;
    --yellow-vietnam: #FFCD00;
    --dark-vietnam: #fff;
    --cream-japanese: #503303;
    --grey-vietnam: #d13b3b;
}

.product_bubble_right::after {
    left: 3px;
    bottom: 5px;
}


/* Đảm bảo mọi khung sản phẩm đều chiều cao */
.product-item {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background-color: #fff;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 20px;
    min-height: 350px; /* Chiều cao cố định */
    box-sizing: border-box; /* Đảm bảo padding không làm thay đổi kích thước */
}

.product_image {
    width: 100%;
    height: 200px; /* Chiều cao cố định */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 10px;
}

    .product_image img {
        width: 100%;
        height: 100%;
        object-fit: cover; /* Giữ tỷ lệ ảnh */
    }

.product_info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background-color: #c1c1c147;
}

.product_name {
    font-size: 14px;
    color: var(--cream-japanese);
    line-height: 1.4;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 10px;
}

.product_price {
    font-size: 16px;
    color: var(--yellow-vietnam);
    text-align: center;
}

/* Nút Add to Cart căn đều */
.red_button.add_to_cart_button {
    text-align: center;
    background-color: var(--red-vietnam);
    border-radius: 5px;
    color: #fff;
    padding: 10px 12px;
    font-size: 14px;
    transition: all 0.3s ease;
    margin-top: 10px;
}

/* Sử dụng flex để căn sản phẩm theo grid */
.product-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: space-between;
}

.category-section {
    padding-top: 5px; /* Để không bị che bởi menu sticky */
    margin-top: -30px; /* Để bù trừ padding và đảm bảo vị trí chính xác */
    scroll-margin-top: 100px; /* Đảm bảo khi cuộn đến anchor không bị che bởi menu */
}

.category-header {
    background-color: var(--red-vietnam);
    color: #fff;
    padding: 10px 15px;
    border-radius: 8px;
    margin: 30px 0 -42px 0;
    font-size: 20px;
    text-align: center;
    display: block;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}


.sidebar_categories {
    width: 100%;
    position: relative;
    background: linear-gradient(120deg, #f8f9fa, #f2f4f7);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 25px;
    padding: 0 45px;
    overflow: hidden;
    border: 1px solid rgba(225, 230, 235, 0.8);
    text-align: center; /* Căn giữa toàn bộ nội dung */
}

    .sidebar_categories .carousel_items {
        display: flex;
        overflow-x: auto;
        padding: 18px 0;
        gap: 12px;
        scrollbar-width: none;
        -ms-overflow-style: none;
        justify-content: center; /* Căn giữa các item trên desktop */
        flex-wrap: wrap; /* Cho phép các item xuống dòng trên desktop */
    }

        .sidebar_categories .carousel_items::-webkit-scrollbar {
            display: none;
        }

    .sidebar_categories .category_item {
        min-width: 130px;
        padding: 12px 15px;
        background: #ffffff;
        text-align: center;
        border-radius: 8px;
        border: 1px solid #e8ecf0;
        transition: all 0.3s ease;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
        margin-bottom: 5px; /* Thêm khoảng cách giữa các dòng */
        display: flex; /* Thiết lập flex container */
        align-items: center; /* Căn giữa theo chiều dọc */
        justify-content: center; /* Căn giữa theo chiều ngang */
    }

        .sidebar_categories .category_item a {
            display: block;
            color: #445166 !important;
            text-decoration: none !important;
            font-size: 14px;
            font-weight: 500;
            transition: all 0.3s ease;
            width: 100%; /* Đảm bảo link chiếm toàn bộ không gian */
            text-align: center; /* Căn giữa văn bản */
            line-height: 1.2; /* Cải thiện khoảng cách dòng */
        }

        .sidebar_categories .category_item.active {
            background: linear-gradient(135deg, var(--red-vietnam), #9e0025);
            border-color: transparent;
            box-shadow: 0 4px 10px rgba(200, 16, 46, 0.3);
            transform: translateY(-2px);
        }

            .sidebar_categories .category_item.active a {
                color: #ffffff !important;
                font-weight: 600;
            }

        .sidebar_categories .category_item:hover:not(.active) {
            background-color: #f5f8ff;
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
            border-color: #ffeeba;
        }

        .sidebar_categories .category_item.active:hover {
            background: linear-gradient(135deg, #b70029, #850020);
        }

    .sidebar_categories .carousel_nav {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        width: 32px;
        height: 32px;
        background: #ffffff;
        border: none;
        border-radius: 50%;
        color: #445166;
        font-size: 14px;
        cursor: pointer;
        z-index: 2;
        display: flex; /* Sử dụng flex để căn giữa icon */
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
        transition: all 0.3s ease;
    }

        .sidebar_categories .carousel_nav:hover {
            background: #f0f4ff;
            color: var(--red-vietnam);
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
        }

        .sidebar_categories .carousel_nav.prev {
            left: 3px;
        }

        .sidebar_categories .carousel_nav.next {
            right: 3px;
        }

@media (min-width: 769px) {
    .sidebar_categories .carousel_items {
        justify-content: center;
        flex-wrap: wrap;
        overflow-x: visible; /* Cho phép hiển thị đầy đủ trên desktop */
    }

    .sidebar_categories .carousel_nav {
        display: none; /* Ẩn nút điều hướng trên desktop vì không cần cuộn */
    }
}

@media (max-width: 768px) {
    .sidebar_categories {
        padding: 0 40px;
        border-radius: 10px;
    }

        .sidebar_categories .carousel_items {
            flex-wrap: nowrap; /* Không xuống dòng trên mobile */
            justify-content: flex-start; /* Bắt đầu từ trái sang */
            overflow-x: auto; /* Cho phép cuộn ngang */
        }

        .sidebar_categories .category_item {
            min-width: 115px;
            padding: 8px 12px;
            margin-bottom: 0; /* Bỏ margin bottom trên mobile */
        }

        .sidebar_categories .carousel_nav {
            display: flex; /* Hiển thị nút điều hướng trên mobile */
            width: 30px;
            height: 30px;
        }
}

@media (max-width: 480px) {
    .sidebar_categories {
        padding: 0 35px;
        margin-bottom: 20px;
    }

        .sidebar_categories .category_item {
            min-width: 105px;
            padding: 8px 10px;
        }

        .sidebar_categories .carousel_items {
            padding: 15px 0;
            gap: 10px;
        }

        .sidebar_categories .carousel_nav {
            width: 28px;
            height: 28px;
            font-size: 12px;
        }
}
/* Thay đổi màu nền chính */
.product_section_container {
    background-color: var(--dark-vietnam);
    color: var(--cream-vietnam);
}

.sidebar_categories {
    background-color: var(--red-vietnam);
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 10px;
    max-height: 300px; /* Giới hạn chiều cao */
    overflow-y: auto; /* Thêm thanh cuộn dọc */
    overflow-x: hidden; /* Ẩn cuộn ngang nếu có */
}

    .sidebar_categories::-webkit-scrollbar {
        width: 8px; /* Độ rộng của thanh cuộn */
    }

    .sidebar_categories::-webkit-scrollbar-thumb {
        background-color: var(--yellow-vietnam); /* Màu của thanh cuộn */
        border-radius: 5px; /* Bo tròn góc */
    }

        .sidebar_categories::-webkit-scrollbar-thumb:hover {
            background-color: var(--dark-vietnam); /* Màu khi hover */
        }


    .sidebar_categories a {
        color: white !important;
        font-weight: bold;
    }


/* Style cho sidebar */


.sidebar_title h5 {
    color: var(--yellow-vietnam);
    font-family: "Roboto", sans-serif;
    border-bottom: 2px solid var(--yellow-vietnam);
    padding-bottom: 10px;
}

/* Style cho sản phẩm */
.product_filter {
    background-color: #fff;
    transition: all 0.3s ease;
}

    .product_filter:hover {
        transform: translateY(-5px);
        box-shadow: 0 5px 15px rgba(255, 205, 0, 0.3);
    }



.product_price {
    color: var(--yellow-vietnam);
}

/* Nút Add to Cart */
.red_button.add_to_cart_button {
    background-color: var(--red-vietnam);
    border-radius: 4px;
    transition: all 0.3s ease;
}

    .red_button.add_to_cart_button:hover {
        background-color: var(--yellow-vietnam);
        color: var(--dark-vietnam);
    }

/* Style cho breadcrumbs */
.breadcrumbs {
    padding: 10px 20px;
    border-radius: 4px;
    margin-bottom: 20px;
}

    .breadcrumbs a {
        color: var(--cream-vietnam);
    }

/* Style cho product sorting */
.product_sorting_container {
    background-color: #232323;
    padding: 15px;
    border-radius: 4px;
}

.type_sorting_text,
.num_sorting_text {
    color: var(--cream-vietnam);
}

/* Style cho favorite button */
.favorite {
    background-color: var(--grey-vietnam);
    color: var(--cream-vietnam);
}

    .favorite.active {
        background-color: var(--red-vietnam);
    }

/* Style cho sale badge */
.product_bubble_red {
    background-color: var(--red-vietnam);
}

/* Responsive adjustments */
@media (max-width: 767px) {
    .product-item {
        border-radius: 8px;
        margin-bottom: 20px;
    }

    .product_info {
        padding: 15px;
    }
}

/* Style cho pagination */
.page_current {
    background-color: var(--red-vietnam);
    color: var(--cream-vietnam);
}

.page_selection li a {
    color: var(--cream-vietnam);
    background-color: var(--grey-vietnam);
}

.product_image {
    width: 100%;
    height: 200px; /* Chiều cao cố định cho hình ảnh */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 10px;
}

    .product_image img {
        width: 100%;
        height: 100%;
        object-fit: cover; /* Giữ tỷ lệ ảnh và lấp đầy khung */
    }
/* Popup container */
.cart-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 350px;
    background-color: #ffffff;
    border: 2px solid var(--yellow-vietnam);
    border-radius: 8px;
    z-index: 9999;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

/* Animation khi hiển thị popup */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* Header popup */
.popup-header {
    background-color: #a80000;
    color: var(--cream-vietnam);
    padding: 15px;
    text-align: center;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    position: relative;
}

/* Nút đóng popup */
.close-popup {
    position: absolute;
    right: 15px;
    top: 4px;
    font-size: 18px;
    cursor: pointer;
    color: var(--cream-vietnam);
}

/* Nội dung popup */
.popup-content {
    padding: 20px;
    color: var(--cream-vietnam);
}

/* Thông tin sản phẩm */
.product-info {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.product-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 5px;
    margin-right: 15px;
}

.product-name {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 5px;
}

.product-price {
    color: var(--yellow-vietnam);
    font-size: 15px;
}

/* Bộ điều chỉnh số lượng */
.quantity-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
}

.quantity-btn {
    background-color: #ffef16;
    color: var(--cream-vietnam);
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

    .quantity-btn:hover {
        background-color: var(--red-vietnam);
    }

.quantity-input {
    width: 40px;
    height: 30px;
    text-align: center;
    margin: 0 10px;
    border: 1px solid var(--yellow-vietnam);
    color: var(--cream-vietnam);
    border-radius: 5px;
}

/* Footer popup */
.popup-footer {
    display: flex;
    justify-content: space-between;
    padding: 0 20px 20px;
}

.view-cart-btn, .continue-btn {
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.view-cart-btn {
    background-color: #dbcb44;
    color: var(--cream-vietnam);
}

    .view-cart-btn:hover {
        background-color: #a8001d;
    }

.continue-btn {
    background-color: #69a2f0;
    color: var(--cream-vietnam);
}

    .continue-btn:hover {
        background-color: #333333;
    }

/* Overlay */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9998;
}


/* CSS cho mobile */
@media (max-width: 767px) {
    .product-item {
        float: left;
        padding: 0 5px;
        margin-bottom: 15px;
    }

    .product_image {
        height: 180px; /* Chiều cao nhỏ hơn cho mobile */
    }

    .product_info {
        padding: 5px;
    }

    .product_name {
        font-size: 14px;
        color: var(--cream-vietnam);
        line-height: 1.4;
        text-align: center;
        height: 38px; /* Chiều cao cố định */
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .product_price {
        font-size: 15px;
    }

    .red_button.add_to_cart_button {
        text-align: center;
        margin-top: 10px;
        background-color: var(--red-vietnam);
        border-radius: 5px;
        color: #fff;
        padding: 8px 12px;
        font-size: 14px;
        transition: all 0.3s ease;
    }
}
/* Style cho nút Add to Cart khi đang loading */
.add_to_cart_button.loading a {
    position: relative;
    color: transparent !important;
}

    .add_to_cart_button.loading a::after {
        content: "";
        position: absolute;
        left: 50%;
        top: 50%;
        width: 20px;
        height: 20px;
        margin: -10px 0 0 -10px;
        border: 2px solid #fff;
        border-radius: 50%;
        border-top-color: transparent;
        animation: btnLoading 0.8s linear infinite;
    }

@keyframes btnLoading {
    to {
        transform: rotate(360deg);
    }
}

/* Sửa lỗi checkbox không hoạt động */
.additional-items-section {
    margin: 20px 0;
}

    .additional-items-section h4 {
        color: var(--yellow-vietnam);
        margin-bottom: 15px;
        font-size: 16px;
        font-weight: bold;
    }

.additional-items-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #333;
    border-radius: 5px;
    padding: 10px;
}

.additional-item {
    display: flex;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid #333;
    margin-bottom: 5px;
}

    .additional-item:last-child {
        border-bottom: none;
        margin-bottom: 0;
    }

.additional-item-image {
    width: 50px;
    height: 50px;
    border-radius: 4px;
    overflow: hidden;
    margin-right: 10px;
}

    .additional-item-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.additional-item-info {
    flex-grow: 1;
}

.additional-item-name {
    font-size: 14px;
    margin-bottom: 4px;
}

.additional-item-price {
    font-size: 13px;
    color: var(--yellow-vietnam);
}

/* Fix cho checkbox */
.additional-item-checkbox-wrapper {
    position: relative;
    width: 30px;
    height: 30px;
    margin-left: 10px;
}

/* Ẩn checkbox mặc định */
.additional-item-checkbox {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* Tạo checkbox tùy chỉnh */
.custom-checkbox {
    position: absolute;
    top: 0;
    left: 0;
    height: 22px;
    width: 22px;
    border: 2px solid var(--yellow-vietnam);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

    /* Khi hover vào label */
    .custom-checkbox:hover {
        background-color: #555;
    }

/* Khi checkbox được chọn */
.additional-item-checkbox:checked + .custom-checkbox {
    background-color: var(--red-vietnam);
    border-color: var(--red-vietnam);
}

/* Tạo dấu checkmark */
.custom-checkbox:after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Hiển thị dấu checkmark khi được chọn */
.additional-item-checkbox:checked + .custom-checkbox:after {
    display: block;
}
