
.custom-navbar {
    width: 1140px;
    max-width: 80%;
    margin: auto;
    height: 50px;
    display: flex;
    align-items: center;
    position: relative;
    z-index: 100;
    font-size: 15px;
}
.custom-navbar > div {
    display: flex;
    align-items: center;
    height: 100%;
}
.leftnavbar {
    flex: 2;
}
.centernavbar {
    flex: 8;
    justify-content: center;
}
.rightnavbar {
    flex: 2;
    justify-content: flex-end;
}
.custom-navbar a {
    color: #eee;
    margin: 0 10px;
    text-decoration: none;
    font-size: 15px;
    font-weight: bold; 
}
.custom-navbar a:last-child {
    margin-right: 0;
}
/* ...existing code... */

/* ...existing code... */
/* File: style.css */
header {
    position: sticky;
    top: 0;
    background: transparent;
    transition: background 0.3s;
    z-index: 1000;
    font-style: Mulish;
    /* XÓA DÒNG margin-bottom: -50px; NẾU CÒN */
}
/* File: style.css */

/* THAY THẾ CODE CŨ BẰNG CODE NÀY */

header.sticky {
    background: #FFFBF5; /* Đổi nền trắng thành màu be cho đồng bộ */
    /* Thêm bóng mờ tinh tế màu đỏ rượu thay vì màu đen */
    box-shadow: 0 4px 12px rgba(154, 63, 63, 0.15); 
}

header.sticky .custom-navbar a {
    color: #9A3F3F; /* Đổi màu chữ thành màu đỏ rượu */
}


.header {
    padding: 0 30px;
    position: sticky;
    top: 0;
    background: #fff;
    color: #000;
    border-bottom: 3px solid #c62828;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 85px;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.header:hover {
    background-color: #fff0f0;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
/* === CSS CHO DROPDOWN SUBMENU === */

/* 1. Thiết lập cho mục cha "CÂU CHUYỆN" */
.centernavbar .dropdown {
    position: relative; /* Rất quan trọng: làm "mỏ neo" cho submenu */
    display: inline-block; /* Giúp phần tử hoạt động tốt hơn */
}

/* 2. Style và ẨN submenu ở trạng thái mặc định */
.dropdown .submenu {
    list-style: none; /* Bỏ dấu chấm đầu dòng */
    padding: 15px 0;  /* Khoảng đệm bên trong */
    margin: 0;

    position: absolute;   /* Giúp submenu "nổi" lên trên trang */
    top: 100%;            /* Nằm ngay dưới mục cha */
    left: 50%;            /* Căn giữa so với mục cha */
    transform: translateX(-50%); /* Tinh chỉnh lại để nằm chính giữa */
    
    background: #FBDB93;  /* Nền màu be đồng bộ */
    border-radius: 8px;   /* Bo góc cho mềm mại */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); /* Đổ bóng nhẹ */
    width: 200px;         /* Đặt chiều rộng cố định cho submenu */

    /* Hiệu ứng ẩn/hiện */
    opacity: 0;           /* Mặc định làm mờ submenu */
    visibility: hidden;   /* Ẩn hoàn toàn, không thể click */
    transition: opacity 0.3s ease, visibility 0.3s ease; /* Hiệu ứng mượt mà */
}

/* 3. HIỆN submenu khi di chuột vào mục cha */
.dropdown:hover .submenu {
    opacity: 1;           /* Hiện rõ lại */
    visibility: visible;  /* Cho phép nhìn thấy và tương tác */
}

/* 4. Style cho các mục con bên trong submenu */
.submenu li a {
    display: block; /* Biến thẻ a thành khối để chiếm toàn bộ chiều rộng */
    padding: 10px 20px;
    color: #9A3F3F; /* Chữ màu đỏ rượu */
    text-decoration: none;
    transition: background-color 0.2s ease;
    text-align: left; /* Căn chữ về bên trái */
    white-space: nowrap; /* Ngăn chữ bị xuống dòng */
}

/* 5. Thêm hiệu ứng khi di chuột vào từng mục con */
.submenu li a:hover {
    background-color: #fbf0d3; /* Đổi màu nền khi di chuột vào */
}
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 28px;
    color: #c62828;
    cursor: pointer;
    transition: color 0.3s ease, transform 0.3s ease;
}

.menu-toggle:hover {
    color: #8b0000;
    transform: scale(1.1);
}

.header-left a .logo,
.footer-logo {
    height: 84px;
    width: auto;
    transition: transform 0.3s ease;
}

.header-left a .logo:hover,
.footer-logo:hover {
    transform: scale(1.08);
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    position: relative;
}

.header-center .menu {
    list-style: none;
    display: flex;
    gap: 56px;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 0.04em;
    color: #222;
    text-transform: uppercase;
    user-select: none;
    flex-wrap: wrap;
    transition: all 0.3s ease;
    position: relative;
}

.menu li {
    position: relative;
    cursor: pointer;
    padding: 8px 15px;
    border-radius: 10px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.menu li a {
    text-decoration: none;
    color: inherit;
    display: block;
    padding: 0;
}

.menu li:hover {
    background: #c62828;
    color: white;
    box-shadow: 0 3px 5px rgba(198, 40, 40, 0.5);
}

.dropdown {
    position: relative;
    list-style: none;
}

/* Mega Menu Styles (Desktop) */
.submenu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    width: 900px;
    max-width: calc(100vw - 80px);
    background-color: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
    z-index: 1000;
    pointer-events: none;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 25px;
    padding: 30px;
    box-sizing: border-box;
    border-radius: 12px;
}

.submenu li {
    padding: 0;
    white-space: normal;
}

.submenu li a {
    text-decoration: none;
    color: #333;
    display: block;
    padding: 8px 10px;
    transition: background-color 0.3s ease, color 0.3s ease;
    border-radius: 6px;
    font-weight: 500;
}

.submenu li a:hover {
    background-color: #f5f5f5;
    color: #b71c1c;
}

.dropdown:hover .submenu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

/* Arrow down icon for dropdown */
.menu li.dropdown::after {
    content: "▼";
    font-size: 10px;
    margin-left: 6px;
    color: #c62828;
    transition: transform 0.3s ease;
}

.menu li.dropdown:hover::after {
    transform: rotate(-180deg);
    color: #fff;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 32px;
}

.header-right a {
    
    text-decoration: none;
    font-size: 21px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: #c62828;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    box-shadow: 0 2px 8px rgba(198, 40, 40, 0.25);
    transition: background 0.3s ease, transform 0.3s ease, color 0.3s ease;
    /* Thêm vào đây để định vị số lượng giỏ hàng */
    position: relative; 
    gap: 5px;/* Quan trọng: Tạo ngữ cảnh cho position: absolute của .cart-amount */
}

.header-right a:hover {
    background: #c62828;
    color: #fff;
    transform: scale(1.15);
    box-shadow: 0 4px 14px rgba(198, 40, 40, 0.6);
}

.cart-amount {
    position: absolute;
    top: -5px; /* Điều chỉnh vị trí theo chiều dọc */
    right: -5px; /* Điều chỉnh vị trí theo chiều ngang */
    background-color: #ff0000; /* Màu nền đỏ nổi bật */
    color: #fff; /* Chữ màu trắng */
    font-size: 11px; /* Kích thước chữ nhỏ hơn */
    font-weight: bold;
    border-radius: 50%; /* Hình tròn */
    padding: 2px 6px; /* Khoảng cách bên trong */
    min-width: 18px; /* Đảm bảo đủ rộng cho số 1 chữ số */
    height: 18px; /* Đảm bảo đủ cao */
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); /* Đổ bóng nhẹ */
    z-index: 10; /* Đảm bảo nổi lên trên icon */
}
.cart-alert {
    position: fixed;
    top: 95px;
    right: 40px;
    z-index: 2000;
    background: #25d366;
    color: #fff;
    padding: 14px 36px;
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(40,40,40,0.12);
    font-weight: bold;
    font-size: 17px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s, transform 0.4s;
    transform: translateY(-20px);
}

.cart-alert.show {
    display: block;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(-20px);}
    15% { opacity: 1; transform: translateY(0);}
    85% { opacity: 1; transform: translateY(0);}
    100% { opacity: 0; transform: translateY(-20px);}
}

/* Responsive */
@media (max-width: 900px) {
    .header-center .menu {
        gap: 20px;
        font-size: 16px;
    }

    .header-right a {
        width: 34px;
        height: 34px;
        font-size: 18px;
    }

    .cart-amount {
        font-size: 10px; /* Nhỏ hơn trên mobile */
        top: -3px;
        right: -3px;
        min-width: 16px;
        height: 16px;
    }
}



/* === HIỆU ỨNG GẠCH CHÂN CHO NAVBAR === */

/* 1. Chuẩn bị cho thẻ a (rất quan trọng) */
.centernavbar a {
    position: relative;     /* Tạo khung tham chiếu cho gạch chân */
    padding-bottom: 8px;    /* Tạo chút không gian ở dưới cho gạch chân */
    text-decoration: none;  /* Bỏ gạch chân mặc định */
    /* Giữ lại màu chữ và transition mặc định của bạn */
}

/* 2. Tạo ra gạch chân "ảo" và ẩn nó đi */
.centernavbar a::after {
    content: ''; /* Bắt buộc phải có để pseudo-element hiện ra */
    position: absolute;
    bottom: 0; /* Nằm ở dưới cùng của thẻ a */
    left: 0;   /* Bắt đầu từ bên trái */
    
    width: 0;  /* Mặc định, gạch chân có chiều rộng bằng 0 (ẩn) */
    height: 2px; /* Độ dày của gạch chân */
    background-color: #58A4B0; /* Màu xanh dương bạn muốn */

    /* Hiệu ứng chiều rộng chạy mượt mà trong 0.3 giây */
    transition: width 0.3s ease-in-out; 
}

/* 3. HIỆN gạch chân khi di chuột (hover) VÀ cho link đang active */
.centernavbar a:hover::after,
.centernavbar a.active::after {
    width: 100%; /* Cho chiều rộng chạy hết 100% để hiện ra */
}

/* 4. (Tùy chọn) Đổi màu chữ khi di chuột cho đồng bộ */
/* Lưu ý: Áp dụng cho cả navbar thường và navbar khi cuộn (sticky) */
.custom-navbar a:hover,
.custom-navbar a.active {
    color: #58A4B0 !important; /* Dùng !important để ghi đè màu cũ nếu cần */
}

/* Khi navbar sticky, ta cũng muốn chữ có màu xanh khi active/hover */
header.sticky .custom-navbar a:hover,
header.sticky .custom-navbar a.active {
    color: #58A4B0 !important; 
}






/* === CSS SỬA LỖI HEADER TRÊN TRANG CHỦ === */
/* Xóa code header cũ và thay bằng toàn bộ khối này */

/* 1. Header MẶC ĐỊNH (cho các trang con) */
header {
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    background-color: #FFFBF5;
    box-shadow: 0 4px 12px rgba(154, 63, 63, 0.15);
}
header .custom-navbar a {
    color: #4D403D;
}

/* 2. Style ĐẶC BIỆT cho header ở Top Trang chủ */
body.homepage header {
    background-color: transparent;
    box-shadow: none;
}
body.homepage header .custom-navbar a {
    color: #eee;
}

/* 3. Style khi cuộn chuột (STICKY) - ĐÃ SỬA LỖI */
/*
 * SỬA LỖI: Thêm "body" vào trước để tăng độ ưu tiên,
 * giúp nó ghi đè được style trong suốt của trang chủ.
*/
body header.sticky {
    background-color: #FFFBF5;
    box-shadow: 0 4px 12px rgba(154, 63, 63, 0.15);
}
body header.sticky .custom-navbar a {
    color: #4D403D;
}

/* === Hiệu ứng gạch chân và active/hover (giữ nguyên) === */
.centernavbar a {
    position: relative;
    padding-bottom: 8px;
    text-decoration: none;
}
.centernavbar a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: #58A4B0;
    transition: width 0.3s ease-in-out;
}
.centernavbar a:hover::after,
.centernavbar a.active::after {
    width: 100%;
}

/* Active/Hover state cho chữ màu sáng trên trang chủ (khi chưa cuộn) */
body.homepage header:not(.sticky) .custom-navbar a:hover,
body.homepage header:not(.sticky) .custom-navbar a.active {
    color: #58A4B0 !important;
}

/* Sửa lỗi lệch dòng cho mục dropdown */
.centernavbar .dropdown {
    display: flex;
    align-items: center;
}