/**
 * Gen AI Cost Estimator — Styles
 * apps/genai/ai_cost_estimator/main_ai_cost_estimator.css
 *
 * Minimal overrides layered on top of shared/css/main.css.
 */

/* ── Tokenizer sandbox ────────────────────────────────────────────────────── */

.tokenizer-textarea {
  width: 100%;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.92rem;
  line-height: 1.5;
  padding: 0.75rem;
  border: 1px solid var(--app-border, #d6dfea);
  border-radius: 6px;
  resize: vertical;
  background: #fdfdfe;
  color: var(--app-text, #1f2a37);
  margin-top: 0.5rem;
}

.tokenizer-textarea:focus {
  outline: 2px solid var(--app-accent, #2a7de1);
  outline-offset: -1px;
  border-color: var(--app-accent, #2a7de1);
}

.tokenizer-stats {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
  font-size: 0.9rem;
  color: var(--app-muted, #5f6b7a);
}

.token-stat-divider {
  font-size: 1.1rem;
  color: var(--app-accent, #2a7de1);
}

.token-viz-container {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.88rem;
  line-height: 1.8;
  padding: 0.75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  min-height: 2.5rem;
  overflow-wrap: break-word;
}

.token-chip {
  display: inline;
  padding: 1px 2px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  cursor: default;
}

.token-chip--punct {
  font-weight: 700;
  border-style: dashed;
}

.token-chip--number {
  font-variant-numeric: tabular-nums;
}

.token-chip--split {
  border-style: dotted;
  border-color: #d97706;
}

.tokenizer-rules-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
  font-size: 0.88rem;
}

.tokenizer-rules-box ul {
  margin: 0.4rem 0 0 1.2rem;
  padding: 0;
  line-height: 1.7;
}

.tokenizer-rules-box code {
  background: #f1f5f9;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.85em;
}

.token-viz-empty {
  color: var(--app-muted, #5f6b7a);
  font-style: italic;
  font-family: inherit;
}


/* ── Tier selector ────────────────────────────────────────────────────────── */

.input-section-intro {
  font-size: 0.93rem;
  color: var(--app-muted, #5f6b7a);
  margin: 0 0 1rem 0;
  line-height: 1.6;
}

.hint-list {
  margin: 0.25rem 0 0 1.25rem;
  padding: 0;
  font-size: 0.85rem;
  color: var(--app-muted, #5f6b7a);
  line-height: 1.65;
}

.hint-list li {
  margin-bottom: 0.2rem;
}

.hint-expander {
  margin-top: 0.35rem;
  font-size: 0.85rem;
  color: var(--app-muted, #5f6b7a);
}

.hint-expander summary {
  cursor: pointer;
  color: var(--app-accent, #2a7de1);
  font-weight: 500;
}

.hint-expander p {
  margin-top: 0.3rem;
}

.tier-selector {
  margin-bottom: 1rem;
}

.tier-buttons {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.tier-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.6rem 1.2rem;
  border: 2px solid var(--app-border, #d6dfea);
  border-radius: 8px;
  background: var(--app-card-bg, #fff);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  min-width: 120px;
}

.tier-button:hover {
  border-color: var(--app-accent, #2a7de1);
  background: #f0f7ff;
}

.tier-button.active {
  border-color: var(--app-accent, #2a7de1);
  background: #e8f2ff;
  box-shadow: 0 0 0 2px rgba(42, 125, 225, 0.18);
}

.tier-btn-label {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--app-text, #1f2a37);
}

.tier-btn-sub {
  font-size: 0.78rem;
  color: var(--app-muted, #5f6b7a);
  margin-top: 2px;
}

.tier-pricing-display {
  margin-top: 0.4rem;
  font-size: 0.85rem;
}


/* ── Custom pricing panel ─────────────────────────────────────────────────── */

.custom-pricing-row {
  margin: 0.75rem 0;
}

.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--app-muted, #5f6b7a);
}

.custom-pricing-inputs {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.custom-pricing-inputs.hidden {
  display: none;
}

.input-pair-inline {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.input-pair-inline label {
  font-size: 0.85rem;
  color: var(--app-muted, #5f6b7a);
  white-space: nowrap;
}

.input-pair-inline input {
  width: 90px;
}


/* ── Chart layout ─────────────────────────────────────────────────────────── */

.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.chart-grid--single {
  /* Inherits 2-column from .chart-grid */
  margin-top: 0;
}

.chart-card {
  padding: 1.25rem;
}

.chart-card h3 {
  margin: 0 0 0.25rem 0;
  font-size: 1.05rem;
}

.chart-container {
  width: 100%;
  min-height: 320px;
  /* Plotly respects container height — give charts breathing room */
}


/* ── Metrics grid ─────────────────────────────────────────────────────────── */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.metric-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
}

.metric-card--highlight {
  background: #e8f2ff;
  border-color: var(--app-accent, #2a7de1);
}

.metric-card__label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--app-muted, #5f6b7a);
  margin-bottom: 0.25rem;
}

.metric-card__value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--app-text, #1f2a37);
  line-height: 1.2;
}

.metric-card--highlight .metric-card__value {
  color: var(--app-accent, #2a7de1);
}

.metric-card__sub {
  font-size: 0.75rem;
  color: var(--app-muted, #5f6b7a);
  margin-top: 0.2rem;
}


/* ── Accumulation tax callout ─────────────────────────────────────────────── */

.accumulation-callout {
  background: #fef3c7;
  border-left: 4px solid #f59e0b;
  border-radius: 4px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #92400e;
}


/* ── Report text ──────────────────────────────────────────────────────────── */

.report-text {
  font-size: 0.93rem;
  line-height: 1.6;
}


/* ── Pricing table (in educational section) ───────────────────────────────── */

.pricing-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.88rem;
}

.pricing-table th,
.pricing-table td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border: 1px solid #e2e8f0;
}

.pricing-table thead tr {
  background: #f1f5f9;
}

.pricing-table tbody tr:nth-child(even) {
  background: #f8fafc;
}


/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .chart-grid {
    grid-template-columns: 1fr;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .tier-buttons {
    flex-direction: column;
  }

  .tier-button {
    min-width: unset;
    flex-direction: row;
    gap: 0.5rem;
  }
}

@media (max-width: 480px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }
}


/* ── Anatomy of an API Call ────────────────────────────────────────────────── */

.anatomy-wrapper {
  background: var(--app-card-bg, #fff);
  border: 1px solid var(--app-border, #d6dfea);
  border-radius: 10px;
  padding: 1.25rem 1.5rem 1rem;
  margin: 1.25rem 0;
}

.anatomy-title {
  margin: 0 0 0.25rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--app-text, #1f2a37);
}

.anatomy-subtitle {
  margin: 0 0 1rem 0;
  font-size: 0.85rem;
  color: #6b7280;
  line-height: 1.45;
}

.anatomy-bars {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.5rem 0;
  min-height: 100px;
}

.anatomy-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.anatomy-stacked {
  width: 100%;
  max-width: 56px;
  display: flex;
  flex-direction: column;
  border-radius: 4px 4px 0 0;
  overflow: hidden;
  transition: height 0.35s ease;
}

.anatomy-seg {
  width: 100%;
  min-height: 0;
  transition: height 0.35s ease;
}

.anatomy-seg:hover {
  filter: brightness(1.15);
  cursor: default;
}

.anatomy-seg--sys    { background: #8b5cf6; }
.anatomy-seg--ctx    { background: #0ea5e9; }
.anatomy-seg--usr    { background: #22c55e; }
.anatomy-seg--hist   { background: #f59e0b; }
.anatomy-seg--output { background: #6366f1; }

.anatomy-label {
  font-size: 0.7rem;
  color: #6b7280;
  margin-top: 0.35rem;
  white-space: nowrap;
}

.anatomy-token-count {
  font-size: 0.65rem;
  color: #9ca3af;
  font-variant-numeric: tabular-nums;
}

/* batch-4 capture pass: up to 13 columns (12 turns + "more") must fit the card. */
.anatomy-bars--dense { gap: 0.25rem; }
.anatomy-bars--dense .anatomy-label { font-size: 0.6rem; }
.anatomy-bars--dense .anatomy-token-count { font-size: 0.58rem; }

.anatomy-ellipsis {
  justify-content: flex-end;
  font-size: 1.2rem;
  color: #9ca3af;
  padding-bottom: 0.25rem;
}

.anatomy-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
  font-size: 0.78rem;
  color: #4b5563;
}

.anatomy-legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.anatomy-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.anatomy-insight {
  margin-top: 0.75rem;
  padding: 0.6rem 0.85rem;
  background: #fef3c7;
  border-left: 3px solid #f59e0b;
  border-radius: 4px;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #92400e;
}

@media (max-width: 480px) {
  .anatomy-bars {
    gap: 0.3rem;
  }

  .anatomy-stacked {
    max-width: 40px;
  }

  .anatomy-legend {
    gap: 0.5rem;
    font-size: 0.72rem;
  }
}


/* ── ROI inputs ───────────────────────────────────────────────────────────── */

.roi-inputs-header {
  margin-bottom: 0.75rem;
}

.roi-inputs-header h4 {
  margin: 0 0 0.25rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--app-text, #1f2a37);
}

.roi-inputs-header .muted {
  font-size: 0.88rem;
  margin: 0;
}

.input-grid--two {
  grid-template-columns: 1fr 1fr;
}

.input-grid--three {
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

@media (max-width: 900px) {
  .input-grid--three {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .input-grid--two {
    grid-template-columns: 1fr;
  }
}


/* ── Business Case section ────────────────────────────────────────────────── */

.biz-versus {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-bottom: 1rem;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--app-border, #d6dfea);
}

.biz-versus__side {
  flex: 1;
  text-align: center;
  padding: 1.25rem 1rem;
}

.biz-versus__side--human {
  background: #fef2f2;
}

.biz-versus__side--ai {
  background: #f0fdf4;
}

.biz-versus__icon {
  font-size: 1.8rem;
  margin-bottom: 0.25rem;
}

.biz-versus__label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #6b7280;
  margin-bottom: 0.35rem;
}

.biz-versus__cost {
  font-size: 1.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--app-text, #1f2a37);
}

.biz-versus__sub {
  font-size: 0.75rem;
  color: #9ca3af;
}

.biz-versus__divider {
  display: flex;
  align-items: center;
  background: var(--app-card-bg, #fff);
  padding: 0 0.75rem;
  border-left: 1px solid var(--app-border, #d6dfea);
  border-right: 1px solid var(--app-border, #d6dfea);
}

.biz-versus__vs {
  font-size: 0.85rem;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
}

.biz-versus__per-convo {
  text-align: center;
  font-size: 0.85rem;
  color: #6b7280;
  margin-bottom: 1rem;
}

.biz-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.biz-metric-card {
  text-align: center;
  padding: 0.85rem 0.5rem;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
}

.biz-metric-card--savings {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.biz-metric-card--negative .biz-metric-card__value {
  color: #dc2626;
}

.biz-metric-card--savings.biz-metric-card--negative {
  background: #fef2f2;
  border-color: #fecaca;
}

.biz-metric-card__label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #6b7280;
  margin-bottom: 0.25rem;
}

.biz-metric-card__value {
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #16a34a;
}

.biz-insight {
  padding: 0.65rem 0.9rem;
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1.5;
}

.biz-insight--positive {
  background: #f0fdf4;
  border-left: 3px solid #22c55e;
  color: #166534;
}

.biz-insight--negative {
  background: #fef2f2;
  border-left: 3px solid #ef4444;
  color: #991b1b;
}

.biz-insight--neutral {
  background: #f8fafc;
  border-left: 3px solid #94a3b8;
  color: #475569;
}

@media (max-width: 600px) {
  .biz-versus {
    flex-direction: column;
  }

  .biz-versus__divider {
    justify-content: center;
    padding: 0.4rem;
    border-left: none;
    border-right: none;
    border-top: 1px solid var(--app-border, #d6dfea);
    border-bottom: 1px solid var(--app-border, #d6dfea);
  }

  .biz-metrics-grid {
    grid-template-columns: 1fr;
  }
}
