/* ============================================================================
   buygood.tw 好物選 — Programmatic SEO / GEO / AEO Pages Stylesheet
   Compliant with UI Iron Rules:
   1. Zero text clipping or overflow:hidden truncation on dynamic text
   2. Keep-all + text-wrap: balance to prevent awkward Chinese word-splitting
   3. Fluid min(1160px, 94vw) container & 38% / 62% desktop detail split
   4. Senior-safe clamp() typography & padding
   ============================================================================ */

:root {
  --seo-bg: #f8fafc;
  --seo-card: #ffffff;
  --seo-border: #e2e8f0;
  --seo-text: #0f172a;
  --seo-muted: #475569;
  --seo-primary: #c2410c;
  --seo-primary-hover: #9a3412;
  --seo-primary-soft: rgba(234, 88, 12, 0.1);
  --seo-green: #15803d;
  --seo-green-soft: rgba(21, 128, 61, 0.1);
  --seo-shadow: 0 4px 18px rgba(15, 23, 42, 0.05);
}

*, *::before, *::after {
  box-sizing: border-box;
}

body.seo-page {
  margin: 0;
  padding: 0;
  background: var(--seo-bg);
  color: var(--seo-text);
  font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body.seo-page h1,
body.seo-page h2,
body.seo-page h3 {
  word-break: keep-all;
  text-wrap: balance;
}

.seo-container {
  width: 100%;
  max-width: min(1160px, 94vw);
  margin: 0 auto;
  padding: clamp(16px, 3vw, 28px) 0 48px;
}

/* Header */
.seo-header {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--seo-border);
  position: sticky;
  top: 0;
  z-index: 40;
}

.seo-header__inner {
  width: 100%;
  max-width: min(1160px, 94vw);
  margin: 0 auto;
  padding: 12px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.seo-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--seo-text);
  font-weight: 800;
  font-size: clamp(1.05rem, 1.8vw, 1.25rem);
  word-break: keep-all;
}

.seo-brand__icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, #c2410c, #b45309);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.seo-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.seo-nav__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: clamp(0.84rem, 1.2vw, 0.92rem);
  font-weight: 600;
  color: var(--seo-muted);
  text-decoration: none;
  background: #f1f5f9;
  transition: background 0.15s ease, color 0.15s ease;
  word-break: keep-all;
}

.seo-nav__link:hover,
.seo-nav__link--active {
  background: var(--seo-primary);
  color: #ffffff;
}

/* Breadcrumb */
.seo-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: clamp(0.82rem, 1.2vw, 0.9rem);
  color: var(--seo-muted);
  margin-bottom: 16px;
  word-break: keep-all;
}

.seo-breadcrumb a {
  color: var(--seo-primary);
  text-decoration: none;
  font-weight: 600;
}

.seo-breadcrumb a:hover {
  text-decoration: underline;
}

/* Hero / Summary Cards */
.seo-hero {
  background: var(--seo-card);
  border: 1px solid var(--seo-border);
  border-radius: 18px;
  padding: clamp(20px, 3vw, 32px);
  box-shadow: var(--seo-shadow);
  margin-bottom: 24px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.seo-badge {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  max-width: 100%;
  box-sizing: border-box;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 99px;
  background: var(--seo-primary-soft);
  color: #9a3412;
  font-size: clamp(0.8rem, 1.2vw, 0.9rem);
  font-weight: 800;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: anywhere;
  margin-bottom: 12px;
}

.seo-title {
  margin: 0 0 12px;
  font-size: clamp(1.38rem, 2.8vw, 2.05rem);
  font-weight: 900;
  line-height: 1.32;
  color: var(--seo-text);
  word-break: keep-all;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.seo-answer-box {
  background: #fff7ed;
  border-left: 4px solid var(--seo-primary);
  border-radius: 0 12px 12px 0;
  padding: clamp(12px, 2vw, 18px);
  margin: 14px 0;
  font-size: clamp(0.94rem, 1.4vw, 1.05rem);
  color: #1e293b;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

/* Stat Strip */
.seo-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  gap: 12px;
  margin-top: 18px;
}

.seo-stat-card {
  background: #f8fafc;
  border: 1px solid var(--seo-border);
  border-radius: 12px;
  padding: 12px 14px;
  min-width: 0;
}

.seo-stat-card__label {
  font-size: clamp(0.78rem, 1.1vw, 0.86rem);
  color: var(--seo-muted);
  font-weight: 600;
}

.seo-stat-card__value {
  font-size: clamp(1.1rem, 1.8vw, 1.35rem);
  font-weight: 900;
  color: var(--seo-primary);
  word-break: keep-all;
}

/* Filter Toolbar & Category Pills */
.seo-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.seo-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 99px;
  border: 1px solid var(--seo-border);
  background: #ffffff;
  color: var(--seo-text);
  font-size: clamp(0.84rem, 1.25vw, 0.94rem);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: normal;
  max-width: 100%;
  box-sizing: border-box;
  word-break: keep-all;
  transition: all 0.15s ease;
}

.seo-pill:hover,
.seo-pill--active {
  background: var(--seo-primary);
  border-color: var(--seo-primary);
  color: #ffffff;
}

.seo-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
  gap: 12px;
  background: var(--seo-card);
  border: 1px solid var(--seo-border);
  border-radius: 14px;
  padding: clamp(14px, 2vw, 20px);
  margin-bottom: 20px;
}

.seo-input,
.seo-select {
  width: 100%;
  min-width: 0;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1.5px solid #cbd5e1;
  font-size: clamp(0.9rem, 1.3vw, 1rem);
  color: var(--seo-text);
  background: #ffffff;
}

.seo-input:focus:not(:focus-visible),
.seo-select:focus:not(:focus-visible) {
  outline: none;
}

.seo-input:focus,
.seo-select:focus {
  border-color: var(--seo-primary);
}

:is(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2.5px solid var(--seo-primary, #c2410c) !important;
  outline-offset: 2px;
}

/* Deal Card Grid */
.seo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 18px;
}

.deal-tile {
  background: var(--seo-card);
  border: 1px solid var(--seo-border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--seo-shadow);
  min-width: 0;
  max-width: 100%;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.deal-tile > * {
  min-width: 0;
  max-width: 100%;
}

.deal-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.09);
}

.deal-tile__img-wrap {
  aspect-ratio: 4 / 3;
  background: #ffffff;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid #f1f5f9;
  position: relative;
  min-width: 0;
  max-width: 100%;
}

.deal-tile__img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.deal-tile__discount {
  position: absolute;
  top: 10px;
  left: 10px;
  background: #dc2626;
  color: #ffffff;
  font-size: clamp(0.74rem, 1.1vw, 0.82rem);
  font-weight: 900;
  padding: 4px 10px;
  border-radius: 99px;
  max-width: calc(100% - 20px);
  box-sizing: border-box;
  white-space: normal;
  word-break: keep-all;
  text-wrap: balance;
  line-height: 1.3;
}

.deal-tile__body {
  padding: clamp(14px, 2vw, 18px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-width: 0;
  max-width: 100%;
}

.deal-tile__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--seo-muted);
  font-weight: 700;
  word-break: keep-all;
  overflow-wrap: break-word;
  min-width: 0;
  max-width: 100%;
}

.deal-tile__title {
  margin: 0;
  font-size: clamp(0.98rem, 1.4vw, 1.08rem);
  font-weight: 800;
  line-height: 1.42;
  color: var(--seo-text);
  word-break: keep-all;
  overflow-wrap: anywhere;
  text-wrap: balance;
  min-width: 0;
  max-width: 100%;
}

.deal-tile__title a {
  color: inherit;
  text-decoration: none;
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.deal-tile__title a:hover {
  color: var(--seo-primary);
}

.deal-tile__calc {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: clamp(0.84rem, 1.2vw, 0.94rem);
  font-weight: 700;
  white-space: normal;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.deal-tile__price-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: auto;
}

.deal-tile__sale {
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  font-weight: 900;
  color: #dc2626;
}

.deal-tile__orig {
  font-size: 0.88rem;
  color: #475569;
  text-decoration: line-through;
}

.deal-tile__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.seo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  padding: clamp(9px, 1.4vw, 12px) clamp(14px, 2vw, 20px);
  border-radius: 10px;
  font-size: clamp(0.88rem, 1.3vw, 1rem);
  font-weight: 800;
  text-decoration: none;
  border: none;
  cursor: pointer;
  white-space: normal;
  max-width: 100%;
  box-sizing: border-box;
  word-break: keep-all;
  text-align: center;
}

.seo-btn--primary {
  background: linear-gradient(135deg, #c2410c, #b91c1c);
  color: #ffffff;
  flex: 1 1 auto;
}

.seo-btn--primary:hover {
  background: linear-gradient(135deg, #9a3412, #991b1b);
}

.seo-btn--secondary {
  background: #f1f5f9;
  color: var(--seo-text);
  border: 1px solid #cbd5e1;
}

.seo-btn--line {
  background: linear-gradient(135deg, #15803d, #166534);
  color: #ffffff;
}

.seo-btn--threads {
  background: #0f172a;
  color: #ffffff;
}

/* Single Product Detail Two-Column Split (38% Image / 62% Details on Desktop) */
.product-detail-card {
  background: var(--seo-card);
  border: 1px solid var(--seo-border);
  border-radius: 20px;
  padding: clamp(18px, 3vw, 32px);
  box-shadow: var(--seo-shadow);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(20px, 3vw, 34px);
  margin-bottom: 24px;
}

@media (min-width: 768px) {
  .product-detail-card {
    grid-template-columns: minmax(220px, calc(38% - 16px)) minmax(0, calc(62% - 18px));
    align-items: start;
  }
}

.product-detail__media {
  background: #ffffff;
  border: 1px solid #f1f5f9;
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.product-detail__media img {
  width: 100%;
  max-width: 360px;
  max-height: 360px;
  object-fit: contain;
}

.product-detail__content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.calc-pill-elastic {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  max-width: 100%;
  box-sizing: border-box;
  white-space: normal;
  background: #fff7ed;
  border: 1.5px solid #fdba74;
  color: #9a3412;
  border-radius: 12px;
  padding: clamp(8px, 1.4vw, 12px) clamp(14px, 2vw, 18px);
  font-size: clamp(0.95rem, 1.3vw, 1.15rem);
  font-weight: 800;
  word-break: keep-all;
}

/* Comparison Table & Calculator */
.seo-section {
  background: var(--seo-card);
  border: 1px solid var(--seo-border);
  border-radius: 18px;
  padding: clamp(18px, 2.8vw, 28px);
  box-shadow: var(--seo-shadow);
  margin-bottom: 24px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.seo-section__title {
  margin: 0 0 14px;
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  font-weight: 900;
  word-break: keep-all;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.seo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: clamp(0.86rem, 1.25vw, 0.96rem);
  min-width: 540px;
}

.seo-table th,
.seo-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--seo-border);
  text-align: left;
  vertical-align: middle;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.seo-table th {
  background: #f8fafc;
  font-weight: 800;
  color: var(--seo-text);
}

.seo-table tr.is-lowest {
  background: #fff7ed;
}

/* Calculator Widget */
.calc-widget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 16px;
}

.calc-plan-box {
  background: #f8fafc;
  border: 1px solid var(--seo-border);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.calc-result-banner {
  margin-top: 14px;
  padding: 14px 18px;
  border-radius: 12px;
  background: #ecfdf5;
  border: 1.5px solid #86efac;
  color: #166534;
  font-weight: 800;
  font-size: clamp(0.95rem, 1.4vw, 1.1rem);
  word-break: keep-all;
}

/* FAQ List */
.seo-faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.seo-faq-item {
  border: 1px solid var(--seo-border);
  border-radius: 12px;
  padding: 14px 18px;
  background: #f8fafc;
  min-width: 0;
  overflow-wrap: anywhere;
}

.seo-faq-item__q {
  margin: 0 0 6px;
  font-size: clamp(0.98rem, 1.4vw, 1.08rem);
  font-weight: 800;
  color: #9a3412;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.seo-faq-item__a {
  margin: 0;
  font-size: clamp(0.88rem, 1.25vw, 0.98rem);
  color: var(--seo-muted);
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* Footer */
.seo-footer {
  background: #ffffff;
  border-top: 1px solid var(--seo-border);
  padding: 28px 0 36px;
  margin-top: 32px;
}

.seo-footer__inner {
  width: 100%;
  max-width: min(1160px, 94vw);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.88rem;
  color: var(--seo-muted);
}

.seo-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.seo-footer__links a {
  color: var(--seo-muted);
  text-decoration: none;
  font-weight: 600;
}

.seo-footer__links a:hover {
  color: var(--seo-primary);
}

/* Scenario Quick-Picker & Editorial Matrix (AEO / GEO / Anti-Bounce) */
.seo-scenario-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 4px;
}

.seo-scenario-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1.5px solid #fed7aa;
  background: #fff7ed;
  color: #9a3412;
  font-size: clamp(0.84rem, 1.2vw, 0.94rem);
  font-weight: 800;
  cursor: pointer;
  white-space: normal;
  max-width: 100%;
  box-sizing: border-box;
  word-break: keep-all;
  transition: all 0.15s ease;
}

.seo-scenario-btn:hover,
.seo-scenario-btn--active {
  background: var(--seo-primary);
  border-color: var(--seo-primary);
  color: #ffffff;
}

.seo-editorial-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 14px;
  margin-top: 12px;
}

.seo-editorial-card {
  background: #f8fafc;
  border: 1px solid var(--seo-border);
  border-radius: 14px;
  padding: 16px;
  min-width: 0;
  word-break: keep-all;
  overflow-wrap: anywhere;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.seo-editorial-card__tag {
  display: inline-block;
  align-self: flex-start;
  background: var(--seo-primary-soft);
  color: #9a3412;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 99px;
}

.seo-editorial-card__title {
  margin: 0;
  font-size: clamp(0.96rem, 1.35vw, 1.06rem);
  font-weight: 800;
  color: var(--seo-text);
  line-height: 1.4;
  text-wrap: balance;
}

.seo-editorial-card__title a {
  color: inherit;
  text-decoration: none;
}

.seo-editorial-card__title a:hover {
  color: var(--seo-primary);
}

.seo-editorial-card__desc {
  margin: 0;
  font-size: 0.88rem;
  color: var(--seo-muted);
  line-height: 1.6;
}

.seo-checklist {
  margin: 10px 0 0;
  padding-left: 20px;
  line-height: 1.75;
  color: var(--seo-text);
  font-size: clamp(0.9rem, 1.3vw, 0.98rem);
  word-break: keep-all;
}

/* Guided Next-Step Funnel (Anti-Bounce Cross Navigation) */
.seo-guided-funnel {
  background: linear-gradient(135deg, #fff7ed 0%, #ffffff 100%);
  border: 1.5px solid #fed7aa;
  border-radius: 18px;
  padding: clamp(18px, 3vw, 28px);
  margin: 24px 0;
}

.seo-funnel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 12px;
  margin-top: 14px;
}

.seo-funnel-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #ffffff;
  border: 1px solid var(--seo-border);
  border-radius: 12px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--seo-text);
  min-width: 0;
  word-break: keep-all;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.seo-funnel-card:hover {
  transform: translateY(-2px);
  border-color: var(--seo-primary);
}

.seo-funnel-card__eyebrow {
  font-size: 0.78rem;
  font-weight: 800;
  color: #9a3412;
}

.seo-funnel-card__title {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--seo-text);
  word-break: keep-all;
  text-wrap: balance;
}

.seo-funnel-card__desc {
  font-size: 0.85rem;
  color: var(--seo-muted);
}

/* Mobile Sticky Dual CTA Bar on Product Detail Pages */
.seo-sticky-cta {
  display: none;
}

@media (max-width: 767px) {
  body.seo-page.seo-has-sticky {
    padding-bottom: 78px;
  }

  .seo-sticky-cta {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--seo-border);
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
  }

  .seo-sticky-cta .seo-btn {
    padding: 10px 12px;
    font-size: 0.86rem;
    line-height: 1.25;
  }
}

/* ===== Preorder / Group-Buy Badge & Shipping ETA Banner (M2 -> M3/M4 Contract) ===== */
.preorder-badge {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 100%;
  box-sizing: border-box;
  padding: clamp(5px, 1vw, 7px) clamp(10px, 1.8vw, 14px);
  border-radius: 99px;
  background: var(--seo-primary-soft);
  border: 1.5px solid #fb923c;
  color: #9a3412;
  font-size: clamp(0.8rem, 1.25vw, 0.92rem);
  font-weight: 800;
  line-height: 1.4;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.shipping-eta-banner,
.seo-preorder-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: clamp(10px, 1.8vw, 14px) clamp(12px, 2vw, 16px);
  border-radius: 12px;
  background: #fffbeb;
  border: 1.5px solid #f59e0b;
  color: #78350f;
  font-size: clamp(0.86rem, 1.3vw, 0.96rem);
  line-height: 1.55;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}

