/* Decodificador RDS-PP Itaipu — estilos */

.msg { display: flex; }
.msg-user { justify-content: flex-end; }
.msg-bot { justify-content: flex-start; }

.msg-bubble {
  max-width: 85%;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.9rem;
  line-height: 1.5;
  word-wrap: break-word;
}
.msg-user .msg-bubble {
  background: #1d4ed8;
  color: white;
  border-bottom-right-radius: 0.25rem;
}
.msg-bot .msg-bubble {
  background: white;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 0.25rem;
}

.msg-bubble p { margin-bottom: 0.5rem; }
.msg-bubble p:last-child { margin-bottom: 0; }
.msg-bubble code {
  background: rgba(15,23,42,0.08);
  padding: 0 0.25rem;
  border-radius: 0.25rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
}
.msg-user .msg-bubble code { background: rgba(255,255,255,0.2); }
.msg-bubble pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 0.75rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  font-size: 0.85em;
}
.msg-bubble ul, .msg-bubble ol { margin-left: 1.25rem; margin-bottom: 0.5rem; }
.msg-bubble li { margin-bottom: 0.15rem; }
.msg-bubble strong { font-weight: 600; }

.chip {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  border: 1px solid currentColor;
  cursor: pointer;
  margin: 0.15rem 0.15rem 0.15rem 0;
  transition: all 0.15s;
  color: #475569;
}
.chip:hover { transform: translateY(-1px); background: #f1f5f9; }

.fuentes {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed #cbd5e1;
  font-size: 0.75rem;
  color: #64748b;
}

.sugerencias {
  margin-top: 0.75rem;
  padding-top: 0.6rem;
  border-top: 1px dashed #cbd5e1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.sugg-chip {
  background: #eff6ff;
  border: 1px solid #93c5fd;
  color: #1e3a8a;
  font-size: 0.75rem;
  padding: 0.3rem 0.65rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}
.sugg-chip:hover {
  background: #dbeafe;
  border-color: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.sugg-chip:active { transform: translateY(0); }

/* Chips compactos de ejemplo (estilo Anthropic) */
.prompt-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.12s;
  cursor: pointer;
  white-space: nowrap;
  background: white;
  border: 1px solid #e2e8f0;
  color: #334155;
}
.prompt-chip:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1e3a8a;
  transform: translateY(-1px);
}
.prompt-chip:active { transform: translateY(0); }
.prompt-chip .ico { font-size: 0.95rem; }

.disc-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.55rem;
  border-radius: 0.3rem;
  text-transform: uppercase;
}
.disc-electrico   { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.disc-mecanico    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.disc-automacao   { background: #ede9fe; color: #6b21a8; border: 1px solid #c4b5fd; }
.disc-civil       { background: #e7e5e4; color: #44403c; border: 1px solid #a8a29e; }
.disc-instrumentacao { background: #fce7f3; color: #9d174d; border: 1px solid #f9a8d4; }
.disc-arquitectura { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.disc-mixto       { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.disc-otros       { background: #e2e8f0; color: #475569; border: 1px solid #cbd5e1; }

#context-bar .font-mono { color: #0369a1; }

/* Resizer entre columnas (drag para redimensionar) */
.resizer {
  width: 6px;
  cursor: col-resize;
  background: transparent;
  flex-shrink: 0;
  position: relative;
  transition: background 0.15s;
}
.resizer:hover, .resizer:active { background: #93c5fd; }
.resizer::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 32px;
  background: #cbd5e1;
  border-radius: 2px;
  opacity: 0.6;
  pointer-events: none;
  transition: background 0.15s, opacity 0.15s;
}
.resizer:hover::after { background: #1e3a8a; opacity: 1; }

.seg-row {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid #f1f5f9;
}
.seg-row:last-child { border-bottom: none; }
.seg-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.1rem 0.5rem;
  border-radius: 0.25rem;
}
.seg-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  font-weight: 600;
  color: #0f172a;
}
.seg-desc { font-size: 0.8rem; color: #475569; }

.badge-bl0 { background: #dbeafe; color: #1e40af; }
.badge-bl1 { background: #dcfce7; color: #166534; }
.badge-bl2 { background: #fef3c7; color: #92400e; }
.badge-bl3 { background: #ede9fe; color: #6b21a8; }
.badge-produto { background: #fce7f3; color: #9d174d; }
.badge-dcc { background: #e2e8f0; color: #475569; }
.badge-designacao { background: #fee2e2; color: #991b1b; }

.spinner {
  width: 1rem; height: 1rem;
  border: 2px solid #e2e8f0;
  border-top-color: #1d4ed8;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  vertical-align: -2px;
  margin-right: 0.4rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

#status.ok { background: rgba(34,197,94,0.25); }
#status.err { background: rgba(239,68,68,0.3); }
#status.warn { background: rgba(250,204,21,0.35); }

/* Toast de notificaciones discretas */
.rdspp-toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: #065f46;
  color: white;
  padding: 0.6rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  z-index: 999;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.25s, transform 0.25s;
  max-width: 360px;
}
.rdspp-toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Sidebar de historial */
.chat-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.12s;
  position: relative;
}
.chat-item:hover { background: #f1f5f9; }
.chat-item.active {
  background: #eff6ff;
  border-left-color: #1d4ed8;
}
.chat-item-body {
  flex: 1;
  min-width: 0;
}
.chat-item-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-item-meta {
  font-size: 0.7rem;
  color: #94a3b8;
  margin-top: 0.15rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.chat-item-disc {
  display: inline-block;
  padding: 0.05rem 0.4rem;
  font-size: 0.6rem;
  border-radius: 0.2rem;
  font-weight: 600;
}
.chat-item-actions {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  opacity: 0;
  transition: opacity 0.12s;
}
.chat-item:hover .chat-item-actions { opacity: 1; }
.chat-item-action {
  font-size: 0.85rem;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  padding: 0.15rem 0.3rem;
  border-radius: 0.25rem;
  transition: background 0.12s, color 0.12s;
  line-height: 1;
}
.chat-item-clear:hover { background: #fef3c7; color: #b45309; }
.chat-item-delete:hover { background: #fee2e2; color: #dc2626; }

.chat-list-empty {
  padding: 1rem;
  font-size: 0.8rem;
  color: #94a3b8;
  text-align: center;
  font-style: italic;
}

.tool-calls {
  margin-top: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px dashed #cbd5e1;
  font-size: 0.72rem;
}
.tool-calls summary {
  cursor: pointer;
  color: #475569;
  font-weight: 500;
  user-select: none;
}
.tool-calls summary:hover { color: #059669; }
.tool-call {
  margin-top: 0.3rem;
  padding: 0.25rem 0.4rem;
  background: #f8fafc;
  border-left: 2px solid #94a3b8;
  border-radius: 0.15rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
}
.tool-call code {
  font-family: ui-monospace, monospace;
  font-size: 0.7rem;
  color: #1e293b;
  background: transparent;
  padding: 0;
}
.tool-result {
  color: #059669;
  font-size: 0.7rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50%;
}
