/*
Theme Name: QQ Store
Description: 图文列表商城主题：首页图文列表 + 商品详情大图相册 + 竖向图文详情。视觉对齐演示站（暖米底 + 酒红主色 + 宋体标题价签）。
Version: 1.5.4
Text Domain: qq-store
*/

/* ============ tokens (aligned with demo) ============ */
:root {
  --bg: #FAF7F5; --surface: #FFFFFF; --surface2: #F3ECE8;
  --text: #1F1B1E; --dim: #8A7D82; --border: #E7DDD8;
  --accent: #7C2D3E; --accent2: #3F7A5E; --gold: #B7791F;
  --imgbg: #EDE6E1;
}
* { box-sizing: border-box; }
html, body { overflow-x: hidden; }
body { margin: 0; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--text); background: var(--bg); font-size: 15px; line-height: 1.55; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.serif, .qq-logo, .qq-hero h1, .qq-sec-title, .qq-row-info .price, .qq-single .price, .qq-single h1.product_title, .qq-footer h4 { font-family: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif; }
.qq-wrap { max-width: 1080px; margin: 0 auto; padding: 0 14px; }

/* ============ top bar / header ============ */
.qq-topbar { background: var(--accent); color: #fff; font-size: 12.5px; text-align: center; padding: 7px 16px; letter-spacing: .02em; line-height: 1.5; overflow-wrap: break-word; }
.qq-topbar b { color: #FFD9E0; }
.qq-header { background: var(--bg); }
.qq-header-in { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-top: 16px; padding-bottom: 8px; }
.qq-head-left { min-width: 0; }
.qq-logo { font-size: 26px; font-weight: 900; color: var(--text); white-space: nowrap; line-height: 1.15; }
.qq-shop-sub { margin: 4px 0 0; color: var(--dim); font-size: 12px; }
.qq-cart-pill { position: relative; flex-shrink: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 8px 16px; font-size: 14px; font-weight: 500; box-shadow: 0 1px 2px rgba(31,27,30,.06); margin-top: 4px; }
.qq-cart-pill .qq-cart-count { position: absolute; top: -6px; right: -6px; background: var(--accent); color: #fff; border-radius: 999px; font-size: 11px; min-width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; padding: 0 5px; }

/* ============ hero ============ */
.qq-hero { background: var(--surface2); border-radius: 18px; padding: 22px 20px; margin: 16px 0 6px; }
.qq-hero h1 { margin: 0 0 6px; font-size: 24px; font-weight: 900; }
.qq-hero p { margin: 0; color: var(--dim); font-size: 14px; }
.qq-points { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.qq-points span { background: var(--surface); border: 1px solid var(--border); color: var(--accent); border-radius: 999px; padding: 4px 11px; font-size: 12.5px; }

/* ============ category chips ============ */
.qq-cats { display: flex; gap: 8px; overflow-x: auto; padding: 12px 2px 4px; -webkit-overflow-scrolling: touch; }
.qq-cats a { flex: 0 0 auto; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; font-size: 13.5px; }
.qq-cats a.on { background: var(--text); border-color: var(--text); color: var(--bg); }
.qq-cats a:hover { border-color: var(--dim); }
.qq-cats-archive { padding-top: 2px; }

/* ============ filter row: search + sort (demo) ============ */
.qq-filter-row { display: flex; gap: 8px; margin-top: 10px; }
.qq-search { flex: 1 1 auto; min-width: 0; }
.qq-search input[type="search"] { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 9px 16px; font-size: 14px; outline: none; color: var(--text); }
.qq-search input[type="search"]:focus { border-color: var(--dim); }
.qq-sort select { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 9px 12px; font-size: 14px; color: var(--text); outline: none; }

/* ============ photo banner (demo) ============ */
.qq-banner { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; margin: 14px 0 6px; }
.qq-banner-imgs { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; padding: 10px 10px 0; }
.qq-banner-imgs img { width: 100%; height: 112px; object-fit: cover; border-radius: 10px; }
@media (min-width: 760px) { .qq-banner-imgs img { height: 144px; } }
.qq-banner-body { padding: 14px 16px 16px; }
.qq-banner-body h2 { font-family: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif; font-size: 18px; font-weight: 800; margin: 0; }
.qq-banner-body p { color: var(--dim); font-size: 13.5px; line-height: 1.6; margin: 4px 0 0; }
.qq-banner-body .qq-toggle { margin-top: 12px; display: inline-flex; }
.qq-count { margin-left: 10px; font-size: 11px; color: var(--dim); vertical-align: middle; }
.qq-cats.qq-filterable a { cursor: pointer; }

/* ============ bottom tab bar (demo) ============ */
body { padding-bottom: 64px; }
.qq-bottomnav { position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--border); z-index: 45; padding-bottom: env(safe-area-inset-bottom); }
.qq-bottomnav-in { display: grid; grid-template-columns: repeat(4, 1fr); max-width: 576px; margin: 0 auto; }
.qq-bn-item { padding: 9px 0 7px; font-size: 12px; color: var(--dim); display: flex; flex-direction: column; align-items: center; gap: 2px; line-height: 1.2; }
.qq-bn-ico { font-size: 19px; line-height: 1; }
.qq-bn-item.on { color: var(--accent); font-weight: 700; }

/* ============ toolbar / view toggle ============ */
.qq-toolbar { display: flex; align-items: center; justify-content: space-between; margin: 12px 0 4px; }
.qq-toolbar .qq-sec-title { font-size: 18px; font-weight: 800; }
.qq-toggle { display: flex; background: var(--surface2); border-radius: 999px; padding: 3px; }
.qq-toggle button { border: 0; background: transparent; padding: 5px 14px; font-size: 12.5px; cursor: pointer; color: var(--dim); border-radius: 999px; }
.qq-toggle button.on { background: var(--text); color: var(--bg); }

/* ============ product list (image rows) ============ */
ul.products.qq-list { list-style: none; margin: 10px 0 24px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
ul.products.qq-list li.product { margin: 0; width: 100%; float: none; }
.qq-row { display: flex; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 10px; align-items: stretch; box-shadow: 0 1px 2px rgba(31,27,30,.05); overflow: hidden; max-width: 100%; }
.qq-row-img { flex: 0 0 132px; width: 132px; position: relative; border-radius: 12px; overflow: hidden; background: var(--imgbg); min-height: 132px; }
.qq-row-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.qq-badge { position: absolute; top: 8px; left: 8px; z-index: 2; background: var(--accent); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 999px; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.qq-soldout { position: absolute; inset: 0; z-index: 2; background: rgba(0,0,0,.5); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.qq-row-info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; padding: 2px 2px 2px 0; }
.qq-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; row-gap: 4px; }
.qq-cat-chip { background: var(--surface2); padding: 2px 8px; border-radius: 999px; font-size: 11px; white-space: nowrap; flex-shrink: 0; }
.qq-sales { color: var(--dim); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.qq-row-info .woocommerce-loop-product__title { font-size: 15px; margin: 6px 0 0; line-height: 1.35; font-weight: 700; }
.qq-row-desc { color: var(--dim); font-size: 12px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 4px; }
.qq-row-bottom { margin-top: auto; padding-top: 10px; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.qq-row-bottom > div:first-child { min-width: 0; }
.qq-row-info .price { color: var(--accent); font-weight: 900; font-size: 19px; display: flex; align-items: baseline; gap: 6px; margin: 0; }
.qq-row-info .price ins { text-decoration: none; order: 1; }
.qq-row-info .price del { color: var(--dim); font-weight: 400; font-size: 12px; order: 2; }
.qq-stock-line { color: var(--dim); font-size: 11px; margin-top: 2px; }
.qq-row-btns { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.qq-btn-ghost { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 12px; line-height: 1.4; white-space: nowrap; }
.qq-row-info .button, .qq-row-info a.added_to_cart { margin: 0; background: var(--accent); color: #fff; border-radius: 999px; padding: 7px 13px; font-size: 12px; border: 0; line-height: 1.4; font-weight: 500; white-space: nowrap; }
.qq-row-info a.added_to_cart { background: var(--surface2); color: var(--accent); }
.qq-demo-note { font-size: 11px; color: var(--dim); text-align: center; margin: 4px 0 22px; line-height: 1.8; }

/* grid mode */
ul.products.qq-grid { list-style: none; margin: 10px 0 24px; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 100%; }
ul.products.qq-grid li.product { margin: 0; width: 100%; min-width: 0; }
ul.products.qq-grid .qq-row { flex-direction: column; padding: 0; }
ul.products.qq-grid .qq-row-img { flex: none; width: 100%; min-height: 0; height: 168px; border-radius: 0; }
ul.products.qq-grid .qq-row-info { padding: 10px 12px 12px; }
@media (min-width: 760px) {
  .qq-row-img { flex-basis: 168px; width: 168px; min-height: 168px; }
  ul.products.qq-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ============ single product ============ */
.qq-single { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 18px; margin: 16px 0; box-shadow: 0 1px 2px rgba(31,27,30,.05); }
/* single product two-column layout (explicit, independent of WC layout sheet) */
.qq-single div.product::after { content: ""; display: block; clear: both; }
.qq-single .woocommerce-product-gallery { float: left; width: 48%; }
.qq-single .summary { float: right; width: 48%; }
@media (max-width: 768px) {
  .qq-single .woocommerce-product-gallery, .qq-single .summary { float: none; width: 100%; }
}
.qq-single .woocommerce-product-gallery .flex-viewport { border-radius: 16px; overflow: hidden; background: var(--imgbg); aspect-ratio: 3 / 2; margin-bottom: 10px; }
.qq-single .woocommerce-product-gallery img { background: var(--imgbg); }
.qq-single .woocommerce-product-gallery .flex-control-thumbs { display: flex; gap: 8px; margin-top: 8px; padding: 0; }
.qq-single .woocommerce-product-gallery .flex-control-thumbs li { width: 64px; }
.qq-single .woocommerce-product-gallery .flex-control-thumbs img { border-radius: 10px; }
.qq-single-meta { font-size: 12px; color: var(--dim); margin-bottom: 2px; }
.qq-single h1.product_title { font-size: 21px; font-weight: 800; margin: 2px 0 8px; }
.qq-single .price { color: var(--accent); font-size: 26px; font-weight: 900; display: flex; align-items: baseline; gap: 8px; }
.qq-single .price ins { text-decoration: none; order: 1; }
.qq-single .price del { color: var(--dim); font-weight: 400; font-size: 14px; order: 2; }
.qq-single .woocommerce-product-details__short-description { color: var(--dim); font-size: 14px; line-height: 1.65; }
.qq-single .button.single_add_to_cart_button { background: var(--accent); border-radius: 999px; padding: 12px 30px; font-size: 15px; }
.qq-single .quantity .qty { border: 1px solid var(--border); border-radius: 999px; padding: 9px 6px; min-height: 46px; font-size: 15px; }
.qq-single .button.single_add_to_cart_button { min-height: 46px; }
.woocommerce-cart-form .quantity .qty { min-height: 42px; border: 1px solid var(--border); border-radius: 8px; padding: 6px 4px; }
.qq-ship-note { background: var(--surface2); border: 0; color: var(--text); border-radius: 12px; padding: 11px 14px; font-size: 12.5px; line-height: 1.6; margin: 12px 0; }
.qq-detail { clear: both; margin-top: 24px; border-top: 1px solid var(--border); padding-top: 16px; }
.qq-single .related { clear: both; margin-top: 20px; }
.qq-single .related ul.products { margin-bottom: 0; }
/* Related/upsell/cross-sell loops carry WooCommerce columns-* classes whose floated
   percentage widths override the theme's row layout and squeeze cards into a
   narrow column — force full-width rows there. */
.qq-single .related ul.products li.product,
.qq-single .upsells ul.products li.product,
.woocommerce .cross-sells ul.products li.product {
  width: 100% !important;
  float: none !important;
  clear: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}
/* Shop/category/search loops also carry columns-* classes: on narrow screens
   WooCommerce floats items at 48% and squeezes the theme's rows into a narrow
   column. Force the theme layout on every qq-list / qq-grid loop. */
.woocommerce ul.products.qq-list li.product {
  width: 100% !important;
  float: none !important;
  clear: none !important;
  margin: 0 !important;
}
.woocommerce ul.products.qq-grid li.product {
  float: none !important;
  clear: none !important;
  margin: 0 !important;
}
/* Checkout order summary: keep the review table inside the card on phones. */
.woocommerce-checkout .woocommerce-checkout-review-order-table {
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
}
.woocommerce-checkout .woocommerce-checkout-review-order-table td,
.woocommerce-checkout .woocommerce-checkout-review-order-table th {
  word-break: break-word;
}
.woocommerce-checkout .woocommerce-checkout-review-order-table .product-total,
.woocommerce-checkout .woocommerce-checkout-review-order-table td.product-total {
  white-space: nowrap;
  text-align: right;
}

/* ============ narrow screens (<=640px): keep header + list rows inside the viewport ============ */
@media (max-width: 640px) {
  .qq-wrap { padding: 0 20px; }
  .qq-topbar { font-size: 11.5px; letter-spacing: 0; padding-left: 20px; padding-right: 20px; }
  .qq-header-in { gap: 8px; padding-top: 12px; padding-bottom: 6px; }
  .qq-logo { font-size: 22px; }
  .qq-shop-sub { font-size: 11px; }
  .qq-cart-pill { padding: 7px 12px; font-size: 13px; }
  .qq-row { gap: 10px; padding: 8px; }
  .qq-row-img { flex-basis: 120px; width: 120px; min-height: 120px; }
  .qq-row-info .price { font-size: 18px; }
  .qq-row-btns { width: 100%; }
}
.qq-detail h2 { font-size: 15px; font-weight: 800; margin: 0 0 10px; }
.qq-detail p { color: #4A4046; font-size: 14px; line-height: 1.7; }
.qq-detail img { width: 100%; border-radius: 16px; margin: 12px 0 0; }
.qq-detail .qq-cap { text-align: center; font-size: 12px; color: var(--dim); margin: 6px 0 0; }
.qq-spec-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.qq-spec-grid > div { background: var(--surface2); border-radius: 12px; padding: 10px 12px; font-size: 12px; }
.qq-spec-grid span { display: block; color: var(--dim); margin-bottom: 2px; }
.qq-spec-grid b { font-size: 13px; }
.qq-privacy-box { background: var(--surface2); border-radius: 12px; padding: 12px 14px; font-size: 12px; line-height: 1.7; margin-top: 16px; color: var(--text); }

/* hide default tabs (detail is rendered vertically instead) */
.woocommerce-tabs { display: none; }

/* ============ footer / age gate ============ */
.qq-footer { margin-top: 34px; background: var(--surface); border-top: 1px solid var(--border); color: var(--dim); font-size: 12.5px; padding: 26px 0 30px; }
.qq-footer-cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 18px; }
@media (max-width: 640px) { .qq-footer-cols { grid-template-columns: 1fr; } }
.qq-footer h4 { color: var(--text); font-size: 15px; font-weight: 800; margin: 0 0 8px; }
.qq-footer a { display: block; line-height: 2; }
.qq-footer a:hover { color: var(--accent); }
.qq-footer-note { margin-top: 18px; font-size: 11.5px; line-height: 1.8; border-top: 1px solid var(--border); padding-top: 12px; }
.qq-agegate { position: fixed; inset: 0; background: rgba(24, 18, 24, .82); z-index: 999; display: flex; align-items: center; justify-content: center; padding: 20px; }
.qq-agegate-box { background: var(--surface); border-radius: 18px; max-width: 340px; width: 100%; padding: 26px 22px; text-align: center; }
.qq-agegate-box h3 { margin: 0 0 8px; font-size: 19px; }
.qq-agegate-box p { color: var(--dim); font-size: 13.5px; margin: 0 0 16px; }
.qq-agegate-box button { background: var(--accent); color: #fff; border: 0; border-radius: 999px; padding: 11px 30px; font-size: 15px; cursor: pointer; width: 100%; }
.qq-agegate-box a { display: block; margin-top: 12px; color: var(--dim); font-size: 13px; }

/* WooCommerce notices / cart / checkout basics */
.woocommerce-message, .woocommerce-info { border-top-color: var(--accent); }
.woocommerce #respond input#submit, .woocommerce a.button, .woocommerce button.button, .woocommerce input.button { border-radius: 999px; }
.woocommerce form .form-row input.input-text, .woocommerce form .form-row textarea { border: 1px solid var(--border); border-radius: 10px; padding: 9px 10px; }
.woocommerce-ordering select { border: 1px solid var(--border); border-radius: 999px; padding: 6px 10px; background: var(--surface); }
