/* ==========================================================================
   1. RESET & FONTS & LAYOUT
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
}

body {
    background-color: #f5ece4; 
    color: #333;
}

/* Độ rộng hiển thị nhất quán trên toàn trang */
.header-container,
.hero-slider,
.mini-promos,
.categories-grid,
.filter-bar,
.footer-info {
    max-width: 95% !important; 
    width: 95% !important;
    margin: 0 auto;
}

/* ==========================================================================
   2. HEADER & NAVIGATION (Đổi sang tông CAM SỮA NHẠT ngọt ngào)
   ========================================================================== */
.header {
    background: transparent;
    padding: 0;
}

.header-container {
    background: #ffb399; /* Màu CAM SỮA NHẠT dịu mắt, sáng và sang */
    color: #fff;
    padding: 10px 24px;
    border-radius: 0px; 
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    display: flex !important;
    flex-direction: row !important; 
    justify-content: space-between; 
    align-items: center; 
    flex-wrap: nowrap !important; 
}

.logo-area {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.main-logo {
    height: 48px !important; 
    width: auto;
    object-fit: contain;
}

.slogan {
    font-size: 10px;
    color: #ffcc00;
    margin-top: 5px;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.nav-menu {
    display: flex !important;
    flex-direction: row !important; 
    align-items: center;
    gap: 25px; 
    margin: 0 20px;
    flex-grow: 1; 
    justify-content: center; 
}

.nav-item {
    font-size: 13.5px;
    font-weight: 700;
    color: #ffffff !important; /* Đổi sang màu trắng tinh để tăng độ tương phản */
    text-decoration: none;
    text-transform: uppercase;
    padding: 6px 0;
    white-space: nowrap; 
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px; 
    
    /* Hiệu ứng đổ bóng mờ giúp chữ nổi bật lên khỏi nền cam sữa, không lo bị chìm */
    text-shadow: 1px 1px 2px rgba(186, 73, 41, 0.4); 
}

.nav-item i {
    font-size: 18px;
    /* Đổ bóng cho cả các icon đi kèm */
    filter: drop-shadow(1px 1px 1px rgba(186, 73, 41, 0.4));
}

.nav-item:hover, .nav-item.active {
    color: #ffffff !important;
    border-bottom: 2px solid #ffffff; 
    /* Khi active hoặc hover, hiệu ứng bóng sẽ rõ nét hơn một chút để tạo điểm nhấn */
    text-shadow: 1px 1px 3px rgba(136, 38, 12, 0.6);
}

.auth-buttons {
    display: flex !important;
    flex-direction: row !important; 
    gap: 10px;
    flex-shrink: 0; 
}

.btn {
    border: none;
    padding: 8px 16px;
    font-weight: 700;
    font-size: 12px;
    border-radius: 4px !important; 
    cursor: pointer;
    text-transform: uppercase;
    white-space: nowrap;
}

.btn-login {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.9);
    color: #fff;
}

.btn-login:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-register {
    background: #ffffff;
    color: #ff7347; /* Chữ màu cam sữa đậm trên nền nút trắng */
}

.btn-register:hover {
    background: #fff5f2;
}

/* ==========================================================================
   3. BANNER SLIDER & MINI PROMOS
   ========================================================================== */
.hero-slider {
    padding: 0 !important; 
    margin: 15px auto !important;
    position: relative; 
}

.slider-container {
    width: 100%;
    aspect-ratio: 1200 / 310 !important; 
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.slider-track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform .5s ease;
}

.slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: fill !important; 
}

.hero-slider .slider-arrow { 
    position: absolute !important;
    top: 50% !important; 
    transform: translateY(-50%) !important; 
    z-index: 10;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.85) !important;
    border: 1px solid #ffb399 !important; /* Đổi sang viền màu cam sữa */
    border-radius: 4px !important; 
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}


/* ĐỊNH VỊ HAI NÚT DI CHUYỂN SLIDE NẰM GIỮA HAI BÊN BANNER */
.hero-slider .prev-btn,
.hero-slider .next-btn { 
    position: absolute !important;
    top: 50% !important; 
    transform: translateY(-50%) !important; /* Luôn giữ nút nằm chính giữa chiều cao slide */
    z-index: 10;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.85) !important;
    border: 1px solid #ffb399 !important; /* Viền màu cam sữa nhạt */
    border-radius: 4px !important; 
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}


/* Nút quay lại nằm sát bên trái */
.hero-slider .prev-btn { 
    left: 10px !important; 
}

/* Nút kế tiếp nằm sát bên phải */
.hero-slider .next-btn { 
    right: 10px !important; 
}

/* Hiệu ứng khi di chuột vào nút */
.hero-slider .prev-btn:hover,
.hero-slider .next-btn:hover {
    background: #ffb399 !important; /* Đổi nền sang cam sữa */
    color: #fff !important; /* Chữ/Mũi tên chuyển sang trắng */
}

.slider-dots {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.dot {
    width: 10px;
    height: 10px;
    background: rgba(255,255,255,0.5);
    border-radius: 50%;
    cursor: pointer;
}

.dot.active {
    background: #ffcc00;
    width: 25px;
    border-radius: 10px;
}

.mini-promos {
    margin: 15px auto !important;
}

.promo-slider-container {
    width: 100%;
    overflow: hidden;   
    position: relative;
}

.promo-slider-track {
    display: flex;
    width: max-content; 
    gap: 15px;
    height: 90px !important; 
    align-items: center;
    animation: scrollInfinite 25s linear infinite; 
}

.promo-slider-track:hover {
    animation-play-state: paused;
}

.promo-btn-item {
    width: auto !important; 
    height: 90px !important; 
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    overflow: hidden;
    border-radius: 6px;
    flex-shrink: 0; 
}

.promo-btn-item img {
    width: 100%;
    height: 100%;
    object-fit: fill !important; 
    display: block;
    transition: transform 0.25s ease;
}

.promo-btn-item:hover img {
    transform: scale(1.04);
}

@keyframes scrollInfinite {
    0% { transform: translateX(0); }
    100% { transform: translateX(calc(-50% - 7.5px)); }
}

/* ==========================================================================
   4. 7 Ô DANH MỤC GRID (Tone Cam Sữa)
   ========================================================================== */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr) !important;
    margin: 20px auto !important;
    background: #fff;
    padding: 16px;
    border-radius: 4px;
    gap: 12px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.category-btn-card {
    width: 100% !important;
    background: #ffffff;
    border: 2px solid #ffe3da !important; /* Viền cam sữa siêu nhạt */
    border-radius: 4px !important;
    padding: 16px 8px; 
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 125px; 
    transition: all 0.2s ease;
}

.category-btn-card .icon-wrapper,
.category-btn-card img {
    height: 55px !important; 
    max-height: 55px !important;
    width: auto !important;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.category-btn-card p {
    font-family: 'Inter', sans-serif !important;
    font-size: 14px !important;       
    font-weight: 700 !important;       
    color: #ff7347 !important; /* Chữ màu cam sữa đậm */
    margin-top: 12px !important;
    text-align: center;
    width: 100%;
    white-space: nowrap;
    letter-spacing: 0.3px;             
}

.category-btn-card:hover {
    background: #fffbf9;
    border-color: #ffd0c2 !important;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(255, 115, 71, 0.12);
}

.category-btn-card:hover p {
    color: #e65c33 !important; 
}

.category-btn-card:hover .icon-wrapper {
    transform: scale(1.1);
}

/* Trạng thái danh mục khi ĐƯỢC CHỌN (Vẫn giữ màu đỏ nổi bật để nhấn mạnh) */
.category-btn-card.active {
    background: linear-gradient(180deg, #ff4d4d 0%, #e62e2e 100%) !important; 
    border-color: #e62e2e !important;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.1), 0 4px 12px rgba(230, 46, 46, 0.2) !important;
}

.category-btn-card.active p {
    color: #ffffff !important;            
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.category-btn-card.active .icon-wrapper img {
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2)) brightness(1.1);
}

/* ==========================================================================
   5. THANH LỌC TRẠNG THÁI & SẮP XẾP
   ========================================================================== */
.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 25px auto 20px auto !important; 
    background: #ffffff;
    padding: 12px 20px;
    border-radius: 30px; 
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
    border: 1px solid #ffe3da; 
}

.filter-status, .filter-sort {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-status span,
.filter-sort span {
    font-family: 'Inter', sans-serif !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #ff7347 !important; 
    letter-spacing: 0.3px;
}

/* Các nút khi CHƯA CHỌN */
.filter-btn, .sort-btn {
    border: 1px solid #ffe3da !important;
    padding: 8px 18px !important;
    border-radius: 20px !important;
    background: #fffbf9 !important; 
    color: #ff855e !important;      
    cursor: pointer;
    font-weight: 700 !important;
    font-size: 12px !important;
    font-family: 'Inter', sans-serif !important;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.25s ease !important;
}

/* Hiệu ứng khi di chuột qua nút chưa chọn */
.filter-btn:hover:not(.active),
.sort-btn:hover:not(.active) {
    background: #fff5f2 !important;
    color: #ff7347 !important;
    border-color: #ffd0c2 !important;
    transform: translateY(-1px);
}

/* Các nút khi ĐÃ ĐƯỢC CHỌN ACTIVE (Đỏ tươi bắt mắt) */
.filter-btn.active,
.sort-btn.active {
    background: linear-gradient(180deg, #ff4d4d 0%, #e62e2e 100%) !important; 
    color: #ffffff !important;
    border-color: #e62e2e !important;
    box-shadow: 0 3px 8px rgba(230, 46, 46, 0.25) !important;
}

/* ==========================================================================
   6. PRODUCTS GRID
   ========================================================================== */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    margin-bottom: 40px;
}

.product-card {
    background: #fff;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid #eee;
}

.product-img {
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.product-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.product-title {
    font-size: 13px;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
    height: 32px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-price {
    color: #d90429;
    font-weight: 800;
    font-size: 14px;
    margin-bottom: 5px;
}

.product-stock {
    font-size: 11px;
    margin-bottom: 12px;
}

.stock-in { color: #28a745; }
.stock-out { color: #fd7e14; }

.btn-detail {
    background: #e62e2e;
    color: #fff;
    border: none;
    width: 100%;
    padding: 8px 0;
    border-radius: 4px;
    font-weight: bold;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-detail:hover {
    background: #ff4d4d;
}

/* ==========================================================================
   7. FOOTER
   ========================================================================== */
.footer-info {
    background: #1a1a1a !important; 
    color: #fff;
    border-radius: 4px !important; 
    box-shadow: 0 -2px 10px rgba(0,0,0,0.15);
    margin: 30px auto 20px auto;
    padding: 18px 20px !important; 
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.footer-images {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;          
    margin-top: 5px;    
    margin-bottom: 18px; 
    width: 100%;
}

.footer-images img {
    max-width: 100%;
    height: auto;
    max-height: 75px !important; 
    object-fit: contain;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.7)); 
    transition: transform 0.3s ease;
}

.footer-images img:hover {
    transform: scale(1.02);
}

.footer-menu {
    display: flex;
    justify-content: center; 
    align-items: center;
    flex-wrap: wrap; 
    gap: 12px;
    margin-bottom: 12px; 
}

.footer-menu a {
    color: #cccccc !important; 
    font-weight: 700;
    font-size: 13px !important;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-menu span {
    color: rgba(255, 255, 255, 0.2); 
    font-weight: 300;
    user-select: none; 
}

.footer-menu a:hover {
    color: #ffb399 !important; /* Màu hover footer tiệp màu Cam Sữa mới */
}

.copyright {
    font-size: 11px;
    color: #666666 !important; 
    margin-top: 0px !important; 
    letter-spacing: 0.5px;
    width: 100%;
    text-align: center; 
}



/* ==========================================================================
   CẤU HÌNH RESPONSIVE MOBILE - CẬP NHẬT THEO YÊU CẦU MỚI
   ========================================================================== */
@media (max-width: 768px) {
    /* --- THỨ NHẤT: SỬA BANNER KHUYẾN MÃI KHÔNG CHẠY & BỊ MẤT NỬA ẢNH --- */
    .promo-slider-container {
        overflow: hidden !important;
        height: auto !important; /* Thay đổi từ khống chế cứng sang tự động theo ảnh */
        width: 100% !important;
    }

    .promo-slider-track {
        display: flex !important;
        flex-direction: row !important;
        width: max-content !important;
        gap: 12px !important;
        /* Kích hoạt animation chạy mượt sang trái y chang PC */
        animation: scrollInfinite 25s linear infinite !important; 
    }

    .promo-btn-item {
        /* Đảm bảo chiều rộng/cao cân đối tỷ lệ trên mobile, không ép pixel làm mất ảnh */
        width: 180px !important; 
        height: 60px !important;
        flex-shrink: 0 !important;
    }

    .promo-btn-item img {
        width: 100% !important;
        height: 100% !important;
        object-fit: fill !important; /* Bung full ảnh không lo mất nét hay mất hình */
    }


    /* --- THỨ HAI: CÂN BẰNG GRID CHỌN DANH MỤC QUÀ TẶNG (NẰM CHÍNH GIỮA) --- */
    .categories-grid {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important; /* Ép card và các ô nội dung nằm chính giữa khung hình */
        gap: 8px !important;
        padding: 12px !important;
        width: 95% !important;
        margin: 0 auto !important;
    }

    .category-btn-card {
        /* Chia tỉ lệ đều để các ô nằm gọn bên trong, cân đối 2 hàng */
        flex: 0 0 calc(25% - 8px) !important; 
        min-width: 75px !important;
        min-height: 80px !important;
        padding: 8px 4px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .category-btn-card .icon-wrapper,
    .category-btn-card img {
        height: 32px !important;
        width: auto !important;
    }

    .category-btn-card p {
        font-size: 10px !important;
        margin-top: 6px !important;
        white-space: normal !important; /* Tự xuống dòng chữ nếu quá dài, tránh tràn khung */
        text-align: center !important;
    }


    /* --- THỨ BA: MỤC LỌC TRẠNG THÁI & SẮP XẾP CÂN BẰNG GIỮA MÀN HÌNH --- */
    .filter-bar {
        flex-direction: column !important;
        align-items: center !important; /* Căn giữa toàn bộ card lọc */
        justify-content: center !important;
        gap: 16px !important;
        padding: 15px !important;
        border-radius: 16px !important;
        width: 95% !important;
        margin: 15px auto !important;
        text-align: center !important;
    }

    .filter-status, .filter-sort {
        flex-direction: column !important; /* Xuống dòng chữ tiêu đề và hàng nút */
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        gap: 8px !important;
    }

    /* Tiêu đề nằm chính giữa card */
    .filter-status > span, 
    .filter-sort > span {
        display: block !important;
        text-align: center !important;
        font-size: 13px !important;
        width: 100% !important;
        margin-bottom: 4px !important;
    }

    /* Hàng nút Trạng thái: 3 nút ngang bằng nhau (hoặc chia đều ôm sát) */
    .filter-status {
        display: flex !important;
    }
    
    /* Tạo vùng chứa riêng cho các nút để dễ căn ngang */
    .filter-status .filter-btn {
        flex: 1 !important;
        max-width: 30% !important; /* Chia đều không gian cho các nút ngang bằng nhau */
        justify-content: center !important;
        padding: 6px 4px !important;
        font-size: 10px !important;
        white-space: nowrap !important;
        text-align: center !important;
    }

    /* Hàng nút Sắp xếp: 2 nút ngang bằng nhau */
    .filter-sort .sort-btn {
        flex: 1 !important;
        max-width: 45% !important; /* 2 nút chiếm không gian cân bằng ngang nhau */
        justify-content: center !important;
        padding: 6px 8px !important;
        font-size: 11px !important;
        white-space: nowrap !important;
    }

    /* Đảm bảo flex-direction cho phần chứa nút luôn nằm ngang */
    .filter-status, .filter-sort {
        display: flex !important;
        flex-direction: row !important; 
        flex-wrap: wrap !important;
        justify-content: center !important;
    }


    /* --- THỨ TƯ: SỬA FOOTER - THU NHỎ KHOẢNG CÁCH DÒNG & PHÓNG TO ẢNH FULL CARD --- */
    .footer-info {
        padding: 12px 10px !important; /* Thu nhỏ padding ngoài */
        gap: 10px !important;
    }

    .footer-images {
        display: flex !important;
        flex-direction: column !important; /* Mỗi hình thành 1 hàng */
        gap: 8px !important; /* Khoảng cách giữa 2 hình cực nhỏ */
        width: 100% !important;
        margin-bottom: 10px !important;
    }

    .footer-images img {
        width: 96% !important; /* Phóng to ảnh bề ngang gần full card đen */
        max-width: 96% !important;
        height: auto !important;
        max-height: none !important; /* Bỏ giới hạn chiều cao cũ */
        object-fit: contain !important;
        margin: 0 auto !important;
    }

    /* Thu nhỏ khoảng cách giữa các dòng chữ menu footer */
    .footer-menu {
        gap: 4px 8px !important; /* Khoảng cách dòng và cột cực nhỏ sát nhau */
        margin-bottom: 6px !important;
        line-height: 1.2 !important;
    }

    .footer-menu a {
        font-size: 10px !important;
        padding: 2px 0 !important;
    }

    .footer-menu span {
        font-size: 9px !important;
    }

    .copyright {
        margin-top: 2px !important;
        font-size: 9.5px !important;
    }
}