/* ═══════════════════════════════════════════════════════════════════
   /public/css/calc-simple-toggle.css  —  Horizontal tabs (v2)
   ─────────────────────────────────────────────────────────────────
   Replaces the vertical Quick/Advanced toggle with the cleaner
   horizontal-tabs look used on Agentic Workflow Cost.

   Backward-compatible: keeps the same HTML structure
   (.cst-toggle, .cst-active, .cst-advanced, .cst-meta) so calcs
   already using this pattern get the new look automatically with
   zero markup changes.

   To roll out: replace /public/css/calc-simple-toggle.css with this
   file and refresh the page. Existing JS handler in
   /public/js/calc-simple-toggle.js continues to work as-is.
   ═══════════════════════════════════════════════════════════════════ */

/* ─── TOGGLE CONTAINER ────────────────────────────────────────────── */
.cst-toggle {
  display: flex;
  flex-direction: row;        /* explicit — some host CSS sets column on flex parents */
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 8px;
  margin: 0 0 24px;
  padding: 6px;
  background: #f1f3f5;
  border-radius: 12px;
  max-width: 720px;
  width: 100%;
  box-sizing: border-box;
  /* If a grid parent (e.g. .calc-layout with grid-template-columns), span all columns
     so the toggle gets its own full-width row instead of being squished into 1 cell. */
  grid-column: 1 / -1;
  /* Same idea for flex parents that wrap children into rows. */
  flex-basis: 100%;
}

/* ─── TOGGLE BUTTONS (horizontal pills) ───────────────────────────── */
.cst-toggle button,
.cst-toggle [role="button"] {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 14px 18px;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: #6b7280;
  text-align: left;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
  min-width: 0;
}

.cst-toggle button:hover,
.cst-toggle [role="button"]:hover {
  background: rgba(255,255,255,.55);
  color: #374151;
}

.cst-toggle button:focus-visible,
.cst-toggle [role="button"]:focus-visible {
  outline: 2px solid #00a67e;
  outline-offset: 2px;
}

.cst-toggle .cst-active {
  background: #fff;
  color: #1a1a1a;
  box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
}

/* ─── BUTTON META TEXT ("3 fields", "All options") ────────────────── */
.cst-toggle .cst-meta {
  font-size: 0.78rem;
  color: #9ca3af;
  font-weight: 500;
  margin-left: auto;
  white-space: nowrap;
}

.cst-toggle .cst-active .cst-meta {
  color: #6b7280;
}

/* ─── ADVANCED FIELDS VISIBILITY ───────────────────────────────────── */
/* Hide .cst-advanced elements when the wrapper is in quick mode.
   The existing JS in /js/calc-simple-toggle.js sets either:
     - data-cst-mode="advanced" on the [data-cst] wrapper, OR
     - .cst-mode-advanced class on the [data-cst] wrapper.
   We support both signalling patterns for compatibility.            */

[data-cst] .cst-advanced {
  display: none !important;
}

[data-cst][data-cst-mode="advanced"] .cst-advanced,
[data-cst].cst-mode-advanced .cst-advanced,
[data-cst] .cst-advanced.cst-show {
  display: block !important;
}

/* For inline elements (e.g. inline labels) preserve flex/inline-block */
[data-cst][data-cst-mode="advanced"] .cst-advanced.cst-inline,
[data-cst].cst-mode-advanced .cst-advanced.cst-inline {
  display: inline-block !important;
}

[data-cst][data-cst-mode="advanced"] .cst-advanced.cst-flex,
[data-cst].cst-mode-advanced .cst-advanced.cst-flex {
  display: flex !important;
}

/* ─── OPTIONAL SHARE BUTTON ───────────────────────────────────────── */
.cst-toggle .cst-share {
  flex: 0 0 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  color: #9ca3af;
  transition: background .15s, color .15s;
}

.cst-toggle .cst-share:hover {
  background: rgba(255,255,255,.55);
  color: #374151;
}

/* ─── RESPONSIVE ──────────────────────────────────────────────────── */
@media (max-width: 560px) {
  .cst-toggle {
    gap: 4px;
    padding: 4px;
  }
  .cst-toggle button,
  .cst-toggle [role="button"] {
    padding: 12px 14px;
    font-size: 0.88rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .cst-toggle .cst-meta {
    font-size: 0.7rem;
    margin-left: 0;
  }
}
