/* ============================================================
   Utilities Bunker — Intel HEX to BIN Converter (v2.1)
   File: /assets/css/modules/convert/intel-hex-to-bin.v2.1.css
   Purpose:
   - Tool-only layout and visual styling
   - No edits to ub-toolkit.v2.1.css
   - Mobile-first, fast, accessible, UB-CERT aligned
   ============================================================ */

:root{
  --ihb-radius: 16px;
  --ihb-gap: 14px;
  --ihb-soft: rgba(0,0,0,.06);
  --ihb-track: rgba(0,0,0,.08);
  --ihb-seg: linear-gradient(92deg, var(--ub-btn-grad-a), var(--ub-btn-grad-b));
}

html.ub-theme-dark:root{
  --ihb-soft: rgba(255,255,255,.06);
  --ihb-track: rgba(255,255,255,.08);
}

/* ------------------------------------------------------------
   Header / intro
   ------------------------------------------------------------ */
.ihb-headbar{
  display:flex;
  gap:10px;
  justify-content:space-between;
  align-items:flex-start;
  flex-wrap:wrap;
}

.ihb-title{
  margin:0;
  font-size:var(--ub-fs-5);
}

.ihb-subtitle{
  margin:6px 0 0;
  max-width:84ch;
}

.ihb-subtitle code{
  font-family:var(--ub-mono);
  font-size:.95em;
}

/* ------------------------------------------------------------
   Basic content helpers
   ------------------------------------------------------------ */
.ihb-steps{
  margin:0;
  padding-left:18px;
}

.ihb-steps li + li{
  margin-top:8px;
}

.ihb-hero{
  display:grid;
  grid-template-columns:1.1fr .9fr;
  gap:var(--ihb-gap);
  align-items:start;
}

@media (max-width: 980px){
  .ihb-hero{
    grid-template-columns:1fr;
  }
}

.ihb-panel{
  background:var(--ub-surface-2);
  border:1px solid var(--ub-border);
  border-radius:var(--ihb-radius);
  padding:12px;
}

.ihb-side{
  display:grid;
  gap:var(--ihb-gap);
}

.ihb-panel-top{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom:10px;
}

.ihb-panel-title{
  font-size:clamp(13px, 1.2vw, 14px);
  font-weight:950;
  letter-spacing:.01em;
}

.ihb-panel-sub{
  font-size:12px;
  color:var(--ub-muted);
  margin-top:2px;
}

/* ------------------------------------------------------------
   KPI tiles
   ------------------------------------------------------------ */
.ihb-kpis{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  justify-content:flex-end;
}

.ihb-kpi{
  min-width:108px;
  padding:8px 10px;
  border-radius:14px;
  border:1px solid var(--ub-border);
  background:var(--ub-card-bg);
}

.ihb-kpi .k{
  font-size:11px;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.04em;
  color:var(--ub-muted);
}

.ihb-kpi .v{
  font-family:var(--ub-mono);
  font-weight:950;
  font-size:14px;
  margin-top:2px;
  overflow-wrap:anywhere;
}

/* ------------------------------------------------------------
   Input / actions
   ------------------------------------------------------------ */
#hexInput{
  min-height:320px;
  resize:vertical;
  font-family:var(--ub-mono);
  line-height:1.5;
  tab-size:2;
}

.ihb-actions-row{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:12px;
  align-items:center;
}

.ihb-file-btn{
  cursor:pointer;
}

.ihb-option-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0,1fr));
  gap:14px;
  margin-top:14px;
}

@media (max-width: 768px){
  .ihb-option-grid{
    grid-template-columns:1fr;
  }
}

.ihb-inline-row{
  display:flex;
  gap:8px;
  align-items:center;
}

.ihb-inline-row input{
  flex:1 1 auto;
  min-width:0;
}

.ihb-inline-tag{
  min-height:44px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:0 12px;
  border-radius:12px;
  border:1px solid var(--ub-border);
  background:var(--ub-surface-2);
  font-family:var(--ub-mono);
  font-size:13px;
  font-weight:900;
  white-space:nowrap;
}

.ihb-toggle-row{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:12px;
}

.ihb-toggle-row .ub-chip{
  display:flex;
  gap:8px;
  align-items:center;
}

/* ------------------------------------------------------------
   Status / validation
   ------------------------------------------------------------ */
.ihb-status-pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-height:44px;
  padding:10px 12px;
  border-radius:999px;
  border:1px solid var(--ub-border);
  background:var(--ub-card-bg);
  font-size:13px;
  font-weight:950;
  margin-bottom:12px;
}

.ihb-status-pill::before{
  content:"";
  width:10px;
  height:10px;
  border-radius:50%;
  background:var(--ub-muted);
  box-shadow:0 0 0 3px rgba(107,114,128,.15);
  flex:0 0 auto;
}

.ihb-status-pill[data-tone="success"]::before{
  background:var(--ub-success);
  box-shadow:0 0 0 3px rgba(34,197,94,.16);
}

.ihb-status-pill[data-tone="warning"]::before{
  background:var(--ub-warning);
  box-shadow:0 0 0 3px rgba(245,158,11,.16);
}

.ihb-status-pill[data-tone="danger"]::before{
  background:var(--ub-danger);
  box-shadow:0 0 0 3px rgba(239,68,68,.16);
}

.ihb-statlist{
  display:grid;
  gap:8px;
}

.ihb-stat{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  min-height:44px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--ub-border);
  background:var(--ub-surface-2);
}

.ihb-stat .label{
  color:var(--ub-muted);
  font-size:13px;
  font-weight:800;
}

.ihb-stat strong{
  font-family:var(--ub-mono);
  font-size:14px;
  font-weight:950;
  text-align:right;
  overflow-wrap:anywhere;
}

/* ------------------------------------------------------------
   Memory map
   ------------------------------------------------------------ */
.ihb-map{
  position:relative;
  min-height:84px;
  padding:12px;
  border-radius:14px;
  border:1px solid var(--ub-border);
  background:
    linear-gradient(180deg, var(--ub-surface-2), var(--ub-card-bg));
  overflow:hidden;
}

.ihb-map-empty{
  min-height:58px;
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  color:var(--ub-muted);
  font-size:13px;
  font-weight:800;
}

.ihb-map-track{
  position:relative;
  height:22px;
  margin-top:14px;
  border-radius:999px;
  border:1px solid var(--ub-border);
  background:var(--ihb-track);
  overflow:hidden;
}

.ihb-map-seg{
  position:absolute;
  top:0;
  bottom:0;
  border-radius:999px;
  background:var(--ihb-seg);
  box-shadow:0 0 0 1px rgba(255,255,255,.1) inset;
}

.ihb-map-meta{
  display:grid;
  grid-template-columns:repeat(3, minmax(0,1fr));
  gap:10px;
  margin-top:12px;
}

@media (max-width: 640px){
  .ihb-map-meta{
    grid-template-columns:1fr;
  }
}

.ihb-map-meta > div{
  min-height:44px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  gap:4px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--ub-border);
  background:var(--ub-surface-2);
}

.ihb-map-meta span{
  color:var(--ub-muted);
  font-size:12px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.04em;
}

.ihb-map-meta strong{
  font-family:var(--ub-mono);
  font-size:13px;
  font-weight:950;
  overflow-wrap:anywhere;
}

/* ------------------------------------------------------------
   Details / preview
   ------------------------------------------------------------ */
.ihb-detail-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0,1fr));
  gap:14px;
}

@media (max-width: 900px){
  .ihb-detail-grid{
    grid-template-columns:1fr;
  }
}

.ihb-preview{
  margin:0;
  padding:12px;
  border-radius:14px;
  border:1px solid var(--ub-border);
  background:var(--ub-surface-2);
  color:var(--ub-text);
  font-family:var(--ub-mono);
  font-size:12px;
  line-height:1.6;
  white-space:pre-wrap;
  overflow:auto;
  overflow-wrap:anywhere;
}

/* ------------------------------------------------------------
   Format section
   ------------------------------------------------------------ */
.ihb-format-block{
  margin:10px 0 12px;
  padding:12px;
  border-radius:14px;
  border:1px solid var(--ub-border);
  background:var(--ub-surface-2);
  font-family:var(--ub-mono);
  font-size:15px;
  font-weight:950;
  overflow-x:auto;
}

.ihb-format-list{
  margin:0;
  padding-left:18px;
}

.ihb-format-list li + li{
  margin-top:6px;
}

.ihb-table-wrap{
  margin-top:12px;
  overflow-x:auto;
}

/* ------------------------------------------------------------
   FAQ
   ------------------------------------------------------------ */
.ihb-faq-h{
  margin:12px 0 6px;
  font-size:var(--ub-fs-2);
}

.ihb-faq-p{
  margin:0 0 10px;
}

.ihb-faq-p:last-child{
  margin-bottom:0;
}

/* ------------------------------------------------------------
   Shared utility polish
   ------------------------------------------------------------ */
.ub-work{
  font-family:var(--ub-mono);
  font-size:13px;
  line-height:1.6;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
}

.ub-btn--block{
  width:100%;
}

.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;
}

/* ------------------------------------------------------------
   Mobile polish
   ------------------------------------------------------------ */
@media (max-width: 520px){
  .ihb-kpi{
    min-width:96px;
  }

  .ihb-actions-row > *{
    width:100%;
  }

  .ihb-inline-row{
    align-items:stretch;
  }

  .ihb-inline-tag{
    min-width:70px;
  }
}

/* ------------------------------------------------------------
   Dark-mode fine tuning
   ------------------------------------------------------------ */
html.ub-theme-dark .ihb-map{
  background:
    linear-gradient(180deg, rgba(255,255,255,.025), rgba(255,255,255,.02));
}

html.ub-theme-dark .ihb-map-seg{
  box-shadow:
    0 0 0 1px rgba(255,255,255,.08) inset,
    0 6px 18px rgba(249,58,19,.18);
}

html.ub-theme-dark .ihb-preview,
html.ub-theme-dark .ihb-format-block{
  background:rgba(255,255,255,.03);
}