/* ============================================================
   calc-pill-group.css  —  aicost.ai v4 pattern add-on
   Segmented pill controls (PetsCalculator-style) replacing <select>
   Load AFTER calc-diagram-lightbox.css, or append to it.
   ============================================================ */

:root {
  --pill-accent: #f97316;        /* aicost.ai orange */
  --pill-accent-soft: #fff7ed;   /* orange-50 tint    */
  --pill-border: #d1d5db;
  --pill-text: #374151;
  --pill-radius: 9999px;
  --pill-min-h: 44px;            /* Apple HIG min tap target */
}

/* ---- Group container ---- */
.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 14px;
}

/* Label above group */
.pill-group-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--pill-text);
  margin-bottom: 6px;
}

/* ---- Individual pill ---- */
.pill {
  flex: 1 1 auto;
  min-height: var(--pill-min-h);
  min-width: 64px;
  padding: 8px 16px;
  font-size: 16px;               /* prevents iOS auto-zoom */
  font-weight: 500;
  line-height: 1.25;
  color: var(--pill-text);
  background: #fff;
  border: 1.5px solid var(--pill-border);
  border-radius: var(--pill-radius);
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  touch-action: manipulation;    /* kills 300ms tap delay */
  -webkit-tap-highlight-color: transparent;
  transition: background .12s ease, border-color .12s ease,
              color .12s ease, transform .06s ease;
  user-select: none;
}
.pill:active { transform: scale(.97); }

.pill[aria-pressed="true"] {
  background: var(--pill-accent);
  border-color: var(--pill-accent);
  color: #fff;
  font-weight: 600;
}

/* Soft variant (secondary groups, e.g. unit toggles) */
.pill-group--soft .pill[aria-pressed="true"] {
  background: var(--pill-accent-soft);
  border-color: var(--pill-accent);
  color: var(--pill-accent);
}

/* Two-line pills (e.g. "Puppy / <4mo") */
.pill small {
  display: block;
  font-size: 0.6875rem;
  font-weight: 400;
  opacity: .75;
  white-space: nowrap;
}

/* ---- Compact unit toggle (lb/kg style, attached pair) ---- */
.pill-group--joined { gap: 0; flex-wrap: nowrap; width: max-content; }
.pill-group--joined .pill { flex: 0 0 auto; border-radius: 0; margin-left: -1.5px; }
.pill-group--joined .pill:first-child {
  border-radius: var(--pill-radius) 0 0 var(--pill-radius); margin-left: 0;
}
.pill-group--joined .pill:last-child {
  border-radius: 0 var(--pill-radius) var(--pill-radius) 0;
}

/* ---- Result panel empty state ---- */
.calc-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 16px;
  text-align: center;
  color: #6b7280;
  font-size: 0.9375rem;
  border: 1.5px dashed var(--pill-border);
  border-radius: 12px;
  background: #f9fafb;
}
.calc-empty-state .icon { font-size: 1.75rem; opacity: .6; }
.calc-has-input .calc-empty-state { display: none; }
.calc-result-body { display: none; }
.calc-has-input .calc-result-body { display: block; }

/* ---- Conditional "don't know" fallback block ---- */
.calc-fallback-note {
  display: none;
  margin: 8px 0 14px;
  padding: 12px 14px;
  font-size: 0.875rem;
  line-height: 1.5;
  color: #7c2d12;
  background: var(--pill-accent-soft);
  border-left: 3px solid var(--pill-accent);
  border-radius: 8px;
}
.calc-fallback-note.is-visible { display: block; }

/* ---- Mobile ---- */
@media (max-width: 640px) {
  .pill-group { gap: 6px; }
  .pill { flex: 1 1 calc(50% - 6px); padding: 10px 12px; } /* 2-up grid feel */
  .pill-group--joined .pill,
  .pill-group--row .pill { flex: 1 1 auto; }               /* keep 1-row groups */
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .pill { transition: none; }
  .pill:active { transform: none; }
}
