/*
 * VShop Header v6.0 — Mobile-First
 * Stripe-Inspired Premium E-commerce
 */

.gm-container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* === Header — 精密毛玻璃 === */
.gm-header {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  border-bottom: 1px solid #e5edf5;
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: all 0.2s ease;
}
.gm-header.scrolled {
  background: rgba(255, 255, 255, 0.96);
  box-shadow: rgba(50, 50, 93, 0.06) 0px 1px 4px, rgba(0, 0, 0, 0.04) 0px 1px 2px;
}
.gm-header-inner {
  display: flex;
  align-items: center;
  height: 56px;
  gap: 8px;
}

/* === Logo === */
.gm-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.gm-logo-icon svg { width: 28px; height: 28px; transition: transform .2s ease; }
.gm-logo:hover .gm-logo-icon svg { transform: scale(1.04); }
.gm-logo-img { height: 30px; max-width: 120px; width: auto; object-fit: contain; transition: opacity .2s ease; }
.gm-logo:hover .gm-logo-img { opacity: .88; }

/* === Nav — 移动端隐藏，桌面端显示 === */
.gm-nav { display: none; }
@media (min-width: 1024px) {
  .gm-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 0 1 auto;
    min-width: 0;
    overflow: visible;
    position: relative;
  }
}
.gm-nav-link {
  padding: 6px 12px;
  font-size: 14px; font-weight: 500;
  color: #061b31; border-radius: 4px;
  transition: all .2s ease; white-space: nowrap;
  position: relative; flex-shrink: 0;
}
.gm-nav-link:hover { color: #533afd; background: rgba(83, 58, 253, 0.04); }
.gm-nav-link.active { color: #533afd; font-weight: 600; }
.gm-nav-item-hidden { display: none !important; }

/* === 更多导航 === */
.gm-nav-more { display: none; position: relative; flex-shrink: 0; }
.gm-nav-more-btn {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 12px; font-size: 14px; font-weight: 500;
  color: #64748d; border-radius: 4px; cursor: pointer;
  background: none; border: none; transition: all .2s ease;
}
.gm-nav-more-btn:hover { color: #533afd; background: rgba(83, 58, 253, 0.04); }
.gm-nav-more-dropdown {
  display: none;
  position: absolute; top: 100%; right: 0;
  background: transparent; border: none; z-index: 200;
  min-width: 160px; padding: 0;
  animation: gmSubMenuIn .15s ease;
}
/* 视觉间距用 padding-top 实现，hover 区域无缝衔接 */
.gm-nav-more-dropdown > .gm-nav-more-inner {
  background: #fff; border: 1px solid #e5edf5; border-radius: 6px;
  box-shadow: rgba(50, 50, 93, 0.18) 0px 20px 40px -15px, rgba(0, 0, 0, 0.08) 0px 10px 20px -10px;
  padding: 4px;
}
.gm-nav-more.is-open .gm-nav-more-dropdown,
.gm-nav-more:hover .gm-nav-more-dropdown { display: block; }
.gm-nav-more-dropdown a {
  display: block; padding: 8px 12px; font-size: 13px;
  color: #64748d; border-radius: 4px; transition: all .15s ease; text-decoration: none;
}
.gm-nav-more-dropdown a:hover { background: rgba(83, 58, 253, 0.04); color: #061b31; }
.gm-nav-more-dropdown a.active { color: #533afd; font-weight: 600; }

/* === 子菜单 === */
.gm-nav > a { position: relative; }
.gm-nav-submenu {
  display: none; position: absolute; top: calc(100% + 6px); left: 0;
  background: #fff; border: 1px solid #e5edf5; border-radius: 6px;
  box-shadow: rgba(50, 50, 93, 0.18) 0px 20px 40px -15px, rgba(0, 0, 0, 0.08) 0px 10px 20px -10px;
  min-width: 180px; padding: 4px; z-index: 200;
  animation: gmSubMenuIn .15s ease;
}
@keyframes gmSubMenuIn {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}
.gm-nav > a:hover > .gm-nav-submenu { display: block; }
.gm-nav-submenu a {
  display: block; padding: 8px 12px; font-size: 13px; color: #64748d;
  border-radius: 4px; transition: all .15s ease;
}
.gm-nav-submenu a:hover { background: rgba(83, 58, 253, 0.04); color: #061b31; }

/* === Search — 移动端隐藏，桌面端显示 === */
.gm-search-wrap { flex-shrink: 0; display: none; }
@media (min-width: 640px) {
  .gm-search-wrap { display: block; }
}
.gm-search-form {
  display: flex; align-items: center;
  background: #f8fafb; border: 1px solid #e5edf5; border-radius: 6px;
  overflow: hidden; transition: all .2s ease; width: 180px;
}
@media (min-width: 1024px) {
  .gm-search-form { width: 220px; }
}
.gm-search-form:focus-within {
  border-color: #533afd;
  box-shadow: 0 0 0 2px rgba(83, 58, 253, 0.12);
  width: 280px; background: #fff;
}
.gm-search-icon { width: 16px; height: 16px; color: #64748d; margin: 0 10px; flex-shrink: 0; transition: color .2s ease; }
.gm-search-form:focus-within .gm-search-icon { color: #533afd; }
.gm-search-input {
  flex: 1; background: none; border: none; outline: none;
  color: #061b31; font-size: 13px; padding: 7px 10px 7px 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", sans-serif;
}
.gm-search-input::placeholder { color: #64748d; }

/* === Header right === */
.gm-header-right {
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0; margin-left: auto;
}
@media (min-width: 1024px) {
  .gm-header-right { gap: 8px; }
}

/* === User menu === */
.gm-user-menu { position: relative; }
.gm-user-trigger {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 8px; border-radius: 6px;
  cursor: pointer; transition: all .2s ease;
}
.gm-user-trigger:hover { background: rgba(0, 0, 0, 0.03); }
.gm-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #533afd, #7c3aed); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; transition: all .2s ease;
}
.gm-user-trigger:hover .gm-avatar { box-shadow: 0 0 0 2px rgba(83, 58, 253, 0.15); }
.gm-uname { display: none; font-size: 13px; color: #061b31; font-weight: 500; }
@media (min-width: 640px) {
  .gm-uname { display: inline; }
}
.gm-dropdown {
  display: none; position: absolute; top: calc(100% + 6px); right: 0;
  background: #fff; border: 1px solid #e5edf5; border-radius: 6px;
  box-shadow: rgba(50, 50, 93, 0.18) 0px 20px 40px -15px, rgba(0, 0, 0, 0.08) 0px 10px 20px -10px;
  min-width: 200px; z-index: 200; padding: 4px;
  animation: gmDropIn .15s ease;
}
@keyframes gmDropIn {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}
.gm-dropdown::before { content: ''; position: absolute; bottom: 100%; left: 0; right: 0; height: 8px; }
.gm-dropdown.is-open { display: block; }
.gm-drop-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 4px;
  font-size: 13px; color: #061b31; transition: all .15s ease;
}
.gm-drop-item svg { width: 16px; height: 16px; opacity: .5; transition: opacity .2s ease; }
.gm-drop-item:hover { background: #f6f9fc; color: #533afd; }
.gm-drop-item:hover svg { opacity: .8; }
.gm-drop-admin:hover { color: #533afd; }
.gm-drop-logout:hover { color: #c13515; }
.gm-drop-divider { height: 1px; background: #e5edf5; margin: 4px 0; }

/* === Cart === */
.gm-cart-btn {
  position: relative; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid #e5edf5; border-radius: 6px;
  color: #64748d; transition: all .2s ease;
}
.gm-cart-btn svg { width: 17px; height: 17px; }
.gm-cart-btn:hover { color: #533afd; border-color: #b9b9f9; background: rgba(83, 58, 253, 0.03); }
.gm-cart-badge {
  position: absolute; top: -4px; right: -4px;
  background: #533afd; color: #fff; font-size: 10px; font-weight: 600;
  padding: 1px 5px; border-radius: 4px; min-width: 16px; text-align: center;
}

/* === Notification bell === */
.gm-notif-btn {
  position: relative; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid #e5edf5; border-radius: 6px;
  color: #64748d; transition: all .2s ease; text-decoration: none;
}
.gm-notif-btn svg { width: 17px; height: 17px; }
.gm-notif-btn:hover { color: #ef4444; border-color: #fca5a5; background: rgba(239, 68, 68, 0.03); }
.gm-notif-badge {
  position: absolute; top: -6px; right: -6px;
  background: #ef4444; color: #fff; font-size: 10px; font-weight: 700;
  padding: 1px 5px; border-radius: 10px; min-width: 16px; text-align: center;
  line-height: 14px; box-shadow: 0 1px 3px rgba(239, 68, 68, 0.4);
  animation: gmNotifPulse 2s ease-in-out 1;
}
@keyframes gmNotifPulse {
  0% { transform: scale(1); } 30% { transform: scale(1.2); }
  60% { transform: scale(0.95); } 100% { transform: scale(1); }
}

/* === Auth buttons === */
.gm-auth-btns { display: flex; gap: 8px; }
.gm-btn-login {
  padding: 6px 14px; border: 1px solid #e5edf5; color: #061b31;
  border-radius: 4px; font-size: 13px; font-weight: 500;
  transition: all .2s ease; background: transparent;
}
.gm-btn-login:hover { background: #f6f9fc; border-color: #b9b9f9; }
.gm-btn-register {
  padding: 6px 14px; background: #533afd; color: #fff;
  border-radius: 4px; font-size: 13px; font-weight: 600;
  transition: all .2s ease; border: none;
}
.gm-btn-register:hover { background: #4434d4; box-shadow: rgba(50, 50, 93, 0.25) 0px 4px 12px; }

/* === Mobile toggle — 移动端/平板可见 === */
.gm-mobile-toggle {
  display: flex; flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 6px;
}
@media (min-width: 1024px) {
  .gm-mobile-toggle { display: none; }
}
.gm-mobile-toggle span {
  display: block; width: 18px; height: 2px;
  background: #061b31; border-radius: 2px; transition: all .2s ease;
  transform-origin: center;
}

/* === Toast === */
.gm-toast {
  position: fixed; top: 76px; left: 50%; transform: translateX(-50%);
  padding: 12px 20px; border-radius: 6px;
  z-index: 9999; font-size: 13px; font-weight: 500;
  animation: gmFadeIn .2s ease; border: 1px solid;
  display: flex; align-items: center; gap: 10px;
  backdrop-filter: blur(8px);
}
@media (max-width: 639px) {
  .gm-toast { left: 8px; right: 8px; transform: none; }
}
.gm-toast svg { width: 16px; height: 16px; flex-shrink: 0; }
.gm-toast-ok { background: rgba(21, 190, 83, 0.1); border-color: rgba(21, 190, 83, 0.3); color: #108c3d; box-shadow: rgba(21, 190, 83, 0.15) 0px 4px 12px; }
.gm-toast-err { background: rgba(193, 53, 21, 0.1); border-color: rgba(193, 53, 21, 0.3); color: #c13515; box-shadow: rgba(193, 53, 21, 0.15) 0px 4px 12px; }
@keyframes gmFadeIn {
  from { opacity:0; transform:translateX(-50%) translateY(-4px); }
  to { opacity:1; transform:translateX(-50%) translateY(0); }
}

/* ── Header mobile-first 增强 ── */
@media (min-width: 1024px) {
  .gm-header-inner { height: 60px; gap: 12px; }
  .gm-logo-img { height: 34px; max-width: 140px; }
  .gm-avatar { width: 30px; height: 30px; }
}
