/* Build with Baker - AI Cost Estimator styles. Scoped under .ace. CSP-safe (no inline styles). */

.ace { max-width: 760px; }

.ace-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg, 14px);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
@media (max-width: 620px) { .ace-controls { grid-template-columns: 1fr; } }

.ace-field { display: flex; flex-direction: column; gap: 6px; }
.ace-field label { font-size: .82rem; font-weight: 600; color: var(--color-text); }
.ace-field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--color-card);
  color: var(--color-text);
  box-sizing: border-box;
}
.ace-field input:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
  border-color: var(--color-primary);
}
.ace-field .ace-hint { font-size: .72rem; color: var(--color-text-muted); }

.ace-presets-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 16px 0 4px; }
.ace-presets-label { font-size: .8rem; font-weight: 600; color: var(--color-text-muted); margin-right: 2px; }
.ace-preset {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.ace-preset:hover { border-color: var(--color-primary); color: var(--color-primary); }

.ace-batch { display: flex; align-items: center; gap: 8px; margin: 14px 0 4px; font-size: .85rem; color: var(--color-text); }

.ace-summary {
  margin: 18px 0 12px;
  padding: 12px 14px;
  background: var(--color-bg);
  border-left: 3px solid var(--color-primary);
  border-radius: 6px;
  font-size: .92rem;
  color: var(--color-text);
}

.ace-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg, 14px);
}
table.ace-table { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 520px; }
.ace-table thead th {
  text-align: right;
  padding: 10px 12px;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-on-primary);
  background: var(--color-primary-solid);
  font-weight: 700;
  white-space: nowrap;
}
.ace-table thead th:first-child { text-align: left; }
.ace-table tbody td { padding: 10px 12px; border-top: 1px solid var(--color-border); }
.ace-table .ace-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ace-table .ace-total { font-weight: 700; color: var(--color-text); }
.ace-table .ace-model { font-weight: 600; color: var(--color-text); }
.ace-table .ace-prov { display: block; font-size: .72rem; font-weight: 500; color: var(--color-text-muted); }
.ace-table tr.ace-brand td { background: rgba(43, 74, 139, .06); }
.ace-table tr.ace-brand .ace-model { color: var(--color-primary); }

.ace-note { font-size: .78rem; color: var(--color-text-muted); margin-top: 12px; }
.ace-note a { color: var(--color-primary); }

/* --- Hero result (dominant element) --- */
.ace-hero { margin: 18px 0 6px; }
.ace-hero-on {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px;
  background: var(--color-card);
  border: 1px solid var(--color-border); border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-lg, 14px); padding: 16px 20px; box-shadow: var(--shadow-sm);
}
.ace-hero-main { display: flex; flex-direction: column; gap: 2px; }
.ace-hero-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 700; color: var(--color-text-muted); }
.ace-hero-num { font-size: 2.1rem; font-weight: 800; color: var(--color-primary); font-variant-numeric: tabular-nums; line-height: 1.05; }
.ace-hero-per { font-size: 1rem; font-weight: 600; color: var(--color-text-muted); }
.ace-hero-model { font-size: .9rem; font-weight: 600; color: var(--color-text); display: flex; align-items: center; }
.ace-hero-claude { font-size: .86rem; color: var(--color-text); }

/* --- Provider dots --- */
.ace-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; background: var(--color-text-muted); vertical-align: middle; }
.ace-dot-anthropic { background: #2B4A8B; }
.ace-dot-openai { background: #10a37f; }
.ace-dot-google { background: #e8710a; }

/* --- Cheapest badge --- */
.ace-badge { display: inline-block; margin-left: 8px; font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #1f6b3b; background: #e3f3ea; border-radius: 999px; padding: 1px 8px; vertical-align: middle; }

/* --- Cost magnitude bar --- */
.ace-table .ace-total-val { display: block; }
.ace-bar { display: block; height: 4px; margin: 5px 0 0 auto; border-radius: 999px; background: #9aa6bb; width: 0; transition: width .35s cubic-bezier(0,0,.2,1); }
.ace-table tr.ace-brand .ace-bar { background: var(--color-primary); }

/* --- Row states --- */
.ace-table tbody tr { transition: background .12s ease; }
.ace-table tbody tr:hover td { background: rgba(43,74,139,.04); }
.ace-table tr.ace-best td { background: rgba(31,107,59,.05); }
.ace-table tr.ace-best.ace-brand td { background: rgba(43,74,139,.07); }

@media (prefers-reduced-motion: reduce) { .ace-bar, .ace-table tbody tr { transition: none; } }

/* --- Micro-interactions (compositor-safe: transform/opacity/shadow, ease-out, 120-200ms) --- */
.ace-controls, .ace-hero-on { transition: box-shadow 200ms cubic-bezier(0,0,.2,1); }
.ace-controls:hover, .ace-hero-on:hover { box-shadow: var(--shadow-md); }
.ace-field input { transition: border-color 120ms cubic-bezier(0,0,.2,1), box-shadow 120ms cubic-bezier(0,0,.2,1); }
.ace-field input:focus { box-shadow: 0 0 0 3px rgba(43,74,139,.14); }
.ace-preset { transition: transform 120ms cubic-bezier(0,0,.2,1), box-shadow 120ms cubic-bezier(0,0,.2,1), border-color 120ms cubic-bezier(0,0,.2,1), color 120ms cubic-bezier(0,0,.2,1); }
.ace-preset:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.ace-preset:active { transform: translateY(0) scale(.98); }

/* --- Responsive: drop the per-million rate columns on phones so the table fits without sideways scroll --- */
@media (max-width: 560px) {
  .ace-hero-num { font-size: 1.7rem; }
  table.ace-table { min-width: 0; }
  .ace-table th:nth-child(2), .ace-table th:nth-child(3),
  .ace-table td:nth-child(2), .ace-table td:nth-child(3) { display: none; }
}

/* --- Opinionated workload tip callout --- */
.ace-tip {
  margin: -2px 0 14px;
  font-size: .88rem;
  color: var(--color-text);
  background: var(--color-card);
  border-left: 3px solid #1f9d55;
  border-radius: 6px;
  padding: 10px 14px;
}
.ace-tip:empty { display: none; }

@media (prefers-reduced-motion: reduce) {
  .ace-controls, .ace-hero-on, .ace-field input, .ace-preset { transition: none; }
  .ace-preset:hover, .ace-preset:active { transform: none; }
}

/* --- Tool header band moved to styles.css (now shared across all tool pages) --- */

/* ============================================================
   Dark theme
   This sheet had no data-theme rules at all, so every hardcoded light value
   below stayed light on a navy page. Each one is re-stated against the dark
   surfaces rather than tinted, so the table reads the same way in both themes.
   ============================================================ */
html[data-theme="dark"] .ace-table tr.ace-brand td { background: rgba(110,144,212,.10); }
html[data-theme="dark"] .ace-table tbody tr:hover td { background: rgba(110,144,212,.07); }
html[data-theme="dark"] .ace-table tr.ace-best td { background: rgba(95,193,142,.09); }
html[data-theme="dark"] .ace-table tr.ace-best.ace-brand td { background: rgba(110,144,212,.13); }

/* The cheapest badge was dark green on a pale mint chip - unreadable as a light
   chip on a dark card, and the wrong weight next to it. Dark chip, light text. */
html[data-theme="dark"] .ace-badge { color: #7FD9A6; background: #12301F; }

/* Provider dots and the magnitude bar are 8px marks: they need 3:1 against the
   card, and #2B4A8B on #1A2236 is 1.9:1. */
html[data-theme="dark"] .ace-dot-anthropic { background: #6E90D4; }
html[data-theme="dark"] .ace-dot-openai { background: #3DD3AA; }
html[data-theme="dark"] .ace-dot-google { background: #F0913A; }
html[data-theme="dark"] .ace-bar { background: #7C8AA3; }

/* Focus glow and the tip rule were both built from the light indigo/green. */
html[data-theme="dark"] .ace-field input:focus { box-shadow: 0 0 0 3px rgba(110,144,212,.24); }
html[data-theme="dark"] .ace-tip { border-left-color: #3FBF77; }
