/* ============================================================
   Page247 — p247-tools.css
   CSS cho các chức năng mới: mục lục nhảy, caption bảng, form
   báo giá tại chỗ, công cụ ước tính chi phí, bảng tính hoà vốn.

   Quy tắc: file này nạp SAU style.css và CHỈ THÊM lớp mới.
   Không ghi đè lớp cũ, không đụng biến màu — mọi màu lấy từ
   :root của style.css để hai file không bao giờ lệch chủ đề.
   ============================================================ */

/* ---------- Mục lục nhảy trong bài ---------- */
.article-toc {
  margin: 22px 0 6px;
  padding: 16px 20px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--panel);
}
.article-toc .toc-title {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
}
.article-toc ol {
  margin: 0;
  padding: 0 0 0 1.15em;
  display: grid;
  gap: 6px 22px;
  font-size: 0.93rem;
  color: var(--muted);
}
.article-toc li { margin: 0; }
.article-toc a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.article-toc a:hover,
.article-toc a:focus-visible { color: var(--gold); border-bottom-color: var(--hair, rgba(246, 196, 83, 0.42)); }
@media (min-width: 780px) {
  .article-toc ol { grid-template-columns: 1fr 1fr; }
}

/* Neo nhảy không bị header dính che mất.
   style.css chỉ đặt scroll-margin cho section[id]; trong thân bài các
   neo là h2/h3/div nên phải khai riêng ở đây. */
.article-body [id],
.article-body h2[id],
.article-body h3[id] { scroll-margin-top: calc(var(--header-h) + 18px); }

/* ---------- Caption cho bảng ---------- */
.article-body table caption {
  caption-side: top;
  text-align: left;
  padding: 12px 14px 10px;
  font-size: 0.85rem;
  line-height: 1.55;
  font-weight: 600;
  color: var(--muted);
  background: rgba(246, 196, 83, 0.04);
  border-bottom: 1px solid var(--border);
}

/* ---------- Form nhận báo giá đặt thẳng trong bài ---------- */
.quote-form {
  margin: 20px 0 26px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--panel-2);
}
.quote-form-title {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text);
}
@media (min-width: 720px) {
  .quote-form { padding: 26px 28px; }
}

/* ============================================================
   Công cụ tương tác dùng chung (ước tính chi phí, hoà vốn)
   ============================================================ */
.p247-tool {
  margin: 20px 0 26px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--panel-2);
}
@media (min-width: 720px) {
  .p247-tool { padding: 26px 28px; }
}
.p247-tool-head { margin: 0 0 4px; }
.p247-tool-title {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text);
}
.p247-tool-sub {
  margin: 0 0 18px;
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--muted);
}

.p247-grid {
  display: grid;
  gap: 15px;
  margin: 0 0 18px;
}
@media (min-width: 700px) {
  .p247-grid { grid-template-columns: 1fr 1fr; gap: 16px 20px; }
  .p247-grid .p247-span { grid-column: 1 / -1; }
}

.p247-field { display: flex; flex-direction: column; gap: 7px; }
.p247-field > label,
.p247-field .p247-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
}
.p247-field .p247-label-note { font-weight: 400; color: var(--faint); }
.p247-field select,
.p247-field input[type="number"],
.p247-field input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-2);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.97rem;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.p247-field select:focus,
.p247-field input:focus {
  outline: none;
  border-color: var(--gold);
  background: rgba(255, 255, 255, 0.07);
}
.p247-field option { background: var(--bg-soft); color: var(--text); }

/* Thanh trượt số hội thoại */
.p247-range-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.p247-range-val {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gold);
  white-space: nowrap;
}
.p247-field input[type="range"] {
  width: 100%;
  height: 26px;
  margin: 0;
  padding: 0;
  background: transparent;
  accent-color: var(--gold);
  cursor: pointer;
}

/* Ô chọn có/không */
.p247-checks { display: grid; gap: 10px; }
.p247-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.p247-check:hover { border-color: var(--border-2); background: rgba(255, 255, 255, 0.045); }
.p247-check input[type="checkbox"] {
  margin: 2px 0 0;
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  accent-color: var(--gold);
  cursor: pointer;
}
.p247-check b { color: var(--text); font-weight: 600; }
.p247-check-note { display: block; color: var(--faint); font-size: 0.85rem; }

/* ---------- Khối kết quả ---------- */
.p247-out {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--hair, rgba(246, 196, 83, 0.42));
  border-radius: var(--r-md);
  background: rgba(246, 196, 83, 0.05);
}
.p247-out-tier {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text);
}
.p247-out-tier em { font-style: normal; color: var(--gold); }

.p247-figures {
  display: grid;
  gap: 12px;
  margin: 0 0 16px;
}
@media (min-width: 620px) {
  .p247-figures { grid-template-columns: repeat(3, 1fr); }
}
.p247-figure {
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: rgba(0, 0, 0, 0.18);
}
.p247-figure span {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 5px;
}
.p247-figure strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.22rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1.25;
}
.p247-figure i {
  display: block;
  margin-top: 4px;
  font-style: normal;
  font-size: 0.8rem;
  color: var(--faint);
}

.p247-lines {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.91rem;
  margin: 0 0 14px;
}
.p247-lines th,
.p247-lines td {
  padding: 9px 2px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--muted);
}
.p247-lines th { font-weight: 600; color: var(--text); }
.p247-lines td { text-align: right; white-space: nowrap; color: var(--text); }
.p247-lines tr:last-child th,
.p247-lines tr:last-child td { border-bottom: 0; }
.p247-lines .p247-line-sub th,
.p247-lines .p247-line-sub td { color: var(--faint); font-weight: 400; font-size: 0.86rem; }

.p247-flags { margin: 0 0 14px; display: grid; gap: 9px; }
.p247-flag {
  padding: 11px 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--muted);
}
.p247-flag b { color: var(--text); }
.p247-flag-warn { border-color: rgba(251, 191, 36, 0.38); background: rgba(251, 191, 36, 0.06); }

.p247-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}
.p247-actions .btn { flex: 1 1 200px; justify-content: center; }

.p247-disclaimer {
  margin: 14px 0 0;
  font-size: 0.83rem;
  line-height: 1.65;
  color: var(--faint);
}
.p247-disclaimer a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.p247-disclaimer a:hover { color: var(--gold); }

/* Nội dung tĩnh hiện khi JS chưa chạy / bị chặn — vẫn đọc được, vẫn index được */
.p247-static { margin: 0; }
.js .p247-static[hidden] { display: none; }

/* ---------- Trang liên hệ ---------- */
.contact-grid { display: grid; gap: 18px; margin: 24px 0 8px; }
@media (min-width: 780px) {
  .contact-grid { grid-template-columns: 1fr 1fr; gap: 22px; }
}
.contact-card {
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--panel-2);
}
.contact-card h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--text);
}
.contact-card p { margin: 0 0 10px; font-size: 0.93rem; line-height: 1.7; color: var(--muted); }
.contact-card p:last-child { margin-bottom: 0; }
.contact-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.contact-lines li { display: flex; gap: 10px; font-size: 0.94rem; line-height: 1.6; color: var(--muted); }
.contact-lines b { color: var(--text); font-weight: 600; min-width: 108px; flex-shrink: 0; }
.contact-lines a { color: var(--gold); text-decoration: none; }
.contact-lines a:hover { text-decoration: underline; }

/* Chỗ chủ site cần tự điền — cố tình để lộ rõ, không giấu vào code */
.needs-input {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 6px;
  border: 1px dashed rgba(251, 191, 36, 0.55);
  background: rgba(251, 191, 36, 0.08);
  color: var(--amber);
  font-size: 0.86rem;
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  .article-toc a,
  .p247-check,
  .p247-field select,
  .p247-field input { transition: none; }
}
