/* ═══════════════════════════════════════════════════════════════
   Ordica Prompt Analyzer — embedded/scoped styles
   Scope: all rules live under .analyzer-embed so they cannot
   bleed into the landing page. Global resets, :root, body, nav,
   #stars, and .btn-alpha are intentionally excluded here — those
   are owned by the landing page already.

   Custom variables not defined in landing's :root are declared
   under .analyzer-embed directly so they are available to all
   descendant rules.
   ══════════════════════════════════════════════════════════════ */

.analyzer-embed {
  /* Variables that exist in analyze.css :root but not in landing's :root */
  --surface-2: rgba(255,255,255,0.04);
  --border-strong: rgba(255,255,255,0.12);
  --error: #ff5f6d;
  --c-system: #3ec9c1;
  --c-fewshot: #e8a84c;
  --c-rag: #4a8fd4;
  --c-tools: #a96bd4;
  --c-user: #22d3a7;
  --c-assistant: #d4773a;

  /* Layout wrapper */
  position: relative;
  z-index: 1;
  max-width: 880px;
  margin: 0 auto 40px;
  padding: 0 24px;
}

/* ═══ MAIN ═══ */
.analyzer-embed .analyzer-main {
  position: relative;
  z-index: 1;
  padding: 0 0 40px;
}

/* ═══ CARD ═══ */
.analyzer-embed .card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 20px;
  animation: fade-up 0.7s cubic-bezier(0.16,1,0.3,1) both;
}
.analyzer-embed .card-label {
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
  display: block;
  margin-bottom: 14px;
}
.analyzer-embed .card-h2 {
  font-family: 'Questrial', sans-serif;
  font-size: 22px;
  color: var(--white);
  font-weight: 400;
  margin-bottom: 18px;
}

/* ═══ INPUT CARD ═══ */
.analyzer-embed .input-card { padding: 32px; }
.analyzer-embed .prompt-textarea {
  width: 100%;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--white);
  padding: 18px 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13.5px;
  line-height: 1.7;
  outline: none;
  resize: vertical;
  min-height: 200px;
  max-height: 60vh;
  transition: border-color 0.2s;
}
.analyzer-embed .prompt-textarea:focus { border-color: rgba(62,201,193,0.4); }
.analyzer-embed .prompt-textarea::placeholder { color: var(--text-dim); }

.analyzer-embed .input-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-dim);
}
.analyzer-embed .char-counter { font-family: 'JetBrains Mono', monospace; }
.analyzer-embed .kbd-hint { font-size: 11px; }
.analyzer-embed .kbd-hint kbd {
  display: inline-block;
  padding: 2px 6px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--text);
}

.analyzer-embed .model-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.analyzer-embed .model-row-label {
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
  margin-right: 6px;
}
.analyzer-embed .model-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.analyzer-embed .model-pill:hover {
  border-color: rgba(62,201,193,0.4);
  color: var(--white);
}
.analyzer-embed .model-pill input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--teal);
  width: 14px;
  height: 14px;
}
.analyzer-embed .model-pill:has(input:checked) {
  background: rgba(62,201,193,0.08);
  border-color: rgba(62,201,193,0.4);
  color: var(--white);
}

.analyzer-embed .btn-primary {
  width: 100%;
  margin-top: 22px;
  padding: 16px 28px;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  color: #fff;
  border: none;
  border-radius: 11px;
  font-size: 15.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
  font-family: 'Nunito Sans';
  letter-spacing: 0.2px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.analyzer-embed .btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 36px var(--glow-teal);
}
.analyzer-embed .btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: var(--surface-2);
}
.analyzer-embed .btn-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.analyzer-embed .btn-primary[aria-busy="true"] .btn-spinner { display: inline-block; }
.analyzer-embed .btn-primary[aria-busy="true"] .btn-text { opacity: 0.6; }

.analyzer-embed .btn-secondary {
  padding: 11px 22px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Nunito Sans';
  margin-right: 8px;
}
.analyzer-embed .btn-secondary:hover {
  border-color: rgba(62,201,193,0.4);
  color: var(--white);
}

.analyzer-embed .privacy-line {
  margin-top: 18px;
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.6;
}
.analyzer-embed .privacy-line a { color: var(--teal); text-decoration: none; }
.analyzer-embed .privacy-line a:hover { color: var(--white); }

.analyzer-embed .sample-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.analyzer-embed .sample-label {
  font-size: 11px;
  letter-spacing: 1.0px;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
  margin-right: 6px;
}
.analyzer-embed .sample-pill {
  padding: 7px 13px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: 'Nunito Sans';
  transition: all 0.2s;
}
.analyzer-embed .sample-pill:hover {
  border-color: rgba(62,201,193,0.4);
  color: var(--white);
}

/* ═══ ERROR BANNER ═══ */
.analyzer-embed .error-banner {
  padding: 14px 18px;
  background: rgba(255,95,109,0.08);
  border: 1px solid rgba(255,95,109,0.3);
  border-radius: 10px;
  color: #ff8a93;
  font-size: 13.5px;
  margin-bottom: 18px;
}

/* ═══ CONFIDENCE WARNING BANNER ═══ */
.analyzer-embed .confidence-warning {
  padding: 14px 18px;
  background: rgba(232,168,76,0.08);
  border: 1px solid rgba(232,168,76,0.35);
  border-radius: 10px;
  color: #e8a84c;
  font-size: 13.5px;
  margin-bottom: 18px;
}

/* ═══ COST APPROXIMATE TOOLTIP ═══ */
.analyzer-embed .cost-approx-flag {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  color: var(--gold);
  border-bottom: 1px dashed var(--gold);
  cursor: help;
  white-space: nowrap;
}

/* ═══ RESULTS ═══ */
.analyzer-embed .results-panel {}

/* Token table */
.analyzer-embed .table-wrap { overflow-x: auto; }
.analyzer-embed .token-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.analyzer-embed .token-table th {
  text-align: left;
  padding: 12px 14px;
  font-size: 11px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.analyzer-embed .token-table td {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.analyzer-embed .token-table tbody tr:last-child td { border-bottom: none; }
.analyzer-embed .token-table .col-tokens,
.analyzer-embed .token-table .col-cost,
.analyzer-embed .token-table .col-million {
  font-family: 'JetBrains Mono', monospace;
  color: var(--white);
}
.analyzer-embed .token-table .col-model { font-weight: 600; color: var(--white); }
.analyzer-embed .token-table .col-tokenizer { color: var(--text-dim); font-size: 12px; }
.analyzer-embed .token-table .approx-flag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 10px;
  background: rgba(232,168,76,0.15);
  color: var(--gold);
  border-radius: 4px;
  letter-spacing: 0.3px;
}
.analyzer-embed .token-table .err-row td { color: var(--error); }

/* Composition */
.analyzer-embed .composition-bar { width: 100%; margin-bottom: 14px; }
.analyzer-embed .composition-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: rgba(0,0,0,0.7);
  font-family: 'JetBrains Mono', monospace;
  min-width: 0;
  transition: filter 0.2s;
}
.analyzer-embed .composition-segment:hover { filter: brightness(1.15); }
.analyzer-embed .seg-system    { background: var(--c-system); }
.analyzer-embed .seg-few_shot  { background: var(--c-fewshot); }
.analyzer-embed .seg-rag       { background: var(--c-rag); }
.analyzer-embed .seg-tools     { background: var(--c-tools); }
.analyzer-embed .seg-user      { background: var(--c-user); }
.analyzer-embed .seg-assistant { background: var(--c-assistant); }

.analyzer-embed .composition-legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 14px 20px;
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--text);
}
.analyzer-embed .composition-legend li { display: flex; align-items: center; gap: 8px; }
.analyzer-embed .legend-dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* Bottlenecks */
.analyzer-embed .bottleneck-list { list-style: none; }
.analyzer-embed .bottleneck-list li {
  padding: 14px 0 14px 28px;
  border-bottom: 1px solid var(--border);
  position: relative;
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
}
.analyzer-embed .bottleneck-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  top: 14px;
  color: var(--teal);
  font-weight: 700;
}
.analyzer-embed .bottleneck-list li:last-child { border-bottom: none; }

/* Savings */
.analyzer-embed .savings-card {}
.analyzer-embed .cohort-label { font-size: 13.5px; color: var(--text); margin-bottom: 16px; }
.analyzer-embed .cohort-label strong { color: var(--white); font-weight: 600; }
.analyzer-embed .cohort-meta { color: var(--text-dim); font-size: 12px; margin-left: 8px; }

.analyzer-embed .savings-grid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.analyzer-embed .savings-cell {
  padding: 20px 18px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-align: center;
}
.analyzer-embed .savings-cell-primary {
  background: rgba(62,201,193,0.06);
  border-color: rgba(62,201,193,0.3);
}
.analyzer-embed .savings-cell-label {
  font-size: 10.5px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 8px;
}
.analyzer-embed .savings-cell-value {
  font-family: 'Questrial', sans-serif;
  font-size: 26px;
  color: var(--white);
  line-height: 1.1;
}
.analyzer-embed .savings-cell-value .pct { color: var(--teal); font-weight: 400; }
.analyzer-embed .savings-cell-value .tokens {
  font-size: 13px;
  color: var(--text-dim);
  display: block;
  margin-top: 4px;
  font-family: 'Nunito Sans';
}

.analyzer-embed .quality-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
}
.analyzer-embed .quality-pill {
  padding: 6px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 11.5px;
  color: var(--text);
  display: flex;
  gap: 8px;
  align-items: center;
}
.analyzer-embed .quality-pill .qval {
  color: var(--white);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
}
.analyzer-embed .quality-pill.q-high .qval { color: var(--teal); }
.analyzer-embed .quality-pill.q-mid  .qval { color: var(--gold); }
.analyzer-embed .quality-pill.q-low  .qval { color: var(--warm); }

.analyzer-embed .caveats { margin-top: 14px; }
.analyzer-embed .caveats > div {
  padding: 12px 14px;
  background: rgba(232,168,76,0.05);
  border-left: 2px solid rgba(232,168,76,0.4);
  border-radius: 0 6px 6px 0;
  margin-bottom: 8px;
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.6;
}

.analyzer-embed .footnote {
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.6;
}
.analyzer-embed .footnote a {
  color: var(--teal);
  text-decoration: none;
  border-bottom: 1px dashed rgba(62,201,193,0.3);
}
.analyzer-embed .footnote a:hover { color: var(--white); }

/* Actions */
.analyzer-embed .actions-card {
  display: flex;
  gap: 10px;
  justify-content: center;
  background: transparent;
  border: none;
  padding: 8px;
}

/* ═══ PER-MODEL COMPOSITION ═══ */
.analyzer-embed .comp-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--text);
}
.analyzer-embed .comp-approx-tag {
  display: inline-block;
  padding: 1px 7px;
  font-size: 11px;
  background: rgba(232,168,76,0.12);
  color: var(--gold);
  border-radius: 4px;
  border: 1px solid rgba(232,168,76,0.3);
  letter-spacing: 0.2px;
  cursor: help;
  white-space: nowrap;
}
.analyzer-embed .comp-showing { font-size: 12px; color: var(--text-dim); margin-left: auto; }
.analyzer-embed .comp-switch-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  color: var(--teal);
  cursor: pointer;
  font-family: 'Nunito Sans';
  transition: all 0.2s;
}
.analyzer-embed .comp-switch-btn:hover {
  border-color: rgba(62,201,193,0.4);
  background: rgba(62,201,193,0.06);
}
.analyzer-embed .comp-placeholder {
  padding: 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  border: 1px dashed var(--border);
  border-radius: 8px;
}
.analyzer-embed .composition-bar-inner {
  display: flex;
  width: 100%;
  height: 36px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 14px;
}

/* ═══ MOBILE ═══ */
@media (max-width: 768px) {
  .analyzer-embed {
    padding: 0 16px;
  }
  .analyzer-embed .card {
    padding: 22px;
    margin-bottom: 14px;
  }
  .analyzer-embed .input-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .analyzer-embed .savings-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .analyzer-embed .composition-bar { height: 44px; }
  .analyzer-embed .composition-segment { font-size: 10px; }
  .analyzer-embed .token-table { font-size: 12px; }
  .analyzer-embed .token-table th,
  .analyzer-embed .token-table td { padding: 10px 8px; }
  .analyzer-embed .actions-card { flex-direction: column; }
  .analyzer-embed .btn-secondary { margin-right: 0; width: 100%; }
}
