/* ============================================================
   CSS Custom Properties
   ============================================================ */
:root {
  --color-primary: #0866ff;
  --color-primary-dark: #0550d0;
  --color-primary-bg: #eff6ff;
  --color-text: #1e293b;
  --color-text-muted: #64748b;
  --color-text-light: #94a3b8;
  --color-border: #e2e8f0;
  --color-bg: #f1f5f9;
  --color-white: #ffffff;
  --color-green: #16a34a;
  --color-pink: #db2777;
  --color-price: #475569;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.10);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.14);
  --font: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --container: 1200px;
  --sidebar: 360px;
  --topbar-h: 60px;
  --mobile-bar-h: 72px;
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  padding-top: var(--topbar-h);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

ul { list-style: none; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

/* ============================================================
   Top Navigation Bar
   ============================================================ */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--topbar-h);
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  z-index: 200;
  box-shadow: var(--shadow-sm);
}

.topbar__inner {
  max-width: var(--container);
  margin: 0 auto;
  height: 100%;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar__back {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  flex-shrink: 0;
  transition: color 0.15s;
}
.topbar__back:hover { color: var(--color-primary); text-decoration: none; }

.topbar__publisher {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: center;
  min-width: 0;
}

.topbar__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--color-border);
  flex-shrink: 0;
}

.topbar__name {
  font-weight: 700;
  font-size: 15px;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

/* ============================================================
   Page Layout
   ============================================================ */
.page-main {
  max-width: var(--container);
  margin: 0 auto;
  padding: 28px 20px 32px;
}

.product-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--sidebar);
  gap: 32px;
  align-items: start;
}

/* ============================================================
   Gallery
   ============================================================ */
.gallery {
  margin-bottom: 20px;
  background: var(--color-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.gallery__hero {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}

.gallery__hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background 0.2s;
}
.gallery__nav:hover { background: rgba(0, 0, 0, 0.68); }
.gallery__nav--prev { left: 12px; }
.gallery__nav--next { right: 12px; }

.gallery__counter {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.50);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  user-select: none;
}

.gallery__thumbs {
  display: flex;
  gap: 8px;
  padding: 12px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.gallery__thumbs::-webkit-scrollbar { display: none; }

.gallery__thumb {
  flex: 0 0 94px;
  width: 94px;
  height: 56px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2.5px solid transparent;
  transition: border-color 0.2s;
  cursor: pointer;
  background: none;
}
.gallery__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.gallery__thumb--active { border-color: var(--color-primary); }
.gallery__thumb:hover:not(.gallery__thumb--active) { border-color: var(--color-text-light); }

/* ============================================================
   Product Intro
   ============================================================ */
.product-intro {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.product-intro__category {
  display: inline-block;
  padding: 4px 10px;
  background: var(--color-primary-bg);
  color: var(--color-primary);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin-bottom: 10px;
}

.product-intro__title {
  font-size: 26px;
  font-weight: 900;
  color: var(--color-text);
  line-height: 1.25;
  margin-bottom: 14px;
}

.product-intro__desc {
  font-size: 15px;
  color: var(--color-text-muted);
  line-height: 1.8;
  margin-bottom: 20px;
}

.product-intro__author {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid var(--color-border);
}

.product-intro__author-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--color-border);
  flex-shrink: 0;
}

.product-intro__author-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 2px;
}

.product-intro__author-sub {
  font-size: 13px;
  color: var(--color-text-muted);
}

/* ============================================================
   Gifts Section
   ============================================================ */
.gifts-section {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--color-pink);
}

.gifts-section__header {
  margin-bottom: 16px;
}

.gifts-section__heading-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.gifts-section__heading {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.4;
}
.gifts-section__heading strong { color: var(--color-pink); }

.gifts-section__total {
  font-size: 13px;
  color: var(--color-text-muted);
  padding-left: 28px;
}
.gifts-section__total strong { color: var(--color-text); font-weight: 700; }

.gifts-section__list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gift-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--color-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.gift-card__img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.gift-card__name {
  font-weight: 700;
  font-size: 14px;
  color: var(--color-text);
  margin-bottom: 3px;
}

.gift-card__value {
  font-size: 13px;
  color: var(--color-text-muted);
}
.gift-card__value strong { color: var(--color-pink); font-weight: 700; }

.gift-card__badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-white);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.gifts-section__special {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
  background: #fdf2f8;
  border: 1px solid #fbb6ce;
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--color-text);
}
.gifts-section__special svg { flex-shrink: 0; }
.gifts-section__special strong { color: var(--color-pink); }

/* ============================================================
   Publisher Card
   ============================================================ */
.publisher-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
}

.publisher-card__avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--color-border);
  flex-shrink: 0;
}

.publisher-card__name {
  font-weight: 700;
  font-size: 16px;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.publisher-card__desc {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 10px;
}

.publisher-card__link {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-primary);
}

/* ============================================================
   Product Description
   ============================================================ */
.product-desc {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.product-desc__heading {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--color-border);
}

.product-desc__img {
  width: 100%;
  border-radius: var(--radius-md);
}

.product-desc__sub {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  margin: 20px 0 10px;
}

.product-desc__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 4px;
}

.product-desc__list li {
  padding-left: 20px;
  position: relative;
  font-size: 14px;
  color: var(--color-text);
  line-height: 1.6;
}

.product-desc__list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--color-green);
  font-weight: 700;
}

.product-desc__para {
  font-size: 14px;
  color: var(--color-text);
  line-height: 1.7;
}

/* ============================================================
   Discussions CTA
   ============================================================ */
.discussions-cta {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: 18px 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.discussions-cta__text {
  font-size: 14px;
  color: var(--color-text-muted);
}

.discussions-cta__link {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-primary);
  white-space: nowrap;
}

/* ============================================================
   Buybox (Right Sidebar)
   ============================================================ */
.buybox {
  position: sticky;
  top: calc(var(--topbar-h) + 20px);
}

.buybox__card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  margin-bottom: 16px;
}

.buybox__plan-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

.buybox__plan-list {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.buybox__plan {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 0px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  width: 100%;
  text-align: left;
  background: var(--color-white);
}

.buybox__plan input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.buybox__plan--selected {
  border-color: var(--color-primary);
  background: var(--color-primary-bg);
}
.buybox__plan:hover:not(.buybox__plan--selected) {
  border-color: var(--color-text-light);
}

.buybox__plan-content {
  flex: 1;
  padding-left: 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.buybox__plan-duration {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.buybox__plan-price {
  font-size: 22px;
  font-weight: 900;
  color: var(--color-price);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.buybox__plan-price-orig {
  font-size: 13px;
  font-weight: 400;
  color: var(--color-text-light);
  letter-spacing: 0;
  text-decoration: line-through;
}

.buybox__plan-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
  flex-shrink: 0;
  background: var(--color-primary);
  color: #fff;
  transition: background 0.15s;
}
.buybox__plan:not(.buybox__plan--selected) .buybox__plan-check {
  background: var(--color-border);
  color: var(--color-border);
}

.buybox__cta-btn {
  width: 100%;
  padding: 15px 20px;
  background: var(--color-primary);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(8, 102, 255, 0.28);
}
.buybox__cta-btn:hover {
  background: var(--color-primary-dark);
  box-shadow: 0 4px 16px rgba(8, 102, 255, 0.36);
}
.buybox__cta-btn:active { transform: scale(0.98); }

.buybox__benefits {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.buybox__benefit {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.5;
}
.buybox__benefit svg { flex-shrink: 0; margin-top: 1px; }
.buybox__benefit strong { color: var(--color-text); font-weight: 700; }

/* Affiliate CTA */
.affiliate-cta {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
  border: 1px solid var(--color-border);
}

.affiliate-cta__text {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 8px;
  line-height: 1.55;
}

.affiliate-cta__link {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-primary);
}

/* Community Link */
.buybox__community {
  text-align: center;
  padding: 4px;
}
.buybox__community-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
}
.buybox__community-link:hover { color: var(--color-primary); text-decoration: none; }

/* ============================================================
   Verified Icon (inline)
   ============================================================ */
.verified-icon {
  vertical-align: middle;
  flex-shrink: 0;
}

/* ============================================================
   Mobile Action Bar
   ============================================================ */
.mobile-action-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--mobile-bar-h) + env(safe-area-inset-bottom, 0px));
  background: var(--color-white);
  border-top: 1px solid var(--color-border);
  padding: 0 16px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 100;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.10);
}

.mobile-action-bar__price-wrap {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.mobile-action-bar__label {
  font-size: 11px;
  color: var(--color-text-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.mobile-action-bar__price {
  font-size: 19px;
  font-weight: 900;
  color: var(--color-price);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.mobile-action-bar__btn {
  flex-shrink: 0;
  padding: 12px 22px;
  background: var(--color-primary);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s;
  box-shadow: 0 2px 8px rgba(8, 102, 255, 0.28);
}
.mobile-action-bar__btn:hover { background: var(--color-primary-dark); }

/* ============================================================
   Back to Top
   ============================================================ */
.back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  color: var(--color-text-muted);
  z-index: 99;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s, color 0.15s, border-color 0.15s;
}
.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.back-to-top:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

/* ============================================================
   Responsive — Tablet
   ============================================================ */
@media (max-width: 1024px) {
  :root { --sidebar: 300px; }

  .product-intro__title { font-size: 22px; }
}

/* ============================================================
   Responsive — Mobile
   ============================================================ */
@media (max-width: 768px) {
  body { padding-bottom: calc(var(--mobile-bar-h) + env(safe-area-inset-bottom, 0px)); }

  .page-main { padding: 16px 12px 24px; }

  .product-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  /* Reorder: buybox after content but visible inline */
  .buybox {
    position: static;
    order: 2;
  }

  .product-content {
    order: 1;
  }

  /* Simplify buybox card on mobile */
  .buybox__card {
    padding: 18px;
    box-shadow: var(--shadow-sm);
  }

  .product-intro {
    padding: 18px;
    margin-bottom: 14px;
  }

  .product-intro__title { font-size: 20px; }

  .gifts-section {
    padding: 18px;
    margin-bottom: 14px;
  }

  .publisher-card {
    flex-direction: column;
    text-align: center;
    gap: 12px;
    padding: 18px;
  }
  .publisher-card__name { justify-content: center; }

  .product-desc { padding: 18px; }

  .discussions-cta {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 16px 18px;
  }

  .mobile-action-bar { display: flex; }

  .back-to-top { bottom: calc(var(--mobile-bar-h) + 8px + env(safe-area-inset-bottom, 0px)); right: 12px; }
}

@media (max-width: 480px) {
  .topbar__inner { padding: 0 12px; }

  .topbar__badge { display: none; }

  .buybox__plan-price { font-size: 19px; }

  .mobile-action-bar__price { font-size: 17px; }

  .back-to-top { bottom: calc(var(--mobile-bar-h) + 8px + env(safe-area-inset-bottom, 0px)); right: 12px; }
}

/* ── Gift Accordion ─────────────────────────────────────────────── */
.gift-accordion {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.gift-accordion summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 0px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.gift-accordion summary::-webkit-details-marker { display: none; }

.gift-accordion__title {
  flex: 1;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--ink-900);
  line-height: 1.4;
}

.gift-accordion__arrow {
  flex-shrink: 0;
  color: var(--ink-400);
  transition: transform 0.3s ease;
}

.gift-accordion[open] > summary .gift-accordion__arrow {
  transform: rotate(180deg);
}

/* grid trick — smooth, no JS height needed */
.gift-accordion__body {
  display: grid !important;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s ease;
}

.gift-accordion[open] > .gift-accordion__body {
  grid-template-rows: 1fr;
}

.gift-accordion__inner {
  overflow: hidden;
  min-height: 0;
}

.gift-accordion[open] > .gift-accordion__body > .gift-accordion__inner {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
}

.gift-accordion__desc {
  font-size: 13px;
  color: var(--ink-500);
  margin: 0 0 10px;
  line-height: 1.55;
}

.gift-accordion__lessons {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.gift-accordion__lessons li {
  font-size: 12.5px;
  color: var(--ink-700);
  padding: 7px 8px;
  border-radius: 6px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.4;
}

.gift-accordion__lessons li:hover { background: var(--surface); }

.gift-accordion__lessons li::before {
  content: '';
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  margin-top: 1px;
  background-size: contain;
  background-repeat: no-repeat;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%230866ff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolygon points='10 8 16 12 10 16 10 8'/%3E%3C/svg%3E");
}

.gift-accordion__lessons li.is-doc::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%23db2777' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3Cline x1='16' y1='13' x2='8' y2='13'/%3E%3Cline x1='16' y1='17' x2='8' y2='17'/%3E%3C/svg%3E");
}
