/* ============================================================
 * Utilities Bunker — SMPS Efficiency Estimator (v2.1)
 * File: /assets/css/modules/electronics/smps-efficiency.v2.1.css
 * Purpose:
 * - Tool-only layout + SMPS "power flow" visual + show-work formatting
 * - Mobile-first, 44×44 touch targets, clamp() typography
 * Notes:
 * - DO NOT modify ub-toolkit.v2.1.css
 * ============================================================ */

/* ============================== Local tokens (tool-scoped) ============================== */
:root{
  --smps-radius: 16px;
  --smps-gap: 14px;
  --smps-soft: rgba(0,0,0,.06);
  --smps-soft-2: rgba(0,0,0,.10);
}

/* ============================== Tool hero layout ============================== */
.ub-hero{
  display:grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: var(--smps-gap);
}
@media (max-width: 980px){
  .ub-hero{ grid-template-columns: 1fr; }
}

/* ============================== Power Flow panel ============================== */
.ub-lab{
  background: var(--ub-surface-2);
  border: 1px solid var(--ub-border);
  border-radius: var(--smps-radius);
  padding: 12px;
}

.ub-lab-top{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap: 10px;
  flex-wrap:wrap;
  margin-bottom: 8px;
}

.ub-lab-title{
  font-size: clamp(13px, 1.2vw, 14px);
  font-weight: 950;
  letter-spacing: .01em;
}
.ub-lab-sub{
  font-size: 12px;
  color: var(--ub-muted);
  margin-top: 2px;
}

/* ============================== KPI tiles (same pattern as Ohm's) ============================== */
.ub-kpis{
  display:flex;
  flex-wrap:wrap;
  gap: 8px;
  justify-content:flex-end;
}
.ub-kpi{
  min-width: 112px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid var(--ub-border);
  background: var(--ub-card-bg);
}
.ub-kpi .k{
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ub-muted);
}
.ub-kpi .v{
  font-family: var(--ub-mono);
  font-weight: 950;
  font-size: 14px;
  margin-top: 2px;
}

/* ============================== Risk pill ============================== */
.ub-risk{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--ub-border);
  background: var(--ub-card-bg);
  font-size: 12px;
  font-weight: 950;
  min-height: 44px;
}
.ub-dot{
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ub-muted);
}

/* ============================== Mode wheel chips ============================== */
.ub-wheel{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 10px;
  margin-top: 10px;
}
.ub-wheel .ub-chip{
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--ub-border);
  background: var(--ub-chip-bg);
  color: var(--ub-chip-text);
  font-weight: 900;
  cursor: pointer;
  user-select:none;
}
.ub-wheel .ub-chip:hover{ background: var(--ub-chip-hover); }
.ub-wheel .ub-chip[aria-pressed="true"]{
  border-color: rgba(249,58,19,.55);
  box-shadow: 0 0 0 4px rgba(249,58,19,.12);
}

/* ============================== Power Flow SVG ============================== */
.ub-powerflow{
  width: 100%;
  height: auto;
  margin-top: 10px;
  display:block;
  border-radius: 14px;
}

/* animated flow overlay */
@keyframes ub-flow{
  from{ stroke-dashoffset: 70; }
  to{ stroke-dashoffset: 0; }
}
.ub-flow{
  stroke-dasharray: 7 10;
  animation: ub-flow 900ms linear infinite;
}

/* heat overlay set by JS opacity; slightly higher in dark */
.ub-heat{ opacity: .06; }
html.ub-theme-dark .ub-heat{ opacity: .10; }

/* Accessible focus ring for SVG "buttons"/focusable elements if used later */
.ub-svg-btn{ cursor: pointer; user-select:none; }
.ub-svg-btn:focus,
.ub-wheel .ub-chip:focus{
  outline: none;
  box-shadow: 0 0 0 4px var(--ub-focus);
  border-radius: 10px;
}

/* ============================== Presets row ============================== */
.ub-preset-row{
  display:flex;
  flex-wrap:wrap;
  gap: 10px;
  margin-top: 10px;
}
.ub-preset-row .ub-chip{
  min-height: 44px;
  padding: 10px 12px;
}

/* ============================== Small helpers ============================== */
.hint{
  margin-top: 6px;
  font-size: 12px;
  color: var(--ub-muted);
}
.ub-inline-error{
  margin-top: 6px;
  font-size: 12px;
  color: var(--ub-danger);
  font-weight: 800;
  min-height: 16px; /* keeps layout stable */
}

/* Tool-only: full-width rail buttons helper */
.ub-btn--block{ width: 100%; }

/* ============================== Thermal panel micro layout ============================== */
.ub-thermal{
  border: 1px dashed rgba(249,58,19,.35);
  border-radius: var(--ub-radius-2);
  padding: 12px;
  background: linear-gradient(180deg, var(--ub-card-bg), var(--ub-surface-2));
}
.ub-thermal .ub-thermal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  flex-wrap:wrap;
}
.ub-thermal .ub-thermal-title{
  margin:0;
  font-size: 13px;
  font-weight: 950;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ub-muted);
}
.ub-thermal .ub-thermal-grid{
  margin-top: 10px;
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 12px;
}
@media (max-width: 768px){
  .ub-thermal .ub-thermal-grid{ grid-template-columns: 1fr; }
}

/* ============================== Show Work formatting ============================== */
.ub-work{
  font-family: var(--ub-mono);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap:anywhere;
}

/* details summary touch + focus */
.ub-collapsible summary{
  cursor:pointer;
  font-weight: 950;
  min-height: 44px;
  display:flex;
  align-items:center;
}
.ub-collapsible summary:focus{
  outline: none;
  box-shadow: 0 0 0 4px var(--ub-focus);
  border-radius: 12px;
}

/* ============================== Input group labels / separators (tool-only) ============================== */
.ub-subhead{
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ub-muted);
}
.ub-divider{
  border:none;
  border-top:1px solid var(--ub-border);
  margin: 14px 0;
}

/* ============================== Tighten KPI on tiny screens ============================== */
@media (max-width: 520px){
  .ub-kpi{ min-width: 98px; }
}
