/* ============================================================
 * Utilities Bunker — Antenna Radiation Pattern Visualizer (v2.1)
 * File: /assets/css/modules/electronics/antenna-visualizer.v2.1.css
 * Purpose:
 * - Tool-only layout + canvas stage styling + KPI panels + chips
 * - Mobile-first, 44x44 touch targets, clamp typography
 * Notes:
 * - Do NOT modify ub-toolkit.v2.1.css
 * - Keep visuals scoped to this tool
 * ============================================================ */

/* ============================== Local tokens (tool-scoped) ============================== */
:root{
  --av-radius: 16px;
  --av-gap: 14px;
}

/* ============================== Header row helper (safe) ============================== */
.ub-headrow{
  display:flex;
  gap:10px;
  justify-content:space-between;
  align-items:center;
  flex-wrap:wrap;
}

/* ============================== Tool hero layout ============================== */
.ub-hero-av{
  display:grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: var(--av-gap);
}

/* Stack on tablet/mobile */
@media (max-width: 980px){
  .ub-hero-av{
    grid-template-columns: 1fr;
  }
}

/* ============================== Visual Lab panel ============================== */
.ub-lab-av{
  background: var(--ub-surface-2);
  border: 1px solid var(--ub-border);
  border-radius: var(--av-radius);
  padding: 12px;
}

/* Top row */
.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 ============================== */
.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;
}

/* ============================== Toolbar ============================== */
.ub-av-toolbar{
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:space-between;
  flex-wrap:wrap;
  margin-top: 10px;
}
.ub-av-chips{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:center;
}
.ub-av-switches{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:center;
}

/* Make chip taps comfy even when nested (touch target) */
.ub-av-toolbar .ub-chip{
  min-height: 44px;
}

/* ============================== Stage / canvas wrappers ============================== */
.ub-av-stage{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

/* Stack plots on small screens */
@media (max-width: 900px){
  .ub-av-stage{
    grid-template-columns: 1fr;
  }
}

.ub-av-canvaswrap{
  border: 1px solid var(--ub-border);
  border-radius: 14px;
  background: var(--ub-card-bg);
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(0,0,0,.06);
}

/* Captions */
.ub-av-caption{
  padding: 10px 12px;
  border-bottom: 1px solid var(--ub-border);
  background: linear-gradient(180deg, var(--ub-card-bg), var(--ub-surface-2));
}
.ub-av-caption .t{
  font-weight: 950;
  letter-spacing: .01em;
  font-size: 13px;
}
.ub-av-caption .s{
  margin-top: 2px;
  font-size: 12px;
  color: var(--ub-muted);
}

/* Canvas should scale to container width */
.ub-av-canvaswrap canvas{
  display:block;
  width:100%;
  height: 360px; /* default; JS fits to CSS size */
}

/* Slightly taller on large screens */
@media (min-width: 1200px){
  .ub-av-canvaswrap canvas{
    height: 420px;
  }
}

/* Footers */
.ub-av-foot{
  padding: 10px 12px;
  border-top: 1px solid var(--ub-border);
  font-size: 12px;
  color: var(--ub-muted);
  font-family: var(--ub-mono);
}

/* ============================== Presets row ============================== */
.ub-preset-row{
  display:flex;
  flex-wrap:wrap;
  gap: 10px;
  margin-top: 12px;
}
.ub-preset-row .ub-chip{
  min-height: 44px;
  padding: 10px 12px;
}

/* ============================== Work area formatting ============================== */
.ub-work{
  font-family: var(--ub-mono);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap:anywhere;
}

/* Details usability */
.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;
}

/* Full-width buttons helper (in case toolkit already has it, harmless) */
.ub-btn--block{ width: 100%; }

/* ============================== Small screens polish ============================== */
@media (max-width: 520px){
  .ub-kpi{ min-width: 98px; }
  .ub-av-caption .t{ font-size: 12px; }
  .ub-av-canvaswrap canvas{ height: 320px; }
}
