/* Chain-of-Thought widget (prompt-kit style) */

.cot-container {
  margin: 0.5rem 0;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  overflow: hidden;
  font-size: 0.85rem;
  width: 100%;
  min-width: 280px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
}

.cot-finalized {
  border-color: #d1d5db;
}

/* header */
.cot-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  font-weight: 500;
  color: #111827;
  border-bottom: 1px solid #f3f4f6;
  min-height: 2rem;
}

.cot-finalized .cot-header {
  color: #6b7280;
}

.cot-header-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* steps list */
.cot-steps {
  padding: 0.5rem 0.85rem 0.65rem;
}

/* individual step */
.cot-step-wrap {
  position: relative;
}

.cot-step-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.3rem 0;
  background: none;
  border: none;
  font: inherit;
  font-size: 0.825rem;
  color: #374151;
  text-align: left;
  transition: color 0.15s;
}

.cot-clickable {
  cursor: pointer;
}

.cot-clickable:hover {
  color: #111827;
}

.cot-step-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
}

.cot-step-title {
  flex: 1;
  min-width: 0;
}

.cot-muted {
  color: #9ca3af;
}

/* chevron */
.cot-chevron {
  flex-shrink: 0;
  color: #9ca3af;
  transition: transform 0.2s ease;
}

.cot-chevron-open {
  transform: rotate(180deg);
}

/* connector line between steps */
.cot-connector {
  width: 1.5px;
  height: 0.5rem;
  margin-left: 0.47rem; /* center under icon */
  background: #e5e7eb;
}

.cot-finalized .cot-connector {
  background: #d1d5db;
}

/* step content (collapsible) */
.cot-step-content {
  overflow: hidden;
}

.cot-step-content[data-state="open"] {
  animation: cotSlideDown 0.2s ease-out;
}

.cot-step-content[data-state="closed"] {
  animation: cotSlideUp 0.15s ease-out;
}

.cot-step-content-inner {
  margin-left: 1.5rem;
  padding: 0.25rem 0 0.35rem;
  border-left: 2px solid #e5e7eb;
  padding-left: 0.75rem;
  font-size: 0.8rem;
  color: #6b7280;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* LLM reasoning section */
.cot-llm-section {
  border-top: 1px solid #f3f4f6;
  padding: 0.5rem 0.85rem;
}

.cot-llm-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.2rem 0;
  background: none;
  border: none;
  font: inherit;
  font-size: 0.8rem;
  color: #6b7280;
  text-align: left;
}

.cot-llm-label {
  flex: 1;
  font-weight: 500;
}

.cot-llm-content {
  overflow: hidden;
}

.cot-llm-content[data-state="open"] {
  animation: cotSlideDown 0.2s ease-out;
}

.cot-llm-content[data-state="closed"] {
  animation: cotSlideUp 0.15s ease-out;
}

.cot-llm-text {
  margin: 0.35rem 0 0 1.5rem;
  padding: 0.5rem 0.75rem;
  border-left: 2px solid #e5e7eb;
  font-family: 'Consolas', 'Monaco', 'SF Mono', monospace;
  font-size: 0.75rem;
  color: #6b7280;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 14rem;
  overflow-y: auto;
  background: #f8fafc;
  border-radius: 0 6px 6px 0;
}

/* spinner animation */
.cot-spinner {
  animation: cotSpin 0.8s linear infinite;
  color: #6b7280;
}

@keyframes cotSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes cotSlideDown {
  from { height: 0; opacity: 0; }
  to { height: var(--radix-collapsible-content-height); opacity: 1; }
}

@keyframes cotSlideUp {
  from { height: var(--radix-collapsible-content-height); opacity: 1; }
  to { height: 0; opacity: 0; }
}
