
.chat-app {
  max-width: 420px;
  height: 90vh;
  margin: auto;
  background: #f9fafb;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: system-ui, sans-serif;
}

/* HEADER */
.chat-header {
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
}

.chat-header h2 {
  margin: 0;
  font-size: 20px;
}

.chat-new {
  border: none;
  background: none;
  font-size: 22px;
  cursor: pointer;
}

/* TABS */
.chat-tabs {
  display: flex;
  background: #ffffff;
  padding: 6px;
  gap: 6px;
}

.chat-tabs button {
  flex: 1;
  border: none;
  padding: 8px;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  font-weight: 600;
  transition: all .25s ease;
}

.chat-tabs button.active {
  background: #fee2e2;
  color: #dc2626;
}

/* LISTA */
.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  padding: 10px;
  border-radius: 14px;
  margin-bottom: 8px;
  transition: transform .2s ease, opacity .2s ease;
}

.chat-item img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.chat-info h4 {
  margin: 0;
  font-size: 14px;
}

.chat-info p {
  margin: 0;
  font-size: 13px;
  color: #6b7280;
}

.chat-time {
  margin-left: auto;
  font-size: 12px;
  color: #9ca3af;
}

.chat-item.unread {
  border-left: 4px solid #dc2626;
}

.chat-item.archived {
  opacity: .4;
}

/* INPUT */
.chat-input {
  display: flex;
  padding: 10px;
  background: #ffffff;
  border-top: 1px solid #e5e7eb;
}

.chat-input input {
  flex: 1;
  box-sizing: border-box; /* 🔥 CLAVE */
  border: none;
  outline: none;

  padding-left: 22px;     /* 🔥 separa texto del borde */
  padding-right: 18px;
  padding-top: 12px;
  padding-bottom: 12px;

  border-radius: 999px;
  background: #f3f4f6;
  font-size: 14px;
  line-height: 1.2;
}

.chat-input input {
  text-indent: 1.2rem; /* 🔥 micro desplazamiento interno */
}


.chat-input button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: #dc2626;
  color: #ffffff;
  margin-left: 8px;

  display: flex;              
  align-items: center;        
  justify-content: center;    

  cursor: pointer;
  padding: 0;
}

.chat-body {
  flex: 1;
  padding: 20px 16px;
  overflow-y: auto;
  background: #ffffff;
}

/* Bienvenida */
.chat-welcome {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 30px;
}

.assistant-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #ff4d4f;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.assistant-message {
  background: #f4f4f5;
  border-radius: 14px;
  padding: 12px 14px;
  max-width: 80%;
}

.assistant-title {
  font-weight: 700;
  margin-bottom: 4px;
  font-size: 15px;
}

.assistant-text {
  font-size: 14px;
  line-height: 1.4;
  color: #555;
}

.chat-welcome {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 24px;
}

.assistant-message {
  max-width: 85%;
}

/* ===============================
   🎛️ PANEL ASISTENTE – BASE
================================ */

.assistant-panel {
  display: grid;
  grid-template-columns: 260px 1fr 320px;
  height: 100vh;
  background: #f4f6f8;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #111827;
}

/* ===============================
   🧠 COLUMNA NODOS
================================ */

.panel-nodes {
  background: #0f172a;
  color: #e5e7eb;
  display: flex;
  flex-direction: column;
  padding: 14px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.panel-header h3 {
  font-size: 15px;
  font-weight: 700;
}

.btn-create-node {
  background: #22c55e;
  border: none;
  color: #fff;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.node-list {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-y: auto;
}

.node-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px 10px;
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 6px;
  transition: background .15s ease;
}

.node-item:hover {
  background: rgba(255,255,255,0.08);
}

.node-item.active {
  background: rgba(56,189,248,0.25);
}

.node-icon {
  font-size: 16px;
}

.node-name {
  font-size: 14px;
  font-weight: 600;
}

.node-type {
  font-size: 11px;
  opacity: .7;
}

/* ===============================
   ✏️ EDITOR DE NODO
================================ */

.panel-editor {
  background: #ffffff;
  padding: 22px 26px;
  overflow-y: auto;
}

.editor-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 18px;
}

.editor-block {
  margin-bottom: 18px;
}

.editor-block label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #374151;
}

.editor-block input,
.editor-block textarea,
.editor-block select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  font-size: 14px;
  outline: none;
}

.editor-block textarea {
  resize: vertical;
}

.editor-block small {
  font-size: 12px;
  color: #6b7280;
}

.editor-block code {
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 12px;
}

/* ===============================
   🔁 REGLAS DE SALIDA
================================ */

.node-rules {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rule {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.rule span {
  font-size: 13px;
  color: #374151;
}

.rule select {
  flex: 1;
}

/* ===============================
   🎯 ACCIONES
================================ */

.editor-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

.btn-save-node {
  flex: 1;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
}

.btn-delete-node {
  background: #fee2e2;
  color: #991b1b;
  border: none;
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
}

/* ===============================
   👀 PREVIEW CHAT
================================ */

.panel-preview {
  background: #f9fafb;
  padding: 18px;
  border-left: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
}

.panel-preview h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
}

.chat-preview {
  background: #ffffff;
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 10px 25px rgba(0,0,0,.06);
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.chat-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.4;
}

.chat-bubble.assistant {
  background: #e5f3ff;
  align-self: flex-start;
}

.chat-input-preview {
  display: flex;
  gap: 8px;
}

.chat-input-preview input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
}

.chat-input-preview button {
  background: #3b82f6;
  color: #fff;
  border: none;
  padding: 0 14px;
  border-radius: 10px;
  cursor: pointer;
}

/* ===============================
   📱 RESPONSIVE
================================ */

@media (max-width: 1024px) {
  .assistant-panel {
    grid-template-columns: 1fr;
  }

  .panel-nodes {
    display: none;
  }

  .panel-preview {
    display: none;
  }
}

