/* ester-lipid-lab.css — CSS riêng cho tools/hoa-12-chuong-1.php.
   Khối .theory-* và .chain-* giữ đúng quy ước như các chương trước để
   đồng bộ giao diện. Thêm mới: .molecule-diagram và .micelle-diagram
   để trực quan hóa cơ chế làm sạch của xà phòng — trọng tâm của Bài 2. */

.theory-toc { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.theory-toc-item {
  font-size: 13px; padding: 6px 12px; border-radius: 20px; background: #eef0fa;
  color: var(--blue-dark); text-decoration: none; font-weight: 600;
}
.theory-toc-item:hover { background: var(--blue); color: #fff; }
.theory-lesson { margin-bottom: 36px; scroll-margin-top: 16px; }
.theory-lesson-title { font-size: 19px; font-weight: 700; margin-bottom: 12px; border-bottom: 2px solid var(--line); padding-bottom: 8px; }
.theory-body p { line-height: 1.7; margin: 0 0 12px; font-size: 15px; }
.theory-body ul { margin: 0 0 14px; padding-left: 20px; line-height: 1.7; font-size: 15px; }
.theory-body li { margin-bottom: 6px; }
.theory-callout { background: #eef0fa; border-radius: var(--radius); padding: 16px 18px; margin: 16px 0; }
.theory-callout-title { font-weight: 700; margin-bottom: 8px; color: var(--blue-dark); }
.theory-callout p:last-child { margin-bottom: 0; }
.theory-table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 13.5px; }
.theory-table th, .theory-table td { border: 1px solid var(--line); padding: 10px 12px; text-align: left; vertical-align: top; }
.theory-table th { background: #f5f6fb; font-weight: 700; }
.theory-note { font-size: 13px; color: var(--ink-soft); font-style: italic; }
.theory-link-tab { color: var(--blue); font-weight: 600; text-decoration: none; }
.theory-link-tab:hover { text-decoration: underline; }

/* ===== Sơ đồ phản ứng (chain-diagram, tái dùng từ Chương 2) ===== */
.chain-title { font-size: 16px; font-weight: 700; margin: 28px 0 12px; color: var(--ink); }
.chain-title:first-child { margin-top: 0; }
.chain-diagram {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  background: #f8f9fd; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 16px; margin-bottom: 22px;
}
.chain-box {
  background: var(--blue); color: #fff; font-weight: 700; font-size: 14px;
  padding: 8px 14px; border-radius: 10px; white-space: nowrap;
}
.chain-arrow {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 11.5px; color: var(--ink-soft); padding: 0 6px; min-width: 60px; text-align: center;
}
.chain-arrow .arrow-symbol { font-size: 18px; color: var(--blue-dark); line-height: 1; }
@media (max-width: 640px) {
  .chain-diagram { flex-direction: column; align-items: stretch; }
  .chain-box { text-align: center; }
  .chain-arrow { flex-direction: row; gap: 6px; min-width: 0; }
}

/* ===== 1 phân tử xà phòng: đầu ưa nước + đuôi kị nước ===== */
.molecule-diagram {
  display: flex; align-items: center; justify-content: center; gap: 0;
  background: #f8f9fd; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px 16px; margin: 16px 0;
}
.molecule-tail {
  width: 140px; height: 10px; border-radius: 6px;
  background: repeating-linear-gradient(90deg, #94a3b8, #94a3b8 8px, #cbd5e1 8px, #cbd5e1 16px);
}
.molecule-head {
  width: 34px; height: 34px; border-radius: 50%; background: var(--blue);
  flex-shrink: 0; margin-left: -2px;
  box-shadow: 0 0 0 4px #dbe4fb;
}
.molecule-labels { display: flex; justify-content: center; gap: 40px; margin-top: 10px; font-size: 12.5px; color: var(--ink-soft); text-align: center; }
.molecule-labels strong { display: block; color: var(--ink); font-size: 13px; }

/* ===== Micelle: nhiều phân tử xếp vòng quanh giọt dầu ===== */
.micelle-diagram {
  position: relative;
  width: 240px; height: 240px;
  margin: 24px auto 12px;
}
.micelle-core {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 92px; height: 92px; border-radius: 50%;
  background: #fde68a; border: 2px solid #f5c141;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; color: #92400e; text-align: center; line-height: 1.3;
}
.micelle-molecule {
  position: absolute; top: 50%; left: 50%;
  width: 8px; height: 60px;
  transform-origin: 50% 0%;
  /* --angle được set inline cho từng phân tử để rải đều quanh vòng tròn */
  transform: rotate(var(--angle)) translateX(-4px);
}
.micelle-molecule .m-tail {
  position: absolute; top: 0; left: 0;
  width: 8px; height: 42px; border-radius: 4px;
  background: repeating-linear-gradient(180deg, #94a3b8, #94a3b8 6px, #cbd5e1 6px, #cbd5e1 12px);
}
.micelle-molecule .m-head {
  position: absolute; top: 42px; left: -6px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--blue); box-shadow: 0 0 0 3px #dbe4fb;
}
.micelle-caption { text-align: center; font-size: 12.5px; color: var(--ink-soft); margin-top: 8px; }
.micelle-caption b { color: var(--blue-dark); }

/* ===== Bảng tra cứu nhanh ===== */
.formula-box {
  font-family: 'IBM Plex Mono', monospace; font-size: 15px; font-weight: 700;
  color: var(--blue-dark); background: #eef0fa; border-radius: var(--radius);
  padding: 14px 16px; margin: 10px 0 20px; text-align: center;
}
.mistake-item {
  background: #fff7ed; border-left: 4px solid #f59e0b; border-radius: 8px;
  padding: 10px 14px; margin-bottom: 10px; font-size: 14px; line-height: 1.6;
}
.mistake-item strong { color: #9a3412; }
