/* ============================================================
   product.css — Shared stylesheet for product detail pages.
   Loaded by:
     - product_detail.php  (live page)
     - admin/product_preview.php  (preview page)
     - tiptap editor iframe  (WYSIWYG content preview)
   DO NOT import admin UI here. Admin-only styles live in admin/admin.css.
   ============================================================ */

/* ── CSS variable bridge ─────────────────────────────────────
   Both the site (style.css) and this file reference the same
   custom properties. On the public site those vars come from
   style.css :root. In the editor iframe they are injected
   inline by admin.js. This file only USES them, never defines.
   ──────────────────────────────────────────────────────────── */

/* =========================================================
   PRODUCT DETAIL PAGE — layout
   ========================================================= */

.prod-page-container {
  max-width: 1280px;
}

.prod-detail-layout {
  display: block;
}

.prod-detail-layout.has-sidebar {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  gap: 0 48px;
  align-items: start;
}

.has-sidebar > .prod-toc        { grid-column: 1; grid-row: 1; }
.has-sidebar > .prod-detail-body { grid-column: 2; grid-row: 1; min-width: 0; }

/* =========================================================
   SIDEBAR — TOC / Reference Links
   ========================================================= */

.prod-toc {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 108px);
  overflow-y: auto;
  overflow-x: hidden;
}

.prod-toc::-webkit-scrollbar { width: 3px; }
.prod-toc::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.prod-toc-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.prod-toc-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--muted);
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
}

.prod-toc-list {
  list-style: none;
  margin: 0;
  padding: 6px 0;
}

.prod-toc-list li { margin: 0; }

.prod-toc-empty {
  padding: 10px 16px;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  margin: 0;
}

.prod-toc-link {
  display: block;
  padding: 7px 16px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  line-height: 1.4;
  transition: color .12s, border-color .12s, background .12s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prod-toc-link:hover {
  color: var(--text);
  background: rgba(255,255,255,0.035);
  text-decoration: none;
}

.prod-toc-link.prod-toc-sub {
  padding-left: 30px;
  font-size: 12px;
}

.prod-toc-link.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.07);
}

.prod-toc-mobile-btn {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 16px;
  z-index: 400;
  background: var(--accent);
  color: #07101c;
  border: none;
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(var(--accent-rgb), 0.4);
  transition: opacity .15s, transform .15s;
}

.prod-toc-mobile-btn:hover { opacity: .85; transform: scale(1.03); }

/* =========================================================
   INDICATOR DETAIL — hero + typography
   ========================================================= */

.indicator-detail { max-width: 100%; }

.indicator-hero { margin-bottom: 50px; }

.indicator-detail h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  line-height: 1.1;
  color: var(--heading);
  margin-bottom: 12px;
  letter-spacing: -1px;
}

.indicator-tagline {
  font-size: 18px;
  color: var(--accent);
  margin-bottom: 22px;
  font-weight: 500;
}

.indicator-desc {
  color: var(--muted);
  line-height: 1.9;
  font-size: 15px;
  max-width: 850px;
}

.indicator-hero-cta { margin-top: 22px; }

/* ── Rich text body ──────────────────────────────────────── */

.indicator-detail p {
  color: var(--text);
  line-height: 1.85;
  font-size: 15px;
  margin-bottom: 16px;
}

.indicator-detail ul,
.indicator-detail ol {
  padding-left: 28px;
  margin: 12px 0 20px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.85;
}

.indicator-detail ul { list-style: disc; }
.indicator-detail ol { list-style: decimal; }

.indicator-detail ul li,
.indicator-detail ol li {
  margin-bottom: 6px;
  padding-left: 4px;
}

.indicator-detail ul li::marker,
.indicator-detail ol li::marker { color: var(--accent); }

.indicator-detail blockquote {
  border-left: 3px solid var(--accent);
  margin: 20px 0;
  padding: 12px 20px;
  background: rgba(var(--accent-rgb), 0.06);
  border-radius: 0 8px 8px 0;
  color: var(--muted);
  font-style: italic;
  font-size: 15px;
  line-height: 1.8;
}

.indicator-detail hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 36px 0;
}

.indicator-detail code {
  font-family: 'Fira Mono', 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.88em;
  background: rgba(var(--accent-rgb), 0.08);
  border: 1px solid rgba(var(--accent-rgb), 0.15);
  color: var(--accent);
  padding: 1px 7px;
  border-radius: 4px;
}

.indicator-detail pre {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 22px;
  overflow-x: auto;
  margin: 20px 0;
  font-size: 13px;
  line-height: 1.7;
}

.indicator-detail pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
  font-size: inherit;
}

.indicator-detail a:not(.btn):not(.btn-outline) {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.indicator-detail a:not(.btn):not(.btn-outline):hover { opacity: 0.8; }

/* ── Tables ──────────────────────────────────────────────── */

.indicator-detail table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14px;
}
/* Product descriptions are rich text an admin writes — a wide table
   pasted in there shouldn't be able to break the page on a phone. */
@media (max-width: 640px) {
  .indicator-detail table { display: block; overflow-x: auto; white-space: nowrap; }
}

.indicator-detail th {
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 2px solid var(--border);
}

.indicator-detail td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.indicator-detail tr:hover td { background: rgba(255,255,255,0.02); }

/* =========================================================
   OUTCOME COPY — "Problem" callout. Used to open each product
   page's Problem→Solution→Benefits→Screenshot→CTA flow: a
   short, visually distinct statement of the pain point before
   the Solution paragraph explains how the indicator fixes it.
   Not styled as an error/danger banner — just enough visual
   separation to read as "here's what's broken" before the
   product answers it.
   ========================================================= */
.prod-problem {
  background: rgba(255,255,255,0.03);
  border-left: 3px solid var(--muted);
  border-radius: 0 10px 10px 0;
  padding: 16px 22px;
  margin: 0 0 28px;
  color: var(--text);
  font-size: 15.5px;
  line-height: 1.8;
}
.prod-problem strong { color: var(--heading); }

/* =========================================================
   DOC SECTIONS
   ========================================================= */

.doc-section {
  margin-bottom: 32px;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  padding: 28px 32px;
}

.doc-section h2 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--heading);
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.doc-subheading {
  color: var(--muted);
  line-height: 1.8;
  margin-bottom: 28px;
  max-width: 760px;
  font-size: 15px;
}

/* =========================================================
   DOC GRID + CARDS
   ========================================================= */

.doc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.doc-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0)), var(--card-glass);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius-card, 20px);
  box-shadow: var(--card-shadow);
  padding: 24px;
  transition: transform .25s, border-color .25s, box-shadow .25s;
  position: relative;
  overflow: hidden;
}

.doc-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(var(--accent-rgb),0.08), transparent 45%);
  pointer-events: none;
}

.doc-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--card-shadow), var(--glow);
}

.doc-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(var(--accent-rgb),0.12);
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 18px;
}

.doc-card h3 { color: var(--heading); font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.doc-card p  { color: var(--muted); line-height: 1.85; font-size: 14px; }

/* =========================================================
   FEATURE DOCS
   ========================================================= */

.feature-docs { display: flex; flex-direction: column; gap: 16px; }

.feature-doc {
  display: flex;
  gap: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0)), var(--card-glass);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius-card, 20px);
  box-shadow: var(--card-shadow);
  padding: 20px;
  transition: transform .25s, border-color .25s, box-shadow .25s;
}

.feature-doc:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--card-shadow), var(--glow); }

.feature-icon {
  width: 46px; height: 46px;
  flex-shrink: 0;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(var(--accent-rgb),0.12);
  color: var(--accent);
  font-size: 20px; font-weight: 700;
}

.feature-doc h3 { color: var(--heading); font-size: 16px; margin-bottom: 8px; }
.feature-doc p  { color: var(--muted); line-height: 1.85; font-size: 14px; }

/* =========================================================
   MEDIA
   ========================================================= */

.media-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

.media-item { width: 100%; overflow: hidden; }

.media-item img {
  width: 100%; height: 320px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: block;
  cursor: zoom-in;
  transition: transform .25s, border-color .25s;
}

.media-item img:hover { transform: scale(1.01); border-color: var(--accent); }

.media-item video {
  display: block;
  width: 100% !important; height: auto !important;
  max-width: 100%; max-height: 70vh;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #000;
}

.media-caption { font-size: 13px; color: var(--muted); margin-top: 10px; text-align: center; line-height: 1.6; }

/* =========================================================
   LIGHTBOX
   ========================================================= */

.lightbox {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.94);
  z-index: 9999;
  align-items: center; justify-content: center;
  padding: 24px;
  cursor: zoom-out;
}

.lightbox.open { display: flex; }

.lightbox img {
  max-width: 92vw; max-height: 88vh;
  border-radius: 12px;
  object-fit: contain;
  cursor: default;
}

.lightbox-close {
  position: absolute; top: 20px; right: 22px;
  width: 42px; height: 42px;
  border: none; border-radius: 50%;
  background: rgba(255,255,255,0.12);
  color: #fff; font-size: 24px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .2s;
}

.lightbox-close:hover { background: rgba(255,255,255,0.22); }

/* =========================================================
   UTILITY USED ON PRODUCT PAGES
   ========================================================= */

.back-link { color: var(--muted); font-size: 14px; display: inline-flex; align-items: center; gap: 6px; margin-bottom: 24px; }
.back-link:hover { color: var(--accent); text-decoration: none; }
.text-center { text-align: center; }
.mt-32 { margin-top: 32px; }
.media-placeholder { background: var(--surface2, #111d35); border: 2px dashed var(--border, #1e3155); border-radius: 12px; min-height: 180px; }
.placeholder-box { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 180px; color: var(--muted, #6b84a8); font-size: 13px; }
.placeholder-icon { font-size: 36px; }

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 960px) {
  .prod-detail-layout.has-sidebar { display: block; }

  .prod-toc {
    display: none;
    position: fixed;
    bottom: 60px; right: 12px; top: auto;
    max-height: 55vh; width: 230px;
    z-index: 399;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  }

  .prod-toc.toc-mobile-open { display: block; }
  .prod-toc-mobile-btn { display: flex; align-items: center; gap: 6px; }
  .doc-grid { grid-template-columns: 1fr !important; }
  .media-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .doc-section { margin-bottom: 48px; }
  .doc-card, .feature-doc { padding: 18px; }
  .media-item img { height: 240px; }
  .media-grid { grid-template-columns: 1fr; }
  .media-item-video { grid-column: 1; }
  .indicator-desc, .doc-subheading, .doc-card p, .feature-doc p { font-size: 14px; }
}
