/* shop_a_v2 runtime fixes: keep the uploaded static style stable without relying on CDN Tailwind config. */
:root {
  --shop-brand: #e1251b;
  --shop-brand-dark: #b31d15;
  --shop-brand-light: #ffeded;
}

.bg-brand { background-color: var(--shop-brand) !important; }
.hover\:bg-brand:hover { background-color: var(--shop-brand) !important; }
.hover\:bg-brand-dark:hover { background-color: var(--shop-brand-dark) !important; }
.bg-brand-dark { background-color: var(--shop-brand-dark) !important; }
.bg-brand-light { background-color: var(--shop-brand-light) !important; }
.text-brand { color: var(--shop-brand) !important; }
.hover\:text-brand:hover { color: var(--shop-brand) !important; }
.border-brand { border-color: var(--shop-brand) !important; }
.focus\:outline-brand:focus { outline-color: var(--shop-brand) !important; }
.focus\:ring-brand:focus { --tw-ring-color: var(--shop-brand) !important; }
.shadow-brand\/10 { box-shadow: 0 10px 15px -3px rgb(225 37 27 / .10), 0 4px 6px -4px rgb(225 37 27 / .10) !important; }
.shadow-brand\/20 { box-shadow: 0 10px 15px -3px rgb(225 37 27 / .20), 0 4px 6px -4px rgb(225 37 27 / .20) !important; }

.shop-a-v2-loading,
.shop-a-v2-empty {
  grid-column: 1 / -1;
  min-height: 180px;
  border: 1px dashed #e2e8f0;
  border-radius: 18px;
  background: #fff;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}

.shop-a-v2-card-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.shop-a-v2-primary-btn {
  background: var(--shop-brand) !important;
  color: #fff !important;
  border-color: var(--shop-brand) !important;
}

.shop-a-v2-primary-btn:hover {
  background: var(--shop-brand-dark) !important;
}

.line-clamp-1,
.line-clamp-2,
.line-clamp-3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.line-clamp-1 { -webkit-line-clamp: 1; }
.line-clamp-2 { -webkit-line-clamp: 2; }
.line-clamp-3 { -webkit-line-clamp: 3; }
/* 未接入评价数据前，不展示模板中的演示内容。 */
[data-tab="reviews"],
#tab-content-reviews {
    display: none !important;
}

.shop-a-v2-sku-option {
  padding: .45rem .85rem;
  border: 1px solid #e5e7eb;
  border-radius: .5rem;
  color: #334155;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}

.shop-a-v2-sku-option:hover,
.shop-a-v2-sku-option.is-active {
  border-color: var(--shop-brand);
  color: var(--shop-brand);
}

.shop-a-v2-sku-option.is-active {
  border-width: 2px;
  font-weight: 700;
  background: var(--shop-brand-light);
}

/* 数据返回前隐藏模板静态示例，避免先显示假数据再跳成真实内容。 */
.shop-a-v2-hydrating {
  position: relative;
  min-height: 44px;
  overflow: hidden;
}

.shop-a-v2-hydrating > * {
  visibility: hidden !important;
}

.shop-a-v2-hydrating::after {
  content: "正在加载站点数据...";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 700;
}

body.shop-a-v2-detail-hydrating > main {
  visibility: hidden !important;
}

body.shop-a-v2-detail-hydrating::after {
  content: "正在加载商品详情...";
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 60;
  transform: translate(-50%, -50%);
  min-width: 240px;
  padding: 28px 36px;
  border: 1px dashed #e2e8f0;
  border-radius: 18px;
  background: #fff;
  color: #94a3b8;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 16px 40px rgb(15 23 42 / .08);
}

/* 搜索按钮在不同组合模板和长站点名称下都保持横向展示，避免“搜索”两字竖排。 */
form[action="/page/search"] button[type="submit"],
#search-action-form button[type="submit"] {
  flex: 0 0 auto;
  min-width: 96px;
  white-space: nowrap;
  justify-content: center;
}

form[action="/page/search"] button[type="submit"] span,
#search-action-form button[type="submit"] span {
  display: inline-block;
  white-space: nowrap;
  writing-mode: horizontal-tb;
}

#detail-contact-block[hidden] {
  display: none !important;
}

.detail-contact-card {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #fee2e2;
  border-radius: 16px;
  background: linear-gradient(135deg, #fff7f7 0%, #ffffff 100%);
  box-shadow: 0 10px 28px rgb(225 37 27 / .06);
}

.detail-contact-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.detail-contact-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--shop-brand);
  background: #fff;
  border: 1px solid #fecaca;
}

.detail-contact-title {
  color: #0f172a;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.3;
}

.detail-contact-subtitle {
  margin-top: 2px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
}

.detail-contact-values {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px 12px;
  align-items: start;
  color: #475569;
  font-size: 12px;
  line-height: 1.6;
}

.detail-contact-label {
  color: #94a3b8;
  font-weight: 700;
}

.detail-contact-value {
  min-width: 0;
  color: #334155;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.detail-contact-note {
  display: inline-flex;
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #fed7aa;
  color: #c2410c;
  font-size: 10px;
  font-weight: 800;
  vertical-align: middle;
}

/* shop_a_v2:运营版排版保护。保持原模板红黑商城气质，只修正真实数据下的拥挤、溢出和移动端错位。 */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  background: #f5f6f8 !important;
}

header.sticky {
  backdrop-filter: saturate(140%) blur(10px);
}

#shop-main-nav {
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

#shop-main-nav::-webkit-scrollbar {
  display: none;
}

#shop-main-nav > a {
  flex: 0 0 auto;
  white-space: nowrap;
}

#home-category-list .category-item a,
#product-category-list .category-link {
  min-height: 42px;
}

#carousel h2,
#product-title,
.shop-a-v2-detail-html,
.detail-contact-value {
  overflow-wrap: anywhere;
}

#home-seckill-grid > .border,
#home-products-grid > .bg-white,
#products-grid > .bg-white,
#search-grid-container > .bg-white,
#stores-grid > .bg-white {
  height: 100%;
}

#thumbnail-list {
  overflow-x: auto;
  padding-bottom: 4px;
}

#thumbnail-list .thumb-btn {
  flex: 0 0 auto;
}

@media (max-width: 1180px) {
  header .max-w-7xl {
    gap: 16px;
    flex-wrap: wrap;
  }

  header .max-w-7xl > .flex-1,
  header .max-w-7xl > form.flex-1 {
    order: 3;
    width: 100%;
    max-width: none;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  #home-seckill-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  #home-products-grid,
  #products-grid,
  #search-grid-container,
  #stores-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 768px) {
  .max-w-7xl,
  .max-w-4xl {
    max-width: 100% !important;
  }

  .topbar-actions,
  body > .bg-\[\#E3E4E5\] .max-w-7xl,
  header .max-w-7xl,
  nav .max-w-7xl {
    align-items: stretch;
  }

  body > .bg-\[\#E3E4E5\] .max-w-7xl {
    flex-direction: column;
    gap: 8px;
  }

  body > .bg-\[\#E3E4E5\] .max-w-7xl > div {
    flex-wrap: wrap;
    row-gap: 6px;
  }

  header {
    position: static !important;
    padding-top: 16px !important;
    padding-bottom: 16px !important;
  }

  header .max-w-7xl > a:first-child {
    min-width: 0;
  }

  header .text-2xl,
  header .text-xl {
    font-size: 18px !important;
    line-height: 1.25 !important;
  }

  header .relative.bg-gray-50 {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  nav .max-w-7xl {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  nav .w-56 {
    width: auto !important;
    min-width: 160px;
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  #shop-main-nav {
    padding-left: 12px !important;
    gap: 18px !important;
  }

  main.grid,
  .grid.grid-cols-12 {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .col-span-3,
  .col-span-5,
  .col-span-6,
  .col-span-7,
  .col-span-9 {
    grid-column: auto !important;
  }

  #home-category-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
  }

  #category-panel {
    display: none !important;
  }

  #carousel {
    min-height: 320px;
  }

  #carousel > div > div {
    padding: 28px !important;
  }

  #carousel .max-w-\[58\%\] {
    max-width: 100% !important;
  }

  #carousel h2 {
    font-size: 28px !important;
  }

  #home-seckill-grid,
  #home-products-grid,
  #products-grid,
  #search-grid-container,
  #stores-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .grid.grid-cols-4,
  .grid.grid-cols-3,
  .grid.grid-cols-2 {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  #sort-controls {
    flex-wrap: wrap;
  }

  .detail-contact-values {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .fixed.right-6.bottom-10 {
    right: 14px !important;
    bottom: 18px !important;
  }
}
