/* =========================================================
   AETHER 交互组件样式（抽屉 / 弹窗 / 搜索 / 提示）
   依赖 colors_and_type_v2.css 中的设计变量
   ========================================================= */

/* 滚动锚点：为固定导航预留偏移 */
section[id] { scroll-margin-top: 88px; }

/* ---------- 遮罩层 ---------- */
#overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(10, 10, 10, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
#overlay.show { opacity: 1; pointer-events: auto; }

/* ---------- Toast 轻提示 ---------- */
#toastContainer {
  position: fixed; top: 88px; left: 50%; transform: translateX(-50%);
  z-index: 400; display: flex; flex-direction: column; gap: 10px;
  align-items: center; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 8px;
  background: #0A0A0A; color: #FAFAF7;
  padding: 12px 22px; border-radius: 999px;
  font-size: 14px; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(-12px);
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast svg { width: 16px; height: 16px; color: #10B981; flex-shrink: 0; }
.toast-info svg { color: #818CF8; }

/* ---------- 通用小按钮 ---------- */
.qty-btn {
  width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--brand-border); background: var(--brand-card);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  color: var(--brand-foreground); transition: all 0.2s; flex-shrink: 0; padding: 0;
}
.qty-btn:hover { border-color: var(--brand-primary); color: var(--brand-primary); }

.drawer-close {
  background: var(--brand-muted); border: none;
  width: 36px; height: 36px; border-radius: 50%;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--brand-muted-foreground); transition: all 0.2s; padding: 0; flex-shrink: 0;
}
.drawer-close:hover { background: var(--brand-foreground); color: var(--brand-background); }

/* ---------- 购物车抽屉 ---------- */
.cart-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 420px; max-width: 100vw;
  background: var(--brand-card); z-index: 210;
  transform: translateX(105%);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-xl);
}
.cart-drawer.open { transform: translateX(0); }

.drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 28px; border-bottom: 1px solid var(--brand-border);
}
.drawer-header h3 {
  font-family: 'Space Grotesk', sans-serif; font-weight: 700;
  font-size: 20px; display: flex; align-items: center; gap: 10px; margin: 0;
}
.drawer-body { flex: 1; overflow-y: auto; padding: 8px 28px; }

.cart-item {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 18px 0; border-bottom: 1px solid var(--brand-border);
}
.cart-item img { width: 76px; height: 76px; object-fit: cover; border-radius: 12px; flex-shrink: 0; }
.ci-info { flex: 1; min-width: 0; }
.ci-name { font-weight: 600; font-size: 14px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-price { font-size: 13px; color: var(--brand-primary); font-weight: 600; margin-bottom: 10px; }
.ci-qty { display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 600; }
.ci-remove {
  align-self: flex-start; color: var(--brand-muted-foreground);
  background: none; border: none; cursor: pointer; padding: 4px; transition: color 0.2s;
}
.ci-remove:hover { color: var(--state-error); }

.drawer-footer { padding: 20px 28px 26px; border-top: 1px solid var(--brand-border); }
.subtotal-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.subtotal-row .label { font-size: 14px; color: var(--brand-muted-foreground); }
.subtotal-row .value { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 24px; }
.checkout-btn { width: 100%; justify-content: center; }
.ship-note { text-align: center; font-size: 12px; color: var(--brand-muted-foreground); margin: 12px 0 0; }

/* 免运费进度条 */
.ship-progress { margin-bottom: 16px; }
.ship-track { height: 4px; background: var(--brand-muted); border-radius: 999px; overflow: hidden; }
.ship-fill { height: 100%; width: 0; background: linear-gradient(90deg, #4F46E5, #10B981); border-radius: 999px; transition: width 0.4s ease; }
.ship-text { font-size: 12px; color: var(--brand-muted-foreground); margin: 6px 0 0; }
.ship-text b { color: var(--brand-primary); }

/* 空购物车 */
.empty-cart { text-align: center; padding: 70px 20px; color: var(--brand-muted-foreground); }
.empty-cart svg { width: 48px; height: 48px; margin-bottom: 16px; opacity: 0.35; }

/* ---------- 搜索面板（自带遮罩，独立于 #overlay） ---------- */
.search-overlay { position: fixed; inset: 0; z-index: 210; display: none; }
.search-overlay.open { display: block; }
.search-backdrop {
  position: absolute; inset: 0;
  background: rgba(10, 10, 10, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.search-panel {
  position: relative;
  background: var(--brand-card); box-shadow: var(--shadow-xl);
  border-radius: 0 0 28px 28px;
  max-height: 82vh; overflow-y: auto;
}
.search-overlay.open .search-panel { animation: search-drop 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes search-drop { from { transform: translateY(-24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.search-input-row {
  display: flex; align-items: center; gap: 14px;
  padding: 22px 32px; border-bottom: 1px solid var(--brand-border);
}
.search-input-row > svg { width: 20px; height: 20px; color: var(--brand-muted-foreground); flex-shrink: 0; }
#searchInput {
  flex: 1; border: none; outline: none; font-size: 17px;
  background: transparent; color: var(--brand-foreground);
  font-family: 'Inter', sans-serif; min-width: 0;
}
#searchInput::placeholder { color: var(--brand-muted-foreground); }

.search-results { padding: 22px 32px 32px; }
.sr-label {
  font-size: 12px; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--brand-muted-foreground); margin-bottom: 14px;
}
.hot-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  padding: 8px 18px; border-radius: 999px;
  background: var(--brand-muted); border: 1px solid var(--brand-border);
  font-size: 13px; cursor: pointer; transition: all 0.2s;
  color: var(--brand-foreground); font-family: 'Inter', sans-serif;
}
.chip:hover { border-color: var(--brand-primary); color: var(--brand-primary); }

.search-result-item {
  display: flex; align-items: center; gap: 16px;
  padding: 12px; border-radius: 14px; cursor: pointer; transition: background 0.2s;
}
.search-result-item:hover { background: var(--brand-muted); }
.search-result-item img { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.sr-name { font-weight: 600; font-size: 14px; }
.sr-desc { font-size: 12px; color: var(--brand-muted-foreground); margin-top: 2px; }
.sr-price { margin-left: auto; font-weight: 700; color: var(--brand-primary); font-size: 14px; white-space: nowrap; }
.sr-empty { text-align: center; padding: 36px 0; color: var(--brand-muted-foreground); font-size: 14px; }

/* ---------- 通用弹窗 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 220;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
}
.modal.open { opacity: 1; pointer-events: auto; }
.modal-card {
  background: var(--brand-card); border-radius: var(--brand-radius-lg);
  box-shadow: var(--shadow-xl); width: 100%;
  max-height: 90vh; overflow-y: auto;
  transform: scale(0.96) translateY(10px);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  position: relative;
}
.modal.open .modal-card { transform: scale(1) translateY(0); }
.modal-close {
  position: absolute; top: 16px; right: 16px; z-index: 5;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--brand-muted); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--brand-muted-foreground); transition: all 0.2s; padding: 0;
}
.modal-close:hover { background: var(--brand-foreground); color: var(--brand-background); }

/* ---------- 商品详情弹窗 ---------- */
.product-modal-card { max-width: 900px; }
.pm-grid { display: grid; grid-template-columns: 1fr 1fr; }
.pm-image { padding: 24px; }
.pm-image img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--brand-radius-lg); display: block; }
.pm-info { padding: 36px 36px 32px 12px; display: flex; flex-direction: column; }
.pm-title { font-family: 'Space Grotesk', sans-serif; font-size: 30px; font-weight: 700; margin: 12px 0 6px; letter-spacing: -0.02em; }
.pm-desc { font-size: 14px; color: var(--brand-muted-foreground); margin: 0 0 12px; }
.pm-rating { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--brand-muted-foreground); margin-bottom: 12px; }
.pm-price { display: flex; align-items: baseline; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.pm-price .cur { font-family: 'Space Grotesk', sans-serif; font-size: 32px; font-weight: 700; }
.pm-price .old { text-decoration: line-through; color: var(--brand-muted-foreground); font-size: 15px; }
.pm-price .off { color: var(--state-error); font-size: 13px; font-weight: 600; background: rgba(239, 68, 68, 0.08); padding: 3px 10px; border-radius: 999px; }
.pm-features { list-style: none; padding: 0; margin: 0 0 20px; display: flex; flex-direction: column; gap: 10px; }
.pm-features li { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--brand-muted-foreground); }
.pm-features svg { width: 15px; height: 15px; color: var(--brand-primary); flex-shrink: 0; }
.pm-actions { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.pm-qty { display: flex; align-items: center; gap: 12px; border: 1px solid var(--brand-border); border-radius: 999px; padding: 6px 10px; }
.pm-qty span { min-width: 22px; text-align: center; font-weight: 600; font-size: 15px; }
.pm-add { flex: 1; justify-content: center; }
.pm-note { font-size: 12px; color: var(--brand-muted-foreground); text-align: center; margin: 0; }

/* ---------- 结算 / 登录弹窗 ---------- */
.co-wrap { padding: 36px; }
.co-title { font-family: 'Space Grotesk', sans-serif; font-size: 24px; font-weight: 700; margin: 0 0 4px; }
.co-sub { font-size: 13px; color: var(--brand-muted-foreground); margin: 0 0 24px; }
.co-items { background: var(--brand-muted); border-radius: 14px; padding: 6px 16px; margin-bottom: 24px; max-height: 180px; overflow-y: auto; }
.co-item { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--brand-border); font-size: 13px; }
.co-item:last-child { border-bottom: none; }
.co-item .n { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.co-item .n .q { color: var(--brand-muted-foreground); flex-shrink: 0; }

.co-form { display: flex; flex-direction: column; gap: 14px; }
.form-input {
  width: 100%; padding: 12px 16px; border-radius: 12px;
  border: 1px solid var(--brand-border); background: var(--brand-card);
  font-size: 14px; font-family: 'Inter', sans-serif; color: var(--brand-foreground);
  outline: none; transition: border 0.2s, box-shadow 0.2s; resize: vertical;
}
.form-input:focus { border-color: var(--brand-primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12); }
.co-summary { border-top: 1px solid var(--brand-border); padding-top: 14px; margin-top: 4px; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; color: var(--brand-muted-foreground); }
.co-summary .row { display: flex; justify-content: space-between; }
.co-summary .total { font-size: 16px; color: var(--brand-foreground); font-weight: 700; }
.co-summary .total .v { font-family: 'Space Grotesk', sans-serif; font-size: 22px; color: var(--brand-primary); }
.form-error { color: var(--state-error); font-size: 13px; min-height: 18px; margin: 0; }
.co-submit { width: 100%; justify-content: center; }

/* 下单成功 */
.co-success { text-align: center; padding: 56px 36px 48px; }
.success-circle {
  width: 80px; height: 80px; border-radius: 50%;
  background: rgba(16, 185, 129, 0.12);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 24px;
  animation: pop-in 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.success-circle svg { width: 36px; height: 36px; color: var(--state-success); }
@keyframes pop-in { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.order-no { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 22px; letter-spacing: 0.04em; margin: 6px 0; }
.order-total { font-size: 14px; color: var(--brand-muted-foreground); margin-bottom: 8px; }
.order-total b { color: var(--brand-foreground); font-size: 16px; }

/* ---------- 登录弹窗 ---------- */
.acc-wrap { padding: 40px 36px 36px; }

/* ---------- 页脚链接（替代内联 hover 事件） ---------- */
footer a { transition: color 0.2s ease; }
footer a:hover { color: #FFFFFF !important; }

/* ---------- 移动端菜单 ---------- */
.mobile-menu {
  position: fixed; top: 72px; left: 0; right: 0; z-index: 99;
  background: rgba(250, 250, 247, 0.96);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--brand-border);
  display: none; flex-direction: column; padding: 8px 20px 16px;
}
.mobile-menu.open { display: flex; }
.mobile-menu a {
  padding: 14px 4px; font-size: 15px; color: var(--brand-foreground);
  text-decoration: none; border-bottom: 1px solid var(--brand-border);
}
.mobile-menu a:last-child { border-bottom: none; }

/* ---------- 筛选提示条 ---------- */
.filter-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--brand-muted); border: 1px solid var(--brand-border);
  border-radius: 999px; padding: 8px 8px 8px 18px;
  font-size: 13px; font-weight: 500;
}
.filter-chip button {
  width: 24px; height: 24px; border-radius: 50%; border: none;
  background: var(--brand-border); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--brand-foreground); transition: all 0.2s; padding: 0;
}
.filter-chip button:hover { background: var(--brand-foreground); color: var(--brand-background); }

/* ---------- 购物车角标动画 ---------- */
@keyframes badge-pop { 0% { transform: scale(1); } 40% { transform: scale(1.5); } 100% { transform: scale(1); } }
.badge-pop { animation: badge-pop 0.4s ease; }

/* 触屏设备：常显卡片上的加购按钮（无 hover） */
@media (hover: none) {
  .card-add { opacity: 1 !important; }
}

/* ---------- 左侧分类导航 + 右侧商品布局 ---------- */
.shop-layout {
  display: grid;
  grid-template-columns: 216px 1fr;
  gap: 32px;
  align-items: start;
}
.cat-nav {
  position: sticky;
  top: 96px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--brand-card);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}
.cat-nav-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-muted-foreground);
  padding: 4px 10px 10px;
}
.cat-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border: none;
  background: none;
  border-radius: var(--brand-radius-md);
  font-size: 14px;
  color: var(--brand-muted-foreground);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.cat-nav-item:hover { background: var(--brand-muted); color: var(--brand-foreground); }
.cat-nav-item.active {
  background: var(--brand-primary);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .shop-layout { grid-template-columns: 170px 1fr; gap: 20px; }
}
@media (max-width: 768px) {
  .shop-layout { grid-template-columns: 1fr; }
  .cat-nav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 12px;
  }
  .cat-nav-title { width: 100%; padding: 2px 6px 8px; }
  .cat-nav-item { width: auto; padding: 9px 16px; }
}
@media (max-width: 768px) {
  .pm-grid { grid-template-columns: 1fr; }
  .pm-info { padding: 0 24px 28px; }
  .pm-image { padding: 20px 20px 0; }
  .co-wrap { padding: 28px 22px; }
  .acc-wrap { padding: 32px 24px 28px; }
  .modal { padding: 14px; }
  .search-input-row { padding: 18px 20px; }
  .search-results { padding: 18px 20px 26px; }
}
@media (max-width: 520px) {
  .cart-drawer { width: 100vw; }
  .drawer-header, .drawer-body, .drawer-footer { padding-left: 20px; padding-right: 20px; }
}
