/* ============================================================
   leansigmavn-theme — SINGLE POST WOWOWOW (v1.0)
   Premium reading experience + AI + cross-link ecosystem
   ============================================================ */

/* ---------- Reading progress bar ---------- */
.sp-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, #16a34a, #22c55e, #0ea5e9);
  z-index: 9999;
  transition: width .1s linear;
  box-shadow: 0 0 8px rgba(34,197,94,.5);
}

/* ---------- Layout tuning ---------- */
.sp-layout { max-width: 720px; }
.sp-card { padding: 48px 52px; }

/* ---------- Drop cap đầu bài ---------- */
.sp-content > p:first-of-type::first-letter {
  float: left;
  font-size: 3.4em;
  line-height: .82;
  font-weight: 800;
  color: #16a34a;
  padding: 4px 12px 0 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

/* ---------- Premium body typography ---------- */
.sp-content { font-size: 18px; line-height: 1.85; color: #1e293b; }
.sp-content p { margin-bottom: 22px; }
.sp-content h2 {
  font-size: 26px; font-weight: 800; color: #0f172a;
  margin: 44px 0 18px; line-height: 1.3; letter-spacing: -.01em;
  scroll-margin-top: 90px;
  padding-bottom: 10px; border-bottom: 2px solid #e2e8f0;
}
.sp-content h3 { font-size: 21px; font-weight: 700; color: #0f172a; margin: 32px 0 14px; scroll-margin-top: 90px; }
.sp-content h4 { font-size: 18px; font-weight: 700; color: #0f172a; margin: 26px 0 10px; }
.sp-content ul, .sp-content ol { padding-left: 26px; margin: 18px 0; }
.sp-content li { margin-bottom: 10px; line-height: 1.7; }
.sp-content a { color: #16a34a; font-weight: 600; text-decoration: none; border-bottom: 1px solid rgba(22,163,74,.35); transition: border-color .2s; }
.sp-content a:hover { border-bottom-color: #16a34a; }
.sp-content img { border-radius: 14px; margin: 28px 0; width: 100%; height: auto; box-shadow: 0 4px 20px rgba(0,0,0,.06); cursor: zoom-in; }
.sp-content code { background: #f1f5f9; padding: 2px 7px; border-radius: 6px; font-size: .9em; color: #db2777; font-family: 'SFMono-Regular', Consolas, monospace; }
.sp-content pre { background: #0f172a; color: #e2e8f0; padding: 20px; border-radius: 14px; overflow-x: auto; margin: 24px 0; font-size: 14px; line-height: 1.6; }
.sp-content pre code { background: none; color: inherit; padding: 0; }

/* ---------- Callout boxes ---------- */
.sp-callout {
  border-radius: 14px; padding: 18px 22px; margin: 26px 0;
  display: flex; gap: 14px; align-items: flex-start; font-size: 16px; line-height: 1.7;
  border-left: 4px solid;
}
.sp-callout .sp-ico { font-size: 22px; line-height: 1.4; flex-shrink: 0; }
.sp-callout p { margin: 0; }
.sp-callout.info { background: #eff6ff; border-color: #3b82f6; color: #1e3a5f; }
.sp-callout.warn { background: #fffbeb; border-color: #f59e0b; color: #713f12; }
.sp-callout.success { background: #f0fdf4; border-color: #22c55e; color: #14532d; }
.sp-callout.tip { background: #faf5ff; border-color: #a855f7; color: #581c87; }

/* ---------- Pull quote (WOW center) ---------- */
.sp-pullquote {
  font-size: 24px; font-weight: 700; line-height: 1.5; color: #0f172a;
  text-align: center; margin: 40px 0; padding: 32px 24px;
  border: none; border-top: 3px solid #16a34a; border-bottom: 3px solid #16a34a;
  background: linear-gradient(135deg, #f0fdf4, #ffffff);
  position: relative;
}
.sp-pullquote::before {
  content: '“'; position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  font-size: 60px; color: #16a34a; background: #fff; padding: 0 12px; line-height: 1; font-family: Georgia, serif;
}

/* ---------- Key Takeaways ---------- */
.sp-takeaways {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  border-radius: 18px; padding: 28px 32px; margin: 36px 0; color: #fff;
}
.sp-takeaways h4 { color: #fff; font-size: 17px; margin: 0 0 16px; display: flex; align-items: center; gap: 8px; }
.sp-takeaways ol { margin: 0; padding-left: 22px; }
.sp-takeaways li { color: #e2e8f0; margin-bottom: 10px; line-height: 1.65; font-size: 16px; }
.sp-takeaways li::marker { color: #22c55e; font-weight: 700; }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; transition: none; }
  .sp-progress { transition: none; }
}

/* ---------- Floating TOC ---------- */
.sp-toc {
  position: fixed; top: 120px; right: max(24px, calc((100vw - 720px) / 2 - 280px));
  width: 240px; max-height: 70vh; overflow-y: auto;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 14px;
  padding: 16px 18px; box-shadow: 0 4px 24px rgba(0,0,0,.06); z-index: 50;
  font-size: 13px;
}
.sp-toc h5 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: #94a3b8; }
.sp-toc a { display: block; padding: 5px 0; color: #64748b; text-decoration: none; border-left: 2px solid transparent; padding-left: 10px; transition: all .2s; line-height: 1.4; }
.sp-toc a:hover, .sp-toc a.active { color: #16a34a; border-left-color: #16a34a; font-weight: 600; }
.sp-toc-toggle { display: none; }

/* ---------- AI Box (summary / insights / quiz) ---------- */
.sp-ai {
  background: linear-gradient(135deg, #0f172a, #312e81);
  border-radius: 18px; padding: 28px 32px; margin: 32px 0; color: #fff; position: relative; overflow: hidden;
}
.sp-ai::after {
  content: ''; position: absolute; top: -40px; right: -40px; width: 140px; height: 140px;
  background: radial-gradient(circle, rgba(34,197,94,.3), transparent 70%); border-radius: 50%;
}
.sp-ai-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; position: relative; z-index: 1; }
.sp-ai-badge { background: rgba(34,197,94,.2); color: #4ade80; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 20px; border: 1px solid rgba(74,222,128,.4); }
.sp-ai h4 { margin: 0; font-size: 16px; color: #fff; font-weight: 700; }
.sp-ai-body { position: relative; z-index: 1; font-size: 15.5px; line-height: 1.7; color: #e2e8f0; }
.sp-ai-body ul { padding-left: 20px; margin: 12px 0; }
.sp-ai-body li { margin-bottom: 8px; }
.sp-ai-q { margin-top: 16px; position: relative; z-index: 1; }
.sp-ai-q input {
  width: 100%; padding: 12px 16px; border-radius: 10px; border: none; font-size: 14px;
  background: rgba(255,255,255,.1); color: #fff; outline: none;
}
.sp-ai-q input::placeholder { color: rgba(255,255,255,.5); }
.sp-ai-q button {
  margin-top: 10px; background: #22c55e; color: #06240f; border: none; padding: 10px 20px;
  border-radius: 10px; font-weight: 700; cursor: pointer; font-size: 14px; transition: transform .15s;
}
.sp-ai-q button:hover { transform: translateY(-1px); }
.sp-ai-ans { margin-top: 14px; padding: 14px 16px; background: rgba(255,255,255,.08); border-radius: 10px; font-size: 14.5px; line-height: 1.65; color: #f1f5f9; display: none; border-left: 3px solid #22c55e; }
.sp-ai-ans.show { display: block; }
.sp-ai-quiz { position: relative; z-index: 1; }
.sp-ai-quiz .q { margin-bottom: 18px; }
.sp-ai-quiz .q p { font-weight: 600; margin-bottom: 8px; color: #fff; }
.sp-ai-quiz label { display: block; padding: 8px 12px; margin-bottom: 6px; background: rgba(255,255,255,.07); border-radius: 8px; cursor: pointer; font-size: 14px; transition: background .15s; }
.sp-ai-quiz label:hover { background: rgba(255,255,255,.14); }
.sp-ai-quiz label.correct { background: rgba(34,197,94,.25); border: 1px solid #22c55e; }
.sp-ai-quiz label.wrong { background: rgba(239,68,68,.25); border: 1px solid #ef4444; }
.sp-ai-quiz input { margin-right: 8px; }
.sp-ai-foot { margin-top: 18px; font-size: 12px; color: rgba(255,255,255,.5); position: relative; z-index: 1; display: flex; align-items: center; gap: 6px; }

/* ---------- Forms / inputs (no overflow on mobile) ---------- */
.sp-card input, .sp-card textarea, .sp-card select, .sp-ai-q input,
.comment-form textarea, .comment-form input, .comment-form-comment textarea,
.cicc-ai-input, #comment, textarea {
  max-width: 100% !important;
  width: 100% !important;
  box-sizing: border-box !important;
}
.sp-comments textarea, .sp-comments input { max-width: 100%; box-sizing: border-box; }
/* safety: never allow horizontal scroll from decorative floats */
.sp-eco-float, .eco-float__btn { max-width: calc(100vw - 32px); }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .sp-toc { display: none; }
  .sp-toc-toggle {
    display: flex; align-items: center; gap: 6px; position: fixed; bottom: 84px; right: 16px; z-index: 60;
    background: #16a34a; color: #fff; border: none; padding: 10px 14px; border-radius: 30px;
    font-size: 13px; font-weight: 600; box-shadow: 0 4px 16px rgba(22,163,74,.4); cursor: pointer;
  }
  .sp-toc.sp-open { display: block; top: auto; bottom: 140px; right: 16px; width: calc(100vw - 32px); max-height: 50vh; }
}
@media (max-width: 768px) {
  .sp-card { padding: 24px 20px; }
  .sp-content { font-size: 17px; line-height: 1.8; }
  .sp-content h2 { font-size: 22px; }
  .sp-content h3 { font-size: 19px; }
  .sp-content > p:first-of-type::first-letter { font-size: 2.8em; }
  .sp-pullquote { font-size: 20px; padding: 24px 16px; }
  .sp-takeaways, .sp-ai { padding: 22px 20px; }
  .sp-related-grid { grid-template-columns: 1fr; }

  /* Mobile bottom action bar */
  .sp-mobilebar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    background: #fff; border-top: 1px solid #e2e8f0; padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(0,0,0,.08); gap: 8px;
  }
  .sp-mobilebar a, .sp-mobilebar button {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    text-decoration: none; color: #475569; font-size: 11px; font-weight: 600;
    background: none; border: none; cursor: pointer; padding: 4px 0;
  }
  .sp-mobilebar .mb-ico { font-size: 18px; }
  .sp-mobilebar .mb-cta { background: #16a34a; color: #fff; border-radius: 10px; padding: 8px 4px; }
  body { padding-bottom: 64px; }
}
