/* ==========================================================================
   SYUBEA shop - storefront, cart, checkout, orders and admin editor
   ========================================================================== */

.shop-hero .page-hero-desc { max-width: 760px; }
.shop-section { padding-top: 54px; }
.shop-notice {
  background: var(--bg-alt); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 18px; margin: 0 0 20px; color: var(--text); font-size: 14.5px;
}
.shop-bank-strip {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: var(--radius);
  padding: 13px 18px; margin: 0 0 24px; font-size: 14.5px; color: var(--brand-800);
}
.shop-bank-strip strong { color: var(--brand-700); }
.shop-toolbar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-bottom: 24px;
}
.shop-tabs { margin-bottom: 0; flex-wrap: wrap; }
.shop-search { margin-left: auto; }
.shop-result-count { margin: 0; font-size: 14px; color: var(--muted); font-weight: 600; }

/* ---------- category sidebar ---------- */
.shop-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 32px; align-items: start; }
.shop-main { min-width: 0; }
.shop-sidebar {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 18px; position: sticky; top: 100px;
}
.shop-sidebar-title { font-size: 16px; font-weight: 800; margin: 0 0 14px; }
.shop-cat-nav { display: grid; gap: 4px; }
.shop-cat-all, .shop-cat-parent, .shop-cat-list a {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 8px; color: var(--text);
  text-decoration: none; font-size: 14px; line-height: 1.4;
}
.shop-cat-all:hover, .shop-cat-parent:hover, .shop-cat-list a:hover { background: var(--bg-alt); }
.shop-cat-all.is-on, .shop-cat-parent.is-on, .shop-cat-list a.is-on {
  background: var(--brand-50); color: var(--brand-800); font-weight: 800;
}
.shop-cat-group { margin-top: 4px; }
.shop-cat-parent { font-weight: 800; }
.shop-cat-list { list-style: none; margin: 2px 0 0; padding: 0 0 0 10px; display: grid; gap: 2px; }
.shop-cat-list a { font-weight: 500; padding-left: 12px; }
.shop-cat-count { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.shop-cat-all.is-on .shop-cat-count,
.shop-cat-parent.is-on .shop-cat-count,
.shop-cat-list a.is-on .shop-cat-count { color: var(--brand-700); }
.shop-card-cat { font-size: 12px; color: var(--brand-700); font-weight: 700; margin: 0 0 4px; }

/* ---------- product grid ---------- */
.shop-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.shop-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm); transition: all .2s ease;
}
.shop-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--brand-100); }
.shop-card-link { display: block; color: inherit; text-decoration: none; }
.shop-card-link:hover { color: inherit; }
.shop-thumb { position: relative; aspect-ratio: 1; background: var(--bg-alt); overflow: hidden; }
.shop-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.shop-card:hover .shop-thumb img { transform: scale(1.04); }
.shop-thumb-empty {
  width: 100%; height: 100%; display: grid; place-items: center;
  color: var(--brand-700); font-weight: 800; letter-spacing: .14em; font-size: 14px;
  background: linear-gradient(135deg, var(--brand-50), var(--brand-100));
}
.shop-thumb-empty.lg { min-height: 360px; font-size: 22px; border-radius: var(--radius); }
.shop-soldout {
  position: absolute; inset: auto 12px 12px auto; background: rgba(11,43,39,.82); color: #fff;
  font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 99px;
}
.shop-card-body { padding: 18px 20px 22px; }
.shop-card-body h3 { font-size: 17.5px; margin-bottom: 7px; }
.shop-card-summary { font-size: 13.6px; color: var(--muted); margin: 0 0 12px; min-height: 2.7em; }
.shop-card-price { font-size: 16px; font-weight: 800; color: var(--ink); margin: 0 0 8px; }
.shop-stock { font-size: 12.5px; font-weight: 700; }
.shop-stock.is-ok { color: var(--brand-700); }
.shop-stock.is-out { color: var(--danger); }

/* ---------- product detail ---------- */
.shop-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 46px; align-items: start; }
.shop-gallery-main { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--bg-alt); }
.shop-gallery-main img { width: 100%; height: auto; display: block; }
.shop-gallery-thumbs { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.shop-thumb-btn {
  width: 76px; height: 76px; padding: 0; border: 2px solid var(--line); border-radius: 10px;
  background: #fff; overflow: hidden; cursor: pointer;
}
.shop-thumb-btn img { width: 100%; height: 100%; object-fit: cover; }
.shop-thumb-btn.is-on, .shop-thumb-btn:hover { border-color: var(--brand); }
.shop-info h1 { font-size: clamp(26px, 3vw, 36px); font-weight: 800; margin-bottom: 10px; }
.shop-summary { color: var(--text); font-size: 16px; margin-bottom: 16px; }
.shop-price { font-size: 28px; font-weight: 800; color: var(--brand-700); margin: 0 0 6px; letter-spacing: -0.02em; }
.shop-stock-line { font-size: 14px; color: var(--muted); margin-bottom: 22px; }
.shop-stock-line strong { color: var(--ink); }
.shop-options { display: grid; gap: 12px; margin-bottom: 18px; }
.shop-options label { font-weight: 700; font-size: 14px; color: var(--ink); }
.shop-options select {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
  border: 1.5px solid var(--line); border-radius: 10px; font: inherit; background: #fff;
}
.shop-add-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.shop-qty-label { font-weight: 700; font-size: 14px; color: var(--ink); }
.shop-qty-label input {
  display: block; width: 94px; margin-top: 6px; padding: 10px 12px;
  border: 1.5px solid var(--line); border-radius: 10px; font: inherit;
}
.shop-login-note { background: var(--bg-alt); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 22px; }
.shop-login-note .btn { margin-left: 6px; }
.shop-buy-info {
  background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: var(--radius);
  padding: 18px 20px; font-size: 14px;
}
.shop-buy-info h4 { margin-bottom: 8px; color: var(--brand-800); }
.shop-buy-info ul { margin: 0; padding-left: 18px; }
.shop-buy-info li { padding: 3px 0; }
.shop-description { margin-top: 54px; }
.product-md { max-width: 900px; }
.product-md img { border-radius: var(--radius); }

/* ---------- cart ---------- */
.cart-layout { display: grid; grid-template-columns: 1fr 330px; gap: 28px; align-items: start; }
.cart-table th, .cart-table td { vertical-align: middle; }
.cart-product { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.cart-product img, .cart-thumb-empty {
  width: 62px; height: 62px; border-radius: 9px; object-fit: cover; flex: none;
  border: 1px solid var(--line); background: var(--bg-alt);
}
.cart-thumb-empty { display: grid; place-items: center; font-size: 9px; color: var(--brand-700); font-weight: 800; }
.cart-product a { color: var(--ink); font-weight: 700; }
.cart-product a:hover { color: var(--brand-600); }
.cart-bad { color: var(--danger); font-size: 12.5px; margin: 3px 0 0; }
.cart-qty {
  width: 78px; padding: 8px 9px; border: 1.5px solid var(--line); border-radius: 8px; font: inherit;
}
.cart-remove { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); }
.cart-remove input { width: auto; }
.cart-actions { justify-content: flex-start; }
.cart-summary {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 24px;
}
.cart-summary h2 { font-size: 20px; margin-bottom: 16px; }
.cart-summary dl, .checkout-summary dl, .order-totals {
  margin: 0 0 16px; padding: 0;
}
.cart-summary dl > div, .checkout-summary dl > div, .order-totals > div {
  display: flex; justify-content: space-between; gap: 14px; padding: 9px 0;
  border-bottom: 1px solid var(--line); font-size: 14.5px;
}
.cart-summary dl > div:last-child, .checkout-summary dl > div:last-child, .order-totals > div:last-child { border-bottom: 0; }
.cart-summary dt, .checkout-summary dt, .order-totals dt { color: var(--muted); }
.cart-summary dd, .checkout-summary dd, .order-totals dd { margin: 0; font-weight: 700; color: var(--ink); }
.cart-summary .total dd, .checkout-summary .total dd, .order-totals .total dd {
  color: var(--brand-700); font-size: 20px; font-weight: 800;
}
.cart-clear { margin-top: 16px; text-align: right; }

/* ---------- checkout ---------- */
.checkout-layout { display: grid; grid-template-columns: 1fr 360px; gap: 30px; align-items: start; }
.checkout-main .block-title { margin-top: 0; }
.checkout-summary {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 24px; position: sticky; top: 96px;
}
.checkout-summary h2 { font-size: 20px; margin-bottom: 16px; }
.checkout-items { list-style: none; margin: 0 0 18px; padding: 0; }
.checkout-items li {
  display: flex; justify-content: space-between; gap: 12px; padding: 9px 0;
  border-bottom: 1px solid var(--line); font-size: 14px;
}
.checkout-items li:last-child { border-bottom: 0; }
.checkout-items small { display: block; color: var(--muted); font-size: 12px; }
.pay-box {
  background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: var(--radius);
  padding: 16px 18px; margin: 6px 0 18px;
}
.pay-box h3 { font-size: 16px; color: var(--brand-800); margin-bottom: 8px; }
.pay-box p { margin: 0 0 6px; font-size: 14px; }
.shop-business-info { border-top: 1px solid var(--line); margin-top: 32px; padding-top: 16px; }

/* ---------- order complete / detail ---------- */
.order-complete-head { text-align: center; margin-bottom: 28px; }
.order-complete-head h1 { font-size: clamp(24px, 3vw, 32px); }
.bank-box {
  background: var(--brand-50); border: 2px solid var(--brand-100); border-radius: var(--radius);
  padding: 22px 24px; margin: 20px 0;
}
.bank-box h2 { font-size: 19px; color: var(--brand-800); margin-bottom: 12px; }
.bank-box dl { margin: 0; }
.bank-box dl > div { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px dashed var(--brand-100); font-size: 14.5px; }
.bank-box dl > div:last-child { border-bottom: 0; }
.bank-box dt { color: var(--muted); }
.bank-box dd { margin: 0; font-weight: 700; color: var(--ink); }
.order-complete-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 26px; }
.order-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.order-timeline { list-style: none; margin: 0; padding: 0; }
.order-timeline li { border-left: 2px solid var(--brand-100); padding: 0 0 14px 14px; margin-left: 5px; }
.order-timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.order-timeline .badge { margin-right: 6px; }
.order-timeline p { margin: 4px 0 0; }

/* ---------- legal ---------- */
.legal-doc .block-title { margin-top: 30px; }
.legal-body { font-size: 15px; line-height: 1.85; color: var(--text); }

/* ---------- status badges ---------- */
.badge-paid { background: #EAF4FF; color: #1D5C9E; border: 1px solid #CFE4FA; }
.badge-ready { background: #FFF3E6; color: #9A5A0B; border: 1px solid #F5DDBE; }
.badge-ship { background: #EEF7FF; color: #2463A6; border: 1px solid #D3E6F7; }
.badge-cancel { background: #FDF1F0; color: #B93B38; border: 1px solid #F5C8C5; }

/* ---------- admin product/list ---------- */
.shop-admin-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.admin-thumb, .admin-thumb-empty {
  width: 54px; height: 54px; border-radius: 8px; object-fit: cover;
  border: 1px solid var(--line); background: var(--bg-alt);
}
.admin-thumb-empty { display: inline-grid; place-items: center; color: var(--muted); }
.shop-admin-images { display: flex; gap: 14px; flex-wrap: wrap; margin: 14px 0; }
.shop-admin-image {
  width: 150px; border: 1px solid var(--line); border-radius: 11px; padding: 8px; background: #fff;
}
.shop-admin-image img { width: 100%; height: 120px; object-fit: cover; border-radius: 7px; }
.shop-admin-image-actions { display: flex; justify-content: space-between; gap: 6px; margin-top: 7px; }
.shop-image-upload { margin-top: 14px; }
.api-token { display: inline-block; margin-top: 8px; padding: 7px 10px; background: #fff; border: 1px solid var(--brand-100); border-radius: 8px; font-size: 13px; }
.api-token-form { margin-top: 14px; }
.shop-settings-form .block-title { margin-top: 34px; }
.shop-settings-form .block-title:first-of-type { margin-top: 0; }

/* ---------- admin order/member ---------- */
.admin-order-grid { display: grid; grid-template-columns: 1fr 360px; gap: 28px; align-items: start; }
.admin-order-grid aside { position: sticky; top: 96px; }
.post-form.compact label { margin-bottom: 10px; }
.post-form.compact input, .post-form.compact textarea, .post-form.compact select { margin-top: 5px; }
.member-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.panel-like {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 24px;
}
.panel-like .block-title { margin-top: 0; }

/* ---------- Markdown editor ---------- */
.md-editor {
  border: 1.5px solid var(--line); border-radius: 12px; background: #fff; margin: 8px 0 18px;
  overflow: hidden;
}
.md-editor.is-max { position: fixed; inset: 24px; z-index: 300; box-shadow: var(--shadow-lg); background: #fff; }
.md-editor.is-max .md-pane textarea { height: calc(100vh - 190px); }
.md-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--bg-alt); border-bottom: 1px solid var(--line); padding: 8px 10px; }
.md-tabs { display: flex; gap: 4px; }
.md-tab {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  padding: 6px 12px; border-radius: 8px; font: inherit; font-size: 13px; cursor: pointer;
}
.md-tab.is-on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.md-tools { display: flex; gap: 4px; flex-wrap: wrap; }
.md-tool {
  border: 1px solid var(--line); background: #fff; color: var(--text);
  min-height: 30px; padding: 4px 9px; border-radius: 7px; font: inherit; font-size: 12.5px; cursor: pointer;
}
.md-tool:hover { border-color: var(--brand); color: var(--brand-700); }
.md-tool:disabled { opacity: .55; cursor: wait; }
.md-pane textarea {
  display: block; width: 100%; min-height: 320px; resize: vertical; border: 0;
  padding: 16px 18px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 14px; line-height: 1.65; color: var(--ink); outline: none;
}
.md-pane textarea.is-over { color: var(--danger); }
.md-preview { min-height: 320px; padding: 16px 18px; border-top: 0; }
.md-preview .empty { color: var(--muted); }
.md-count { text-align: right; font-size: 12px; color: var(--muted); padding: 6px 12px; border-top: 1px solid var(--line); background: #fff; }
.md-count.is-over { color: var(--danger); font-weight: 700; }
.md-image-pick-wrap { padding: 12px 14px; border-top: 1px solid var(--line); background: var(--bg-alt); }
.md-image-pick-wrap label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--ink); }
.md-image-pick-wrap select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 13px; }
.ai-pop {
  margin: 0; padding: 9px 12px; font-size: 13px; border-bottom: 1px solid var(--line);
  background: #F4F8FF; color: #24558F;
}
.ai-pop.is-ok { background: var(--brand-50); color: var(--brand-800); }
.ai-pop.is-err { background: #FDF1F0; color: #B93B38; }
.ai-pop.is-busy { background: #FFF7E8; color: #8A5D0B; }
.ai-pop[hidden] { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .shop-layout { grid-template-columns: 1fr; }
  .shop-sidebar { position: static; }
  .shop-grid { grid-template-columns: repeat(3, 1fr); }
  .cart-layout, .checkout-layout, .admin-order-grid, .member-detail-grid { grid-template-columns: 1fr; }
  .checkout-summary, .admin-order-grid aside { position: static; }
}
@media (max-width: 820px) {
  .shop-grid { grid-template-columns: repeat(2, 1fr); }
  .shop-detail { grid-template-columns: 1fr; gap: 26px; }
  .shop-toolbar { align-items: stretch; }
  .shop-search { margin-left: 0; width: 100%; }
  .shop-search input { flex: 1; width: auto; }
  .order-columns { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .shop-grid { grid-template-columns: 1fr; }
  .shop-card-summary { min-height: 0; }
  .shop-add-form { align-items: stretch; }
  .shop-add-form .btn { width: 100%; }
  .cart-product { min-width: 0; }
  .cart-table th:nth-child(3), .cart-table td:nth-child(3),
  .cart-table th:nth-child(6), .cart-table td:nth-child(6) { display: none; }
  .md-tool { font-size: 11.5px; padding: 4px 7px; }
  .md-bar { align-items: flex-start; }
  .md-editor.is-max { inset: 10px; }
  .md-editor.is-max .md-pane textarea { height: calc(100vh - 220px); }
  .shop-admin-image { width: calc(50% - 8px); }
}
