/* =========================================================================
 * common.css  —  Shared chrome for all EngTool.net tools
 * Provides the top bar (brand, Back to Home, Send Email, language selector,
 * tool navigation) and the hub / placeholder page styles. Each tool page
 * also loads its own css/style.css for the calculator UI.
 * ========================================================================= */
:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --ink: #1f2933;
  --muted: #6b7785;
  --line: #e2e8f0;
  --brand: #1f6feb;
  --brand-d: #1556b8;
  --accent: #0f9d8a;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 6px 20px rgba(15, 23, 42, 0.06);
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--ink);
  font-family: "Segoe UI", "Helvetica Neue", Arial, "PingFang SC",
               "Hiragino Sans", "Noto Sans CJK", "Malgun Gothic", sans-serif;
  font-size: 15px; line-height: 1.5;
}
a { color: var(--brand); }

/* ---------- Shared top bar ---------- */
.et-topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 10px 20px;
  background: linear-gradient(180deg, #ffffff, #f7f9fc);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
  position: sticky; top: 0; z-index: 50; flex-wrap: wrap;
}
.et-topbar .brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.et-topbar .brand .logo { font-size: 22px; color: var(--brand); }
.et-topbar .brand .title { font-weight: 700; font-size: 17px; white-space: nowrap; }
.et-topbar .actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.et-topbar .navlink {
  text-decoration: none; color: var(--muted);
  padding: 7px 12px; border-radius: 8px; font-size: 14px; font-weight: 600;
  border: 1px solid transparent;
}
.et-topbar .navlink:hover { background: #eef3fb; color: var(--brand); }
.et-topbar .navlink.active { background: var(--brand); color: #fff; }
.et-topbar .lang {
  height: 36px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink); padding: 0 8px; font-size: 14px; cursor: pointer;
}
.et-topbar .btn {
  display: inline-flex; align-items: center; height: 36px; padding: 0 14px;
  border-radius: 8px; background: var(--brand); color: #fff; text-decoration: none;
  font-size: 14px; font-weight: 600; border: 1px solid var(--brand-d);
  white-space: nowrap; transition: background .15s ease;
}
.et-topbar .btn:hover { background: var(--brand-d); }
.et-topbar .btn.alt { background: var(--accent); border-color: #0c7d6e; }
.et-topbar .btn.alt:hover { background: #0c7d6e; }

/* ---------- Shared footer ---------- */
.et-footer {
  text-align: center; color: var(--muted); font-size: 12px;
  padding: 22px; border-top: 1px solid var(--line); margin-top: 30px;
}

/* ---------- Hub / landing ---------- */
.hub { max-width: 1440px; margin: 0 auto; padding: 36px 16px 10px; }
.hub-hero { text-align: center; padding: 24px 0 8px; }
.hub-hero h1 { font-size: 30px; margin: 0 0 10px; color: var(--brand-d); }
.hub-hero p { color: var(--muted); font-size: 16px; max-width: 640px; margin: 0 auto; }
.hub-cards {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 18px; margin: 28px 0 10px;
}
@media (max-width: 1200px) { .hub-cards { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 980px)  { .hub-cards { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px)  { .hub-cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px)  { .hub-cards { grid-template-columns: 1fr; } }
.hub-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px; display: flex; flex-direction: column;
  transition: transform .15s ease, box-shadow .15s ease;
}
.hub-card:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(15,23,42,.12); }
.hub-card .ic { font-size: 30px; }
.hub-card h3 { margin: 10px 0 6px; font-size: 18px; color: var(--brand-d); }
.hub-card p { color: var(--muted); font-size: 14px; flex: 1; margin: 0 0 14px; }
.hub-card .open-btn {
  align-self: flex-start; text-decoration: none; background: var(--brand);
  color: #fff; padding: 9px 18px; border-radius: 8px; font-weight: 600; font-size: 14px;
}
.hub-card .open-btn:hover { background: var(--brand-d); }
.hub-card.soon { opacity: .85; }
.hub-card .soon-tag {
  display: inline-block; background: #eef3fb; color: var(--brand);
  padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  align-self: flex-start;
}

/* ---------- Hub filter / search ---------- */
.hub-filter {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  justify-content: center; margin: 8px 0 4px;
}
.hub-search {
  flex: 1 1 260px; max-width: 360px; padding: 10px 14px; font-size: 15px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card);
  color: var(--text);
}
.hub-search:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.hub-cats { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-btn {
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  padding: 8px 14px; border-radius: 999px; font-size: 14px; cursor: pointer;
  transition: all .15s ease;
}
.cat-btn:hover { border-color: var(--brand); color: var(--brand); }
.cat-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }
/* tag chips — search-tag enhancement */
.hub-tags { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; margin: 4px 0 8px; }
.tag-chip {
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  padding: 5px 11px; border-radius: 999px; font-size: 12.5px; cursor: pointer;
  transition: all .15s ease; letter-spacing: .2px;
}
.tag-chip:hover { border-color: var(--brand); color: var(--brand); }
.tag-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.no-results { text-align: center; color: var(--muted); font-size: 15px; margin: 28px 0; }

/* ---------- Standards basis footer panel (per module) ---------- */
.std-basis {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line);
  font-size: 13px;
}
.std-basis-label { font-weight: 600; color: var(--brand); }
.std-basis-codes { color: var(--muted); }
.std-basis-link { color: var(--brand); text-decoration: none; font-weight: 600; }
.std-basis-link:hover { text-decoration: underline; }

/* ---------- Fidelity badges ---------- */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .3px;
  border: 1px solid transparent; white-space: nowrap;
}
.badge-implemented { background: #e7f6ec; color: #1f8a4c; border-color: #bfe6cd; }
.badge-partial { background: #fff4e0; color: #b6791f; border-color: #f3dcae; }
.badge-teaching { background: #eaf1fb; color: #2f6fb0; border-color: #cfe0f5; }

/* ---------- Standards page: body filter chips + body tags ---------- */
.std-bodies { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 14px; }
.body-chip {
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  padding: 4px 11px; border-radius: 999px; font-size: 12px; cursor: pointer;
  transition: all .15s ease; letter-spacing: .3px; font-weight: 600;
}
.body-chip:hover { border-color: var(--brand); color: var(--brand); }
.body-chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.body-tags { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-left: 6px; }
.body-tag {
  font-size: 10.5px; padding: 1px 6px; border-radius: 5px;
  background: var(--line); color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Standard-code tag chips jump to the standards page (distinct look). */
.tag-chip.std { color: var(--brand); border-style: dashed; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.tag-chip.std::after { content: " ↗"; opacity: .55; }
.tag-chip.std:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
/* Collapse toggle chip (More / Show less). */
.tag-chip.toggle { background: transparent; border-style: dotted; color: var(--muted); font-style: italic; }
.tag-chip.toggle:hover { border-color: var(--brand); color: var(--brand); }

/* Highlight a standards-row that was reached via a deep-link. */
.std-row-hit { background: #fff7e0; box-shadow: inset 3px 0 0 var(--accent); transition: background .4s ease; }


/* ---------- Tool page wrapper ---------- */
.tool-wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* ---------- Universal engineering toolbar ---------- */
.et-toolbar {
  position: fixed; left: 12px; bottom: 12px; z-index: 9998;
  display: flex; gap: 6px; align-items: center;
  background: #fff; border: 1px solid var(--line, #ddd); border-radius: 11px;
  padding: 6px; box-shadow: 0 4px 16px rgba(0,0,0,.18);
}
.et-tb-btn {
  font: 500 13px/1.1 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  border: 1px solid var(--line, #ddd); background: #f7f8fa; color: #1c2330;
  border-radius: 8px; padding: 7px 10px; cursor: pointer; white-space: nowrap;
}
.et-tb-btn:hover { background: var(--accent, #2f6df6); color: #fff; border-color: var(--accent, #2f6df6); }

/* ---------- Report overlay (printable calculation sheet) ---------- */
.et-report-overlay {
  display: none; position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.55); overflow: auto; padding: 24px;
}
.et-report-sheet {
  background: #fff; color: #111; max-width: 820px; margin: 0 auto;
  padding: 34px 42px; border-radius: 6px; box-shadow: 0 10px 44px rgba(0,0,0,.35);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; font-size: 13.5px; line-height: 1.5;
}
.et-report-head { border-bottom: 2px solid #1c2330; padding-bottom: 8px; margin-bottom: 14px; }
.et-report-head h2 { margin: 0 0 4px; font-size: 20px; }
.et-report-meta { color: #667; font-size: 12px; }
.et-report-sheet h3 { font-size: 14px; margin: 18px 0 6px; color: #1c2330; border-left: 3px solid var(--accent, #2f6df6); padding-left: 8px; }
.et-report-table { width: 100%; border-collapse: collapse; }
.et-report-table td { padding: 4px 8px; border-bottom: 1px solid #eee; vertical-align: top; }
.et-report-table td:first-child { color: #445; width: 46%; }
.et-report-results { background: #fafbfc; border: 1px solid #eee; border-radius: 5px; padding: 8px 12px; }
.et-report-results .row, .et-report-results div { padding: 2px 0; }
.et-report-std { background: #fafbfc; border: 1px solid #eee; border-radius: 5px; padding: 8px 12px; }
.et-report-std .muted { color: #667; font-size: 12px; }
.et-report-sign { display: flex; gap: 28px; margin-top: 26px; flex-wrap: wrap; }
.et-report-sign > div { display: flex; flex-direction: column; font-size: 12px; color: #445; }
.et-report-sign .line { width: 160px; border-bottom: 1px solid #999; margin-top: 22px; }
.et-report-actions { margin-top: 22px; display: flex; gap: 10px; }

@media print {
  body > *:not(.et-report-overlay) { display: none !important; }
  .et-report-overlay { display: block !important; position: static; background: #fff; padding: 0; }
  .et-report-sheet { box-shadow: none; max-width: none; padding: 0 6mm; }
  .et-report-actions { display: none !important; }
}

/* Inline sub-divider + section headings inside result cards. */
.subdiv { border: none; border-top: 1px dashed var(--line, #ddd); margin: 12px 0; }
.section-title { font-size: 13px; font-weight: 600; margin: 10px 0 2px; color: var(--brand, #2f6df6); }
