/* storefront-layout-20261111-v1
 * 前台布局覆盖层：只调位置、间距、字号，不改应用自己的文件，也不改文案和业务逻辑。
 * 颜色一律用站点主题变量（--ui-*），白天和夜间主题都跟着走。
 * 需要按页面区分的规则靠 layout.js 写在 <html data-sl-route="…"> 上的标记；脚本没加载时这些规则不生效，页面保持原样。
 * 本文件在缓存白名单里，禁止原地修改；要改就发新目录并改入口引用。 */

/* ============ 商品详情 ============ */

/* 长链接、长单词在卡片里换行，不再顶出右边 */
.product-detail-page .theme-panel p,
.product-detail-page .theme-panel a,
.product-detail-page .theme-panel li {
  overflow-wrap: anywhere;
}

@media (max-width: 1023px) {
  /* 购买按钮吸在底部导航上方：要让 sticky 相对整页生效，面板不能裁剪溢出 */
  .product-detail-page .theme-panel.overflow-hidden {
    overflow: visible;
  }
  .product-detail-page .theme-panel > .grid.lg\:grid-cols-2 > div:first-child {
    border-radius: 1.5rem 1.5rem 0 0;
  }
  .product-detail-page .theme-panel > .grid.lg\:grid-cols-2 > div:last-child > .mt-auto {
    position: sticky;
    /* 紧贴底部导航上沿，左右撑满面板，中间不留能透出内容的缝 */
    bottom: calc(57px + env(safe-area-inset-bottom, 0px));
    z-index: 30;
    margin: 0 -24px;
    padding: 10px 16px;
    border: 1px solid var(--ui-border);
    border-bottom-width: 0;
    border-radius: 16px 16px 0 0;
    /* 主题的面板底色是半透明的：叠两层并加模糊，后面滚过去的文字不会透上来 */
    background-color: var(--ui-bg-elevated);
    background-image: linear-gradient(var(--ui-bg-elevated), var(--ui-bg-elevated));
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    box-shadow: 0 -8px 24px -12px rgba(15, 60, 90, 0.35);
  }
  .product-detail-page .theme-panel > .grid.lg\:grid-cols-2 > div:last-child > .mt-auto .grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
    gap: 10px;
  }
  .product-detail-page .theme-panel > .grid.lg\:grid-cols-2 > div:last-child > .mt-auto .grid > button {
    padding: 12px 8px;
    font-size: 15px;
    line-height: 1.3;
  }
  /* 夜间像素主题是方角的 */
  :root.dark .product-detail-page .theme-panel > .grid.lg\:grid-cols-2 > div:last-child > .mt-auto {
    border-radius: 2px 2px 0 0;
  }
  /* 只有一个按钮（比如售罄）时占满一行 */
  .product-detail-page .theme-panel > .grid.lg\:grid-cols-2 > div:last-child > .mt-auto .grid > button:only-child {
    grid-column: 1 / -1;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .product-detail-page .theme-panel > .grid.lg\:grid-cols-2 > div:last-child > .mt-auto {
    margin: 0 -32px;
    padding: 12px 24px;
  }
}

@media (max-width: 639px) {
  /* 价格不再占半屏 */
  .product-detail-page .theme-price-lg {
    font-size: 2rem;
    line-height: 1.15;
  }
  /* 已售 / 成交 / 库存 三个小块排成一行 */
  .product-detail-page .theme-product-stats {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
  }
  .product-detail-page .theme-product-stats > .theme-product-stat-badge {
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
    padding: 5px 6px;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .product-detail-page .theme-panel > .grid.lg\:grid-cols-2 > div:last-child p.text-lg {
    font-size: 15px;
    line-height: 1.7;
  }
  /* 各段之间收紧一点 */
  .product-detail-page .theme-panel > .grid.lg\:grid-cols-2 > div:last-child .mb-8 {
    margin-bottom: 1.25rem;
  }
  .product-detail-page .theme-panel > .grid.lg\:grid-cols-2 > div:last-child .pb-8 {
    padding-bottom: 1.25rem;
  }
}

@media (min-width: 1024px) {
  /* 桌面：右栏很长，封面跟着滚动，左边不再留一大片空白 */
  .product-detail-page .theme-panel.overflow-hidden {
    overflow: visible;
  }
  .product-detail-page .theme-panel > .grid.lg\:grid-cols-2 > div:first-child {
    border-radius: 1.5rem 0 0 1.5rem;
  }
  .product-detail-page .theme-panel > .grid.lg\:grid-cols-2 > div:first-child > div:first-child {
    position: sticky;
    top: 104px;
  }
  /* 标题和间距收一点，让购买按钮更靠上 */
  .product-detail-page .theme-panel > .grid.lg\:grid-cols-2 > div:last-child h1.lg\:text-5xl {
    font-size: 2.25rem;
    line-height: 1.2;
  }
  .product-detail-page .theme-panel > .grid.lg\:grid-cols-2 > div:last-child.lg\:p-12 {
    padding: 2.25rem 2.5rem;
  }
  .product-detail-page .theme-panel > .grid.lg\:grid-cols-2 > div:last-child .mb-8 {
    margin-bottom: 1.5rem;
  }
  .product-detail-page .theme-panel > .grid.lg\:grid-cols-2 > div:last-child .pb-8 {
    padding-bottom: 1.5rem;
  }
}

/* ============ 结算页 ============ */

/* 右侧（手机上是最后一张）卡片：先选支付方式，再看金额，提示紧挨着提交按钮 */
html[data-sl-route="checkout"] #app .grid.lg\:grid-cols-3 > .theme-panel.h-fit {
  display: flex;
  flex-direction: column;
}
html[data-sl-route="checkout"] #app .grid.lg\:grid-cols-3 > .theme-panel.h-fit > h2 {
  order: 0;
}
html[data-sl-route="checkout"] #app .grid.lg\:grid-cols-3 > .theme-panel.h-fit > div.border-t.pt-4 {
  order: 1;
  border-top-width: 0;
  padding-top: 0;
}
html[data-sl-route="checkout"] #app .grid.lg\:grid-cols-3 > .theme-panel.h-fit > div.space-y-3 {
  order: 2;
  border-top: 1px solid var(--ui-border);
  padding-top: 1rem;
}
html[data-sl-route="checkout"] #app .grid.lg\:grid-cols-3 > .theme-panel.h-fit > div.theme-surface-soft {
  order: 3;
  border-width: 0;
  background: none;
  padding: 0;
  font-size: 11px;
  line-height: 1.5;
}
html[data-sl-route="checkout"] #app .grid.lg\:grid-cols-3 > .theme-panel.h-fit > div.rounded-lg.border.p-3:not(.theme-surface-soft) {
  order: 4;
}
html[data-sl-route="checkout"] #app .grid.lg\:grid-cols-3 > .theme-panel.h-fit > button {
  order: 5;
}
/* 金额为 0 的行（优惠券、活动价、批发价没用上时）由 layout.js 标记后收起 */
html[data-sl-route="checkout"] #app [data-sl-zero] {
  display: none;
}

@media (max-width: 639px) {
  /* 步骤条在手机上把文字也显示出来 */
  html[data-sl-route="checkout"] #app ol.theme-panel-soft li span.hidden.sm\:inline,
  html[data-sl-route="cart"] #app ol.theme-panel-soft li span.hidden.sm\:inline {
    display: inline;
    font-size: 12px;
    white-space: nowrap;
  }
  html[data-sl-route="checkout"] #app ol.theme-panel-soft,
  html[data-sl-route="cart"] #app ol.theme-panel-soft {
    padding: 12px;
  }
  html[data-sl-route="checkout"] #app ol.theme-panel-soft li > div.shrink-0,
  html[data-sl-route="cart"] #app ol.theme-panel-soft li > div.shrink-0 {
    gap: 5px;
  }
}

/* ============ 首页 / 商品列表 ============ */

@media (max-width: 639px) {
  /* 商品卡底部：价格和销量上下排，购物车按钮固定在右下，不再有的掉行有的不掉 */
  .catalog-tile .tile-bottom {
    flex-wrap: nowrap;
    align-items: flex-end;
  }
  .catalog-tile .tile-price-area {
    flex: 1 1 auto;
    min-width: 0;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 2px;
  }
  .catalog-tile .tile-sales {
    max-width: 100%;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .catalog-tile .tile-meta {
    font-size: 11px;
  }
  .catalog-tile .tile-quick-buy {
    flex: 0 0 auto;
  }
  /* 分类条可以横向滑，但不露滚动条 */
  .catalog-category-bar * {
    scrollbar-width: none;
  }
  .catalog-category-bar *::-webkit-scrollbar {
    display: none;
  }
}

/* ============ 分站承诺书浮条 ============ */

@media (max-width: 1023px) {
  /* 手机上有底部导航：浮条不再盖在导航上，改成页面最底下的一行 */
  #reseller-rules-notice {
    position: static;
    width: auto;
    max-width: none;
    margin: -48px 12px calc(57px + env(safe-area-inset-bottom, 0px) + 10px);
    padding: 8px 12px;
    font-size: 13px;
    text-align: center;
    box-shadow: none;
  }
}

/* ============ 个人中心 ============ */

@media (max-width: 639px) {
  /* 每个子页顶上的大卡片压成一小块：标题一行、三个统计块并排 */
  html[data-sl-route="me"] #app header.theme-panel-soft.rounded-3xl {
    margin-bottom: 14px;
    padding: 14px 16px;
  }
  html[data-sl-route="me"] #app header.theme-panel-soft.rounded-3xl > div {
    gap: 12px;
  }
  html[data-sl-route="me"] #app header.theme-panel-soft.rounded-3xl h1 {
    margin-top: 4px;
    font-size: 1.2rem;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  html[data-sl-route="me"] #app header.theme-panel-soft.rounded-3xl h1 + p {
    display: none;
  }
  html[data-sl-route="me"] #app header.theme-panel-soft.rounded-3xl .grid.sm\:grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  html[data-sl-route="me"] #app header.theme-panel-soft.rounded-3xl .grid.sm\:grid-cols-3 > div {
    min-width: 0;
    padding: 8px 10px;
    border-radius: 12px;
  }
  html[data-sl-route="me"] #app header.theme-panel-soft.rounded-3xl .grid.sm\:grid-cols-3 > div > p:first-child {
    font-size: 10px;
    letter-spacing: 0.04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  html[data-sl-route="me"] #app header.theme-panel-soft.rounded-3xl .grid.sm\:grid-cols-3 > div > :last-child {
    margin-top: 4px;
    font-size: 13px;
  }
  html[data-sl-route="me"] #app header.theme-panel-soft.rounded-3xl .grid.sm\:grid-cols-3 .theme-badge {
    max-width: 100%;
    padding: 2px 6px;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* 子导航可以横向滑，但不露滚动条 */
  html[data-sl-route="me"] #app aside .overflow-x-auto {
    scrollbar-width: none;
  }
  html[data-sl-route="me"] #app aside .overflow-x-auto::-webkit-scrollbar {
    display: none;
  }
  html[data-sl-route="me"] #app aside > div.theme-panel-soft {
    padding: 10px;
  }
}

/* ============ 登录 / 注册 / 找回密码 ============ */

/* 卡片下面那个"去注册 / 去登录"是次要动作，不和主按钮一个样 */
.theme-auth-card > .mt-4.text-center > a.theme-btn-primary {
  background-color: var(--ui-bg-soft);
  background-image: none;
  color: var(--ui-text-secondary);
  border: 1px solid var(--ui-border);
  box-shadow: none;
  font-weight: 500;
}
.theme-auth-card > .mt-4.text-center > a.theme-btn-primary:hover {
  color: var(--ui-accent-hover);
  border-color: var(--ui-accent);
}
/* 验证码居中，不再靠左 */
.theme-auth-form .min-h-\[65px\] > div {
  display: flex;
  justify-content: center;
}
@media (min-width: 1024px) {
  /* 顶上"返回首页"不再贴着顶栏 */
  .theme-auth-page {
    padding-top: 6.5rem;
  }
}
