/* ============================================================
 * Utilities Bunker — Palette Generator (v2.1)
 * File: /assets/css/modules/colors/palette-generator.v2.1.css
 * Purpose:
 *  - Tool-only layout + swatch grid/strip styling + export actions
 *  - No changes to ub-toolkit.v2.1.css required
 *  - Mobile-first, 44x44 targets, clamp typography
 * ============================================================ */

/* ============================== Local tokens (tool-scoped) ============================== */
:root{
  --pg-radius: 16px;
  --pg-gap: 14px;
  --pg-soft: rgba(0,0,0,.06);
  --pg-soft2: rgba(0,0,0,.10);
}
html.ub-theme-dark:root{
  --pg-soft: rgba(255,255,255,.06);
  --pg-soft2: rgba(255,255,255,.10);
}

/* ============================== Hero layout (preview + controls) ============================== */
.ub-pg-hero{
  display:grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: var(--pg-gap);
}
@media (max-width: 980px){
  .ub-pg-hero{ grid-template-columns: 1fr; }
}

/* ============================== Preview panel ============================== */
.ub-pg-preview{
  background: var(--ub-surface-2);
  border: 1px solid var(--ub-border);
  border-radius: var(--pg-radius);
  padding: 12px;
}
.ub-pg-preview-top{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap: 10px;
  flex-wrap:wrap;
  margin-bottom: 10px;
}
.ub-pg-title{
  font-size: clamp(13px, 1.2vw, 14px);
  font-weight: 950;
  letter-spacing: .01em;
}
.ub-pg-sub{
  font-size: 12px;
  color: var(--ub-muted);
  margin-top: 2px;
}

/* ============================== KPI tiles ============================== */
.ub-pg-kpis{
  display:flex;
  flex-wrap:wrap;
  gap: 8px;
  justify-content:flex-end;
}
.ub-pg-kpi{
  min-width: 120px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid var(--ub-border);
  background: var(--ub-card-bg);
}
.ub-pg-kpi .k{
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ub-muted);
}
.ub-pg-kpi .v{
  font-family: var(--ub-mono);
  font-weight: 950;
  font-size: 13px;
  margin-top: 2px;
}

/* ============================== Swatch strip/grid ============================== */
.ub-pg-strip{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 560px){
  .ub-pg-strip{ grid-template-columns: 1fr; }
}

.ub-pg-swatch{
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.14);
  overflow:hidden;
  min-height: 160px;
  padding: 12px;
  position: relative;
  display:flex;
  flex-direction:column;
  gap: 10px;
  cursor: pointer;
  user-select:none;
  box-shadow: 0 10px 24px rgba(0,0,0,.12);
}
html.ub-theme-dark .ub-pg-swatch{
  border-color: rgba(255,255,255,.18);
  box-shadow: 0 18px 42px rgba(0,0,0,.55);
}

/* Focus ring */
.ub-pg-swatch:focus{
  outline:none;
  box-shadow: 0 0 0 4px var(--ub-focus), 0 10px 24px rgba(0,0,0,.12);
}

/* top line */
.ub-pg-swatch-top{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap: 10px;
}
.ub-pg-tag{
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.22);
  border: 1px solid rgba(255,255,255,.25);
  backdrop-filter: blur(3px);
}
html.ub-theme-dark .ub-pg-tag{
  background: rgba(0,0,0,.18);
  border-color: rgba(0,0,0,.22);
}

/* hex */
.ub-pg-hex{
  font-family: var(--ub-mono);
  font-weight: 950;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.22);
  backdrop-filter: blur(3px);
}
html.ub-theme-dark .ub-pg-hex{
  background: rgba(0,0,0,.16);
  border-color: rgba(0,0,0,.22);
}

/* meta grid inside swatch */
.ub-pg-meta{
  display:grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  margin-top: 2px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.20);
  backdrop-filter: blur(3px);
}
html.ub-theme-dark .ub-pg-meta{
  background: rgba(0,0,0,.14);
  border-color: rgba(0,0,0,.20);
}
.ub-pg-meta .k{
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: .92;
}
.ub-pg-meta .v{
  font-family: var(--ub-mono);
  font-weight: 950;
  font-size: 12px;
  overflow-wrap:anywhere;
}

/* actions row */
.ub-pg-actions{
  display:flex;
  flex-wrap:wrap;
  gap: 8px;
  margin-top: auto;
}
.ub-pg-chip{
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.26);
  background: rgba(255,255,255,.16);
  color: inherit;
  font-weight: 950;
}
html.ub-theme-dark .ub-pg-chip{
  border-color: rgba(0,0,0,.22);
  background: rgba(0,0,0,.12);
}
@media (hover: hover){
  .ub-pg-chip:hover{ background: rgba(255,255,255,.24); }
  html.ub-theme-dark .ub-pg-chip:hover{ background: rgba(0,0,0,.18); }
}
.ub-pg-chip:focus{
  outline:none;
  box-shadow: 0 0 0 4px var(--ub-focus);
}

/* css var line */
.ub-pg-var{
  font-family: var(--ub-mono);
  font-weight: 950;
  font-size: 12px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.20);
  backdrop-filter: blur(3px);
  overflow-wrap:anywhere;
}
html.ub-theme-dark .ub-pg-var{
  background: rgba(0,0,0,.14);
  border-color: rgba(0,0,0,.20);
}

/* ============================== Strip actions ============================== */
.ub-pg-strip-actions{
  display:flex;
  flex-wrap:wrap;
  gap: 10px;
  margin-top: 12px;
}
.ub-pg-strip-actions .ub-btn{
  min-width: 180px;
}
@media (max-width: 520px){
  .ub-pg-strip-actions .ub-btn{ width:100%; }
}

/* ============================== Slider rows ============================== */
.ub-pg-sliders{
  margin-top: 2px;
}
.ub-pg-sliderrow{
  display:flex;
  gap: 10px;
  align-items:center;
  flex-wrap:wrap;
  margin-top: 10px;
}
.ub-pg-mono{
  font-family: var(--ub-mono);
  font-weight: 950;
  min-width: 62px;
  text-align:right;
}

/* Make the color input look consistent while keeping native behavior */
#basePick{
  height: var(--ub-hit);
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--ub-border);
  background: var(--ub-surface-1);
  width: 100%;
}

/* Ensure .ub-inputrow doesn't break when we have 2 inputs in it */
.ub-field .ub-inputrow > input[type="color"]{
  margin-top: 6px;
}

/* Work box style (monospace details) */
.ub-work{
  font-family: var(--ub-mono);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap:anywhere;
}

/* Right rail full width buttons helper (safe) */
.ub-btn--block{ width: 100%; }

/* Small screens polish */
@media (max-width: 520px){
  .ub-pg-kpi{ min-width: 104px; }
}
