* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 130px;
}

body {
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* 顶栏 Header (桌面端避让右侧直通顶部的 basket) */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: var(--header-height);
  height: auto;
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  width: calc(100% - var(--basket-width));
}

.header-inner {
  width: 100%;
  min-height: var(--header-height);
  height: auto;
  padding: 14px 28px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.brand-section {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.brand-badge {
  width: 44px;
  height: 44px;
  min-width: 44px;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--color-primary), #d35400);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 20px;
  color: #fff;
  box-shadow: 0 4px 12px rgba(255, 128, 0, 0.3);
  margin-top: 1px;
}

.brand-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  line-height: 1.2;
  margin: 0;
}

.brand-meta {
  font-size: 0.82rem;
  color: var(--text-subdued);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  column-gap: 8px;
  row-gap: 5px;
  line-height: 1.45;
}

.brand-meta .meta-dot {
  color: var(--text-subdued);
  opacity: 0.7;
  font-size: 0.82rem;
}

.restaurant-address-link {
  color: var(--text-subdued);
  text-decoration: none;
  transition: color 0.15s ease;
  cursor: pointer;
}

.restaurant-address-link:hover {
  color: var(--text-primary);
}

/* 顶栏动态营业时间状态链接与弹出层 (完全融入副标题低调灰色体系与统一字号) */
.header-hours-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.header-hours-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-subdued);
  font-size: 0.82rem;
  font-family: inherit;
  font-weight: 400;
  cursor: pointer;
  outline: none;
  border-bottom: none;
  transition: color 0.15s ease;
  line-height: 1.35;
}

.header-hours-link:hover {
  color: var(--text-primary);
}

.header-hours-link .status-indicator-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

/* closed 时前置红点指征 */
.header-hours-link.is-closed .status-indicator-dot {
  background-color: #ff3b30;
  box-shadow: 0 0 5px rgba(255, 59, 48, 0.6);
}

/* open 时前置绿点指征 */
.header-hours-link.is-open .status-indicator-dot {
  background-color: var(--color-success);
  box-shadow: 0 0 5px rgba(46, 204, 113, 0.6);
}

/* 营业时间悬浮气泡弹层 (统一暗色简约卡片风格) */
.header-hours-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 320px;
  max-width: calc(100vw - 32px);
  background: #24221f;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 300;
  animation: fadeInHeaderPopover 0.18s ease-out;
}

@keyframes fadeInHeaderPopover {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.header-hours-popover .popover-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* 中文名称切换按钮：微型“中”字徽标 + 统一低调灰文字 */
.chinese-toggle-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  outline: none;
  color: var(--text-subdued);
  font-size: 0.82rem;
  font-family: inherit;
  font-weight: 400;
  line-height: 1.35;
  transition: color 0.15s ease;
  user-select: none;
}

.chinese-toggle-btn:hover {
  color: var(--text-primary);
}

/* “中”字微型方形徽标 */
.chinese-char-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--text-subdued);
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

/* 显示中文时：中字徽标点亮为品牌主题橙色 */
.chinese-toggle-btn.is-active .chinese-char-badge {
  background: rgba(255, 128, 0, 0.18);
  border-color: rgba(255, 128, 0, 0.5);
  color: var(--color-primary);
  box-shadow: 0 0 6px rgba(255, 128, 0, 0.35);
}

.chinese-toggle-btn.is-active .chinese-toggle-text {
  color: var(--text-secondary);
}

/* 默认状态下隐藏中文名：隐藏菜品胶囊及购物车中的中文部分 */
body.hide-chinese-name .dish-name-zh,
body.hide-chinese-name .cart-item-name-zh {
  display: none !important;
}

/* 购物车中低调的菜品编号 (id)：无点号，低调次级字色 */
.cart-item-id {
  color: var(--text-subdued);
  font-size: 0.88em;
  font-weight: 600;
  margin-right: 5px;
  letter-spacing: 0.2px;
  font-variant-numeric: tabular-nums;
  user-select: none;
}

.rating-pill {
  color: var(--color-warning);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* 餐厅顶部沉浸式题图 (宽屏下右边界严格避让直通顶部的 basket 塔) */
.restaurant-hero-banner {
  width: calc(100% - var(--basket-width));
  height: 220px;
  position: relative;
  overflow: hidden;
  background-color: #121110;
}

.hero-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 60%;
  display: block;
  filter: brightness(1.06) contrast(1.02);
}

.hero-banner-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.05) 0%,
    rgba(0, 0, 0, 0) 40%,
    rgba(28, 26, 23, 0.25) 75%,
    var(--bg-canvas) 100%
  );
  pointer-events: none;
}

/* 搜索框 (中间画卷顶部常驻检索，吸顶时边缘平滑渐变隐退并保留优雅底色空间) */
.menu-search-bar {
  position: sticky;
  top: var(--header-height);
  z-index: 40;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0 44px 0;
  margin-top: -14px;
  margin-bottom: -24px;
  background-color: var(--bg-canvas);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 68%, rgba(0, 0, 0, 0.5) 84%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 68%, rgba(0, 0, 0, 0.5) 84%, transparent 100%);
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  height: 46px;
  padding: 0 42px 0 46px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface);
  border: 1px solid var(--color-border);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  border-color: var(--color-primary);
  background-color: var(--bg-surface-hover);
  box-shadow: 0 0 0 3px var(--color-primary-subtle);
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subdued);
  pointer-events: none;
  display: block;
  flex-shrink: 0;
}

.search-clear-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
}

.search-clear-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
  transform: translateY(-50%) scale(1.08);
}

.search-clear-btn:active {
  transform: translateY(-50%) scale(0.92);
}

/* 移动端/中等宽度分类抽屉触发按钮 */
.mobile-cat-drawer-trigger {
  display: none;
  align-items: center;
  gap: 8px;
  height: 46px;
  background-color: var(--bg-surface);
  border: 1px solid var(--color-border);
  color: var(--text-primary);
  padding: 0 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.mobile-cat-drawer-trigger:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--color-border-hover);
  color: #fff;
}

/* 移动端抽屉遮罩 */
.mobile-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.mobile-drawer-overlay.is-open {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

/* 移动端侧滑抽屉 (Mobile Category Drawer) */
.mobile-cat-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  max-width: 82vw;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--color-border);
  z-index: 1001;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
}

.mobile-cat-drawer.is-open {
  transform: translateX(0);
}

.mobile-drawer-header {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-border);
}

.drawer-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.close-drawer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background-color: var(--color-primary-subtle);
  border: 1px solid rgba(255, 128, 0, 0.25);
  color: var(--color-primary);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  outline: none;
  transition: background-color 0.2s, color 0.2s, transform 0.15s, border-color 0.2s;
}

.close-drawer-btn:hover {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  transform: scale(1.05);
}

.close-drawer-btn:active {
  transform: scale(0.95);
}

.mobile-drawer-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* 桌面端三栏布局：整屏无缝铺开，basket 通顶独立右侧贴边(top:0)，剩余宽度全量用于展示餐品 */
.main-layout {
  width: 100%;
  max-width: 100%;
  margin-top: calc(-1 * (var(--header-height) + 220px));
  margin-bottom: 0;
  padding: 0 0 80px 0;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr var(--basket-width);
  gap: 0;
  align-items: start;
}

/* 桌面端左侧极简垂直分类栏：避开题图与顶栏高度，吸顶常驻 */
.category-sidebar {
  position: sticky;
  top: calc(var(--header-height) + 20px);
  margin-top: calc(var(--header-height) + 220px);
  max-height: calc(100vh - var(--header-height) - 40px);
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0 10px 0 24px;
  box-shadow: none;
  display: flex;
  flex-direction: column;
}

.vertical-cat-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.vertical-cat-nav::-webkit-scrollbar {
  width: 3px;
}

.vertical-cat-nav::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.18);
  border-radius: 3px;
}

/* 极简纯文本分类项规范 */
.cat-tab {
  padding: 8px 12px 8px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: 0;
  cursor: pointer;
  position: relative;
  text-align: left;
  transition: color 0.18s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.cat-tab:hover {
  background: transparent;
  color: var(--text-primary);
}

/* 激活态：纯白文字 + 左侧细长橙色胶囊竖条，不带背景色块 */
.cat-tab.is-active {
  background: transparent;
  color: #ffffff;
  font-weight: 700;
}

.cat-tab.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  background-color: var(--color-primary);
  border-radius: 2px;
}

/* 搜索无匹配态：灰化弱化，降低透明度，不可点击 */
.cat-tab.is-disabled {
  color: rgba(255, 255, 255, 0.22) !important;
  cursor: not-allowed;
  pointer-events: none;
}

.cat-tab.is-disabled::before {
  display: none !important;
}

/* 中间商品展示画卷：占满 1fr 空间，内部包含顶部 Search 与菜品网格 */
.menu-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
  margin-top: calc(var(--header-height) + 220px);
  padding: var(--search-section-gap) 36px 60px 24px;
}

.menu-sections-wrapper {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.category-block {
  scroll-margin-top: calc(var(--header-height) + 76px);
}

.category-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 18px;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 餐品卡片网格：随中间可用宽度灵活自适应 2 到 4 列 */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  position: relative;
}

/* 响应式断点：阶梯适配 */
@media (max-width: 1200px) {
  :root {
    --sidebar-width: 150px;
    --basket-width: 340px;
  }
  .main-layout {
    grid-template-columns: var(--sidebar-width) 1fr var(--basket-width);
  }
  .menu-container {
    padding: var(--search-section-gap) 24px 60px 16px;
  }
}

/* 移动端/中小屏购物车遮罩 */
.mobile-basket-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.mobile-basket-overlay.is-open {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 1024px) {
  .app-header {
    width: 100%;
  }
  .restaurant-hero-banner {
    width: 100%;
    height: 180px;
  }
  .main-layout {
    grid-template-columns: 1fr;
    margin-top: 0;
    padding: 16px 16px 100px;
  }
  .menu-container {
    margin-top: 0;
    padding: 0 0 60px 0;
  }
  .menu-search-bar {
    margin-top: -14px !important;
    padding-top: var(--search-section-gap) !important;
  }
  .category-sidebar {
    display: none !important;
    margin-top: 0;
  }
  .mobile-cat-drawer-trigger {
    display: inline-flex !important;
  }
  
  /* 中小屏下：购物车转化为右侧/下沉滑出抽屉 */
  .basket-sidebar {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: auto !important;
    width: 380px !important;
    max-width: 90vw !important;
    height: 100vh !important;
    z-index: 1001 !important;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    display: flex !important;
  }

  .basket-sidebar.is-open {
    transform: translateX(0);
  }

  .close-basket-btn {
    display: inline-flex !important;
  }

  .mobile-bottom-bar {
    display: flex !important;
  }
}

@media (max-width: 640px) {
  .header-inner {
    padding: 12px 16px 14px;
  }
  .restaurant-hero-banner {
    height: 150px;
  }
  .cards-grid {
    grid-template-columns: 1fr;
  }
  .basket-sidebar {
    width: 100% !important;
    max-width: 100vw !important;
  }

  /* 小屏下让 brand-meta 成为相对定位锚点，弹层紧贴其下方展开并充分利用整行宽度 */
  .brand-meta {
    position: relative;
  }

  .header-hours-wrapper {
    position: static;
  }

  .header-hours-popover {
    position: absolute !important;
    top: calc(100% + 8px) !important;
    left: 0 !important;
    right: 0 !important;
    width: auto !important;
    max-width: 100% !important;
    margin-top: 0 !important;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.12) !important;
    z-index: 300 !important;
  }
}
