/* ============================================================
   MOBILE MENU (hamburger + drawer) — dành cho shop-header.php
   Thêm file này SAU shop.css / header.css hiện có, ví dụ:
   <link rel="stylesheet" href="assets/mobile-menu.css">
   ============================================================ */

/* ---------- Hamburger trigger ---------- */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: 1px solid var(--header-border, #eef0f3);
  background: #fff;
  border-radius: 10px;
  padding: 0;
  cursor: pointer;
  order: -1; /* luôn nằm ngoài cùng bên trái trên mobile */
}
.mobile-menu-btn .bar {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-dark, #1a1d29);
  border-radius: 2px;
  position: relative;
  transition: transform .2s ease, opacity .2s ease, background .2s ease;
}
.mobile-menu-btn .bar::before,
.mobile-menu-btn .bar::after {
  content: '';
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  background: var(--text-dark, #1a1d29);
  border-radius: 2px;
  transition: transform .2s ease, top .2s ease, opacity .2s ease;
}
.mobile-menu-btn .bar::before { top: -6px; }
.mobile-menu-btn .bar::after  { top: 6px; }

/* Icon -> X khi mở */
.mobile-menu-btn.is-active .bar { background: transparent; }
.mobile-menu-btn.is-active .bar::before { top: 0; transform: rotate(45deg); }
.mobile-menu-btn.is-active .bar::after  { top: 0; transform: rotate(-45deg); }

/* ---------- Overlay ---------- */
.mobile-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(13, 17, 28, 0.42);
  backdrop-filter: blur(1px);
  z-index: 300;
  opacity: 0;
  transition: opacity .2s ease;
}
.mobile-drawer-overlay.is-open {
  display: block;
  opacity: 1;
}

/* ---------- Drawer panel ---------- */
.mobile-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 84vw;
  max-width: 320px;
  background: #fff;
  z-index: 301;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform .25s ease;
  box-shadow: 8px 0 28px rgba(16, 24, 40, 0.18);
}
.mobile-drawer.is-open { transform: translateX(0); }

.mobile-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 14px;
  border-bottom: 1px solid var(--header-border, #eef0f3);
  flex-shrink: 0;
}
.mobile-drawer-head .brand { margin: 0; }

.mobile-drawer-close {
  width: 32px;
  height: 32px;
  border: none;
  background: #f6f7fb;
  border-radius: 50%;
  color: var(--text-dark, #1a1d29);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.mobile-drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px;
}

/* Account block inside drawer */
.mobile-drawer-account {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: #f6f7fb;
  border-radius: 12px;
  margin-bottom: 16px;
}
.mobile-drawer-account img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.mobile-drawer-account-info { min-width: 0; }
.mobile-drawer-account-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-dark, #1a1d29);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mobile-drawer-account-balance {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent, #6d5efc);
  margin-top: 1px;
}

.mobile-drawer-guest {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.mobile-drawer-guest a {
  flex: 1;
  text-align: center;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
}
.mobile-drawer-guest a:first-child {
  color: var(--text-dark, #1a1d29);
  background: #f6f7fb;
}
.mobile-drawer-guest a:last-child {
  background: var(--brand-grad, #6d5efc);
  color: #fff;
}

.mobile-drawer-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted, #7a7f8c);
  margin: 18px 0 8px;
}
.mobile-drawer-section-title:first-child { margin-top: 0; }

.mobile-drawer-links,
.mobile-drawer-cats {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mobile-drawer-links a,
.mobile-drawer-cats a,
.mobile-drawer-account-links a,
.mobile-drawer-account-links button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark, #1a1d29);
  text-decoration: none;
  border-radius: 9px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.mobile-drawer-links a:active,
.mobile-drawer-cats a:active,
.mobile-drawer-account-links a:active { background: #f6f7fb; }

.mobile-drawer-cats a.active {
  background: var(--accent, #6d5efc);
  color: #fff;
}

.mobile-drawer-account-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
}
.mobile-drawer-account-links .acc-logout { color: #e0333f; }

.mobile-drawer-divider {
  height: 1px;
  background: var(--header-border, #eef0f3);
  margin: 14px 0;
}

body.mobile-drawer-lock { overflow: hidden; }

/* ============================================================
   Chỉ bật hamburger + ẩn bớt phần tử gốc trên mobile
   ============================================================ */
@media (max-width: 768px) {
  .mobile-menu-btn { display: flex; }

  .cat-tabs-wrap { display: none; }
  .topbar-admin-link { display: none; }

  /* Ẩn logo/brand cạnh nút hamburger trên mobile */
  .shop-topbar-inner > .brand { display: none; }

  /* Hoán đổi: ô tìm kiếm ra trước, khối tài khoản ra sau,
     cùng hàng với nút hamburger */
  .shop-topbar-inner { flex-wrap: nowrap; }
  .mobile-menu-btn   { order: -2; }
  .shop-search       { order: -1; flex: 1 1 auto; }
  .shop-spacer       { display: none; }
  .account-menu,
  .guest-auth-links  { order: 1; }
}

@media (min-width: 769px) {
  .mobile-drawer-overlay,
  .mobile-drawer { display: none !important; }
}
