/* =========================================
   1. VARIABLES & GLOBAL SETTINGS
   ========================================= */
:root {
    --m-yellow: #FFD166;
    --m-pink: #EF476F;
    --m-cyan: #06D6A0;
    --m-blue: #118AB2;
    --m-dark: #073B4C;
    --m-bg: #FDF9F1;
    --border-heavy: 3px solid var(--m-dark);
    --shadow-heavy: 6px 6px 0px var(--m-dark);
    --shadow-hover: 10px 10px 0px var(--m-pink);
    --easing-bouncy: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

body {
    font-family: 'Space Grotesk', sans-serif;
    background-color: var(--m-bg);
    color: var(--m-dark);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Reset Link Default */
a { text-decoration: none !important; color: inherit; }

.main-container { padding: 40px; max-width: 1200px; margin: 0 auto; }

/* =========================================
   2. NAVBAR (Site.master)
   ========================================= */
.navbar {
    background: #fff; border-bottom: var(--border-heavy); padding: 15px 40px;
    display: flex; justify-content: space-between; align-items: center;
    position: sticky; top: 0; z-index: 100;
}

.navbar h1 { 
    margin: 0; font-size: 28px; font-weight: 700; 
    color: var(--m-pink); text-transform: uppercase; letter-spacing: -1px; 
}

.icon-cart { 
    width: 28px; height: 28px; fill: var(--m-dark); 
    transition: transform 0.3s var(--easing-bouncy); cursor: pointer;
}

.icon-cart:hover { 
    transform: scale(1.2) rotate(-10deg); fill: var(--m-cyan); 
}

/* =========================================
   3. SHOP LAYOUT & OFFCANVAS FILTER (Shop.aspx)
   ========================================= */
/* =========================================
   3. SHOP LAYOUT & OFFCANVAS FILTER (Shop.aspx)
   ========================================= */

.shop-layout { display: grid; grid-template-columns: 250px 1fr; gap: 40px; }

/* DÒNG NÀY LÀ CHÌA KHÓA GIẢI QUYẾT MỌI VẤN ĐỀ TRÀN GIAO DIỆN */
.right-column {
    min-width: 0; /* Ép cột 1fr không được phình to vượt quá màn hình */
    width: 100%;
}

/* =========================================
   BRAND BAR (Thanh Thương hiệu)
   ========================================= */
.brand-bar-wrapper { margin-bottom: 30px; }
.brand-bar-title { font-size: 16px; font-weight: 800; color: var(--m-blue); text-transform: uppercase; margin-bottom: 15px; letter-spacing: 1px; }

.brand-scroll { 
    display: flex; 
    gap: 20px; 
    overflow-x: auto; 
    padding-bottom: 15px; 
    width: 100%; /* Đảm bảo thanh cuộn rộng bằng cột cha */
    
    /* Vuốt mượt trên điện thoại */
    -webkit-overflow-scrolling: touch; 
    scroll-behavior: smooth;
}

/* Custom thanh cuộn ngang Memphis */
.brand-scroll::-webkit-scrollbar { height: 8px; }
.brand-scroll::-webkit-scrollbar-track { background: var(--m-bg); border-radius: 4px; }
.brand-scroll::-webkit-scrollbar-thumb { background: var(--m-cyan); border-radius: 4px; border: 2px solid var(--m-bg); }

/* Chỉnh lại Brand Item */
.brand-item { 
    display: inline-flex !important; /* Dùng inline-flex cho thẻ a */
    flex-direction: column; 
    align-items: center; 
    
    /* KHÔNG CHO BÓP MÉO */
    flex: 0 0 auto !important; 
    width: 85px; /* Fix cứng chiều rộng để xếp hàng đẹp */
    
    cursor: pointer; 
    transition: transform 0.3s var(--easing-bouncy); 
}

.brand-item:hover { transform: translateY(-5px); }
.brand-item:hover .brand-img { box-shadow: 4px 4px 0px var(--m-pink); border-color: var(--m-pink); }

.brand-img { 
    width: 70px; height: 70px; border-radius: 50%; object-fit: cover; 
    border: 3px solid var(--m-dark); box-shadow: 4px 4px 0px var(--m-dark); 
    background: #fff; transition: all 0.3s; margin-bottom: 8px;
    flex-shrink: 0; /* Ảnh không bao giờ bị méo */
}

.brand-name { 
    font-size: 13px; font-weight: 700; color: var(--m-dark); text-align: center; 
    max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}


.shop-layout { display: grid; grid-template-columns: 250px 1fr; gap: 40px; }

.filter-box { 
    background: #fff; border: var(--border-heavy); box-shadow: var(--shadow-heavy); 
    padding: 20px; height: fit-content; transition: left 0.4s var(--easing-bouncy);
    
    /* BÍ KÍP GIÚP BỘ LỌC BAY THEO KHI SCROLL */
    position: sticky;
    top: 100px; /* Cách thanh Navbar ở trên một khoảng để không bị đè */
    z-index: 10; /* Đảm bảo nó nằm trên các thành phần khác nếu bị trôi ngang qua */
}


.filter-title { 
    font-size: 18px; font-weight: bold; border-bottom: 2px solid var(--m-dark); 
    padding-bottom: 10px; margin-bottom: 15px; 
}

.cat-btn { 
    display: block; width: 100%; text-align: left; background: none; border: none; 
    font-family: inherit; font-size: 16px; padding: 10px; cursor: pointer; 
    transition: background 0.2s; color: var(--m-dark) !important; 
}

.cat-btn:hover { background: var(--m-yellow); border: var(--border-heavy); font-weight: bold; }

/* Nút Bật tắt & Lớp phủ Mobile (Mặc định ẩn trên Desktop) */
.mobile-filter-bar { display: none; margin-bottom: 20px; }
.btn-toggle-filter { 
    background: var(--m-yellow); border: var(--border-heavy); font-family: inherit; 
    font-size: 16px; font-weight: bold; padding: 10px 20px; cursor: pointer; 
    display: flex; align-items: center; gap: 10px; box-shadow: 4px 4px 0px var(--m-dark); 
}
.btn-toggle-filter:active { transform: translate(2px, 2px); box-shadow: none; }
.btn-close-filter { 
    display: none; background: var(--m-pink); color: white; border: var(--border-heavy); 
    padding: 10px; width: 100%; font-family: inherit; font-weight: bold; cursor: pointer; 
    margin-bottom: 15px; 
}
.filter-overlay { 
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(7, 59, 76, 0.5); z-index: 1040; backdrop-filter: blur(2px); 
}

/* =========================================
   4. PRODUCT CARD (ProductCard.ascx)
   ========================================= */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 30px; }

.memphis-fun-card { 
    background: #fff; border: var(--border-heavy); 
    box-shadow: 6px 6px 0px var(--m-dark); 
    padding: 15px; display: flex; flex-direction: column; 
    position: relative; overflow: visible; /* Bắt buộc để Badge tràn ra ngoài */
    transition: all 0.3s var(--easing-bouncy); 
    animation: slideUp 0.6s backwards;
}

/* Badge Xéo xéo */
/* Offset & Delay Animation khi load trang */
@keyframes slideUp { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: translateY(0); } }

/* Cài đặt độ trễ cho từng thẻ (Hỗ trợ hiển thị mượt tới 16 sản phẩm) */
.memphis-fun-card:nth-child(1) { animation-delay: 0.1s; }
.memphis-fun-card:nth-child(2) { animation-delay: 0.2s; }
.memphis-fun-card:nth-child(3) { animation-delay: 0.3s; }
.memphis-fun-card:nth-child(4) { animation-delay: 0.4s; }
.memphis-fun-card:nth-child(5) { animation-delay: 0.5s; }
.memphis-fun-card:nth-child(6) { animation-delay: 0.6s; }
.memphis-fun-card:nth-child(7) { animation-delay: 0.7s; }
.memphis-fun-card:nth-child(8) { animation-delay: 0.8s; }
.memphis-fun-card:nth-child(9) { animation-delay: 0.9s; }
.memphis-fun-card:nth-child(10) { animation-delay: 1.0s; }
.memphis-fun-card:nth-child(11) { animation-delay: 1.1s; }
.memphis-fun-card:nth-child(12) { animation-delay: 1.2s; }
.memphis-fun-card:nth-child(13) { animation-delay: 1.3s; }
.memphis-fun-card:nth-child(14) { animation-delay: 1.4s; }
.memphis-fun-card:nth-child(15) { animation-delay: 1.5s; }
.memphis-fun-card:nth-child(16) { animation-delay: 1.6s; }

/* Hiệu ứng múa lửa khi Hover */
.memphis-fun-card:hover {
    transform: translateY(-8px) rotate(-1.5deg); /* Vừa nảy lên vừa xoay nhẹ */
    box-shadow: 12px 12px 0px var(--m-pink); /* Đổi màu đổ bóng */
}
.memphis-fun-card:hover .memphis-badge { transform: rotate(-5deg) scale(1.1); background: var(--m-yellow); }
.memphis-fun-card:hover .prod-img { transform: scale(1.05); }

.img-wrapper { 
    overflow: hidden; border: var(--border-heavy); border-bottom-width: 5px; 
    margin-bottom: 15px; background: var(--m-bg); 
}
.prod-img { width: 100%; height: 250px; object-fit: cover; display: block; transition: transform 0.4s ease; }

.prod-cat { font-size: 12px; font-weight: 800; color: var(--m-blue); text-transform: uppercase; letter-spacing: 1px;}
.prod-name { font-size: 18px; font-weight: 700; margin: 5px 0 15px 0; flex-grow: 1; line-height: 1.3;}
.prod-price { font-size: 22px; font-weight: 900; color: var(--m-pink); margin-bottom: 15px;}

.memphis-btn-fun { 
    background: var(--m-yellow); border: var(--border-heavy); font-family: inherit; font-size: 16px; 
    font-weight: bold; padding: 12px; cursor: pointer; transition: all 0.2s; 
    display: flex; align-items: center; justify-content: center; gap: 10px;
    text-decoration: none !important; color: var(--m-dark) !important;
    box-shadow: 4px 4px 0px var(--m-dark);
}
.memphis-btn-fun:hover { background: var(--m-cyan); }
.memphis-btn-fun:active { transform: translate(4px, 4px); box-shadow: none; }

/* =========================================
   5. USER CONTROLS (ToastControl & ModalConfirm)
   ========================================= */
/* Toast */
.memphis-toast {
    visibility: hidden; min-width: 250px; background-color: #fff;
    color: var(--m-dark); text-align: left; font-weight: 600;
    border: var(--border-heavy); box-shadow: 4px 4px 0px var(--m-dark);
    padding: 16px; position: fixed; z-index: 1000; right: 30px; top: 30px;
    transform: translateX(120%); transition: transform 0.5s var(--easing-bouncy);
}
.memphis-toast.show { visibility: visible; transform: translateX(0); }
.toast-error { border-color: var(--m-pink); box-shadow: 4px 4px 0px var(--m-pink); }
.toast-success { border-color: var(--m-cyan); box-shadow: 4px 4px 0px var(--m-cyan); }

/* Modal */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(7, 59, 76, 0.4); backdrop-filter: blur(4px); z-index: 999;
    justify-content: center; align-items: center;
}
.modal-content {
    background: #fff; border: var(--border-heavy); box-shadow: var(--shadow-heavy);
    padding: 30px; width: 350px; text-align: center;
    transform: scale(0.8); transition: transform 0.4s var(--easing-bouncy);
}
.modal-overlay.active { display: flex; }
.modal-overlay.active .modal-content { transform: scale(1); }
.btn-close {
    background: var(--m-yellow); border: var(--border-heavy); font-family: inherit; 
    font-weight: bold; padding: 10px 20px; cursor: pointer; margin-top: 20px; 
    color: var(--m-dark) !important;
}
.btn-close:active { transform: translate(2px, 2px); box-shadow: none; }

/* =========================================
   6. RESPONSIVE (Tablet & Mobile)
   ========================================= */
/* Tablet (Dưới 992px) */
@media (max-width: 991px) {
    .shop-layout { grid-template-columns: 1fr; }
    .mobile-filter-bar { display: block; } /* Hiện nút gọi lọc */
    
    /* Biến Filter Box thành Offcanvas */
    .filter-box {
        position: fixed; top: 0; left: -100%; width: 280px; height: 100vh;
        overflow-y: auto; z-index: 1050; border-radius: 0; border: none;
        border-right: var(--border-heavy);
    }
    .filter-box.active { left: 0; }
    .btn-close-filter { display: block; }
    .filter-overlay.active { display: block; }
    
    /* Cho Tablet hiện 3 cột, nếu hẹp thì 2 cột */
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

/* Mobile Nhỏ (Dưới 576px) */
@media (max-width: 575px) {
    .navbar { padding: 15px 20px; }
    .main-container { padding: 15px; }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 15px; }
    
    /* Tối ưu Card cho màn hình nhỏ */
    .prod-img { height: 180px; }
    .prod-name { font-size: 15px; }
    .prod-price { font-size: 18px; }
    .memphis-btn-fun { padding: 10px; font-size: 14px; }
    .memphis-badge { font-size: 12px; padding: 3px 10px; top: -10px; right: -10px; }
}


/* =========================================
   CART ANIMATION & BADGE (GIỎ HÀNG)
   ========================================= */
.cart-icon-wrapper { position: relative; display: inline-block; cursor: pointer; }

/* Chấm đỏ đếm số lượng (Badge) */
.cart-badge {
    position: absolute; top: -8px; right: -10px;
    background-color: var(--m-pink); color: #fff;
    font-family: 'Space Grotesk', sans-serif; font-weight: 900; font-size: 12px;
    min-width: 20px; height: 20px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--m-dark); box-shadow: 2px 2px 0px var(--m-dark);
    z-index: 10; transition: all 0.3s;
}

/* Hiệu ứng nảy (Bounce) khi có hàng mới bay vào */
@keyframes cartBounce {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.3) rotate(-15deg); }
    50%  { transform: scale(0.9) rotate(10deg); }
    70%  { transform: scale(1.15) rotate(-5deg); }
    100% { transform: scale(1); }
}

.cart-animating { animation: cartBounce 0.6s var(--easing-bouncy); }
.cart-badge.pulse { animation: cartBounce 0.5s ease-in-out; background-color: var(--m-yellow); color: var(--m-dark); }


/* =========================================
   CART PAGE (Cart.aspx)
   ========================================= */
.cart-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 40px; margin-top: 20px; }

/* Box danh sách sản phẩm */
.cart-items-box { background: #fff; border: var(--border-heavy); box-shadow: var(--shadow-heavy); padding: 20px; }
.cart-header { font-size: 24px; font-weight: 800; color: var(--m-pink); border-bottom: 3px solid var(--m-dark); padding-bottom: 15px; margin-bottom: 20px; text-transform: uppercase; }

/* Từng dòng sản phẩm */
.cart-item { display: flex; align-items: center; gap: 20px; padding: 15px 0; border-bottom: 2px dashed var(--m-dark); transition: background 0.3s; }
.cart-item:last-child { border-bottom: none; }
.cart-item:hover { background: var(--m-bg); }

.cart-item-img { width: 100px; height: 100px; object-fit: cover; border: 2px solid var(--m-dark); box-shadow: 3px 3px 0px var(--m-dark); background: #fff; }
.cart-item-info { flex-grow: 1; }
.cart-item-name { font-size: 18px; font-weight: 700; color: var(--m-dark); margin: 0 0 5px 0; }
.cart-item-price { font-size: 16px; font-weight: 700; color: var(--m-blue); }

/* Nút Tăng giảm số lượng */
.qty-control { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.qty-btn { background: var(--m-yellow); border: 2px solid var(--m-dark); width: 30px; height: 30px; font-weight: 900; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 2px 2px 0px var(--m-dark); transition: all 0.2s; }
.qty-btn:active { transform: translate(2px, 2px); box-shadow: none; }
.qty-number { font-size: 18px; font-weight: 800; width: 30px; text-align: center; }

.cart-item-total { font-size: 20px; font-weight: 900; color: var(--m-pink); min-width: 120px; text-align: right; }

/* Nút xóa */
.btn-remove-item { background: none; border: none; cursor: pointer; padding: 10px; transition: transform 0.2s; }
.btn-remove-item:hover { transform: scale(1.2) rotate(10deg); }

/* Box Tổng tiền (Summary) */
.cart-summary-box { background: var(--m-cyan); border: var(--border-heavy); box-shadow: var(--shadow-heavy); padding: 25px; height: fit-content; position: sticky; top: 100px; }
.summary-title { font-size: 22px; font-weight: 800; color: var(--m-dark); border-bottom: 3px solid var(--m-dark); padding-bottom: 15px; margin-bottom: 20px; }
.summary-row { display: flex; justify-content: space-between; font-size: 18px; font-weight: 700; margin-bottom: 15px; }
.summary-total { font-size: 24px; font-weight: 900; color: var(--m-pink); margin-top: 10px; padding-top: 15px; border-top: 3px solid var(--m-dark); }

.btn-checkout { background: var(--m-pink); color: #fff; border: var(--border-heavy); width: 100%; font-family: inherit; font-size: 18px; font-weight: 900; padding: 15px; margin-top: 25px; cursor: pointer; box-shadow: 4px 4px 0px var(--m-dark); transition: transform 0.2s; text-align: center; display: block; }
.btn-checkout:active { transform: translate(4px, 4px); box-shadow: none; }
.btn-checkout:hover { background: var(--m-yellow); color: var(--m-dark); }

/* Responsive Cart */
@media (max-width: 991px) {
    .cart-layout { grid-template-columns: 1fr; }
    .cart-summary-box { position: static; }
}
@media (max-width: 575px) {
    .cart-item { flex-direction: column; align-items: flex-start; position: relative; }
    .cart-item-img { width: 100%; height: 200px; }
    .cart-item-total { text-align: left; margin-top: 10px; }
    .btn-remove-item { position: absolute; top: 10px; right: 0; background: #fff; border: 2px solid var(--m-dark); border-radius: 50%; box-shadow: 2px 2px 0px var(--m-dark); }
}



/* =========================================
   CHECKOUT PAGE (Checkout.aspx)
   ========================================= */
.checkout-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 40px; margin-top: 20px; }

/* Form nhập liệu Memphis */
.checkout-form-box { background: #fff; border: var(--border-heavy); box-shadow: var(--shadow-heavy); padding: 30px; }
.checkout-title { font-size: 24px; font-weight: 900; color: var(--m-blue); border-bottom: 3px solid var(--m-dark); padding-bottom: 15px; margin-bottom: 25px; text-transform: uppercase; }

.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 16px; font-weight: 800; color: var(--m-dark); margin-bottom: 8px; }

.memphis-input { 
    width: 100%; padding: 12px 15px; font-family: 'Space Grotesk', sans-serif; font-size: 16px; font-weight: 600;
    color: var(--m-dark); background: var(--m-bg); border: 2px solid var(--m-dark); 
    box-shadow: 3px 3px 0px var(--m-dark); transition: all 0.2s; outline: none; box-sizing: border-box;
}
.memphis-input:focus { background: #fff; box-shadow: 5px 5px 0px var(--m-yellow); border-color: var(--m-pink); }

.memphis-select { cursor: pointer; appearance: none; background-image: url('data:image/svg+xml;utf8,<svg fill="%23073B4C" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>'); background-repeat: no-repeat; background-position-x: 98%; background-position-y: 50%; }

/* Grid chia 2 cột cho form */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* Box tóm tắt đơn hàng (dùng lại CSS từ Cart, chỉ chỉnh nhẹ) */
.checkout-summary-box { background: var(--m-yellow); border: var(--border-heavy); box-shadow: var(--shadow-heavy); padding: 25px; height: fit-content; position: sticky; top: 100px; }

@media (max-width: 991px) {
    .checkout-layout { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; gap: 0; }
    .checkout-summary-box { position: static; }
}

/* =========================================
   USER ACCOUNT & DROPDOWN MENU
   ========================================= */
.user-account-wrapper { position: relative; display: flex; align-items: center; gap: 15px; }

/* Nút đăng nhập khi chưa vào acc */
.nav-login-link {
    font-weight: 800; color: var(--m-dark); border: 2px solid var(--m-dark);
    padding: 8px 15px; background: var(--m-cyan); box-shadow: 3px 3px 0px var(--m-dark);
    transition: all 0.2s;
}
.nav-login-link:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0px var(--m-dark); }

/* Avatar Container */
.user-menu-container { position: relative; cursor: pointer; padding: 5px; }
.user-avatar { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--m-dark); background: #fff; display: block; }

/* Dropdown Menu Memphis */
.dropdown-menu {
    position: absolute; top: 100%; right: 0; width: 220px;
    background: #fff; border: var(--border-heavy); box-shadow: 8px 8px 0px var(--m-dark);
    display: none; flex-direction: column; z-index: 1000; margin-top: 10px;
    animation: slideUp 0.3s var(--easing-bouncy);
}

.user-menu-container:hover .dropdown-menu { display: flex; }

.dropdown-header { 
    background: var(--m-pink); color: #fff; padding: 12px; 
    font-weight: 800; text-align: center; border-bottom: var(--border-heavy);
}

.dropdown-menu a, .dropdown-menu .logout-btn {
    padding: 12px 15px; font-weight: 700; color: var(--m-dark);
    text-decoration: none; border-bottom: 2px dashed var(--m-dark);
    transition: background 0.2s; text-align: left; background: none; width: 100%; border-left: none; border-right: none;
}
.dropdown-menu a:hover, .dropdown-menu .logout-btn:hover { background: var(--m-yellow); }
.dropdown-menu a:last-child { border-bottom: none; }

/* Màu đặc biệt cho Admin/Pos */
.menu-admin { color: var(--m-pink) !important; }
.menu-pos { color: var(--m-blue) !important; }
