/* ============================================================
   Agentes de IA — seccion #agentes de la landing de SIR
   Usa los tokens de style.css (--primary, --surface, --ink...).
   Las clases van con prefijo ag-/cw- para no chocar con nada.
   ============================================================ */

.agentes {
  padding: 100px 0;
  border-top: 1px solid var(--border);
  position: relative;
}

.agentes-grid {
  display: grid;
  grid-template-columns: 1fr 1.05fr;
  gap: 48px;
  align-items: start;
}

/* ---------- Columna de texto ---------- */

.ag-list { list-style: none; display: grid; gap: 22px; }
.ag-list li {
  position: relative;
  padding-left: 34px;
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.65;
}
.ag-list li strong { color: var(--ink); font-weight: 600; }
.ag-list li::before {
  content: '';
  position: absolute;
  left: 0; top: 8px;
  width: 18px; height: 18px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--primary), var(--pink));
  opacity: .9;
}
.ag-list li::after {
  content: '';
  position: absolute;
  left: 6px; top: 12px;
  width: 5px; height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(42deg);
}

.ag-casos {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: 34px;
  padding-top: 30px;
  border-top: 1px solid var(--border);
}
.ag-caso {
  font-size: 12px;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 8px 15px;
  transition: border-color .2s;
}
.ag-caso b { color: var(--ink); font-weight: 600; }
.ag-caso:hover { border-color: var(--border-hover); }

/* ---------- Chat ---------- */

.cw {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
  position: relative;
}
html.theme-light .cw { box-shadow: 0 20px 50px rgba(20, 10, 60, .12); }

/* Un hilo de color arriba, para que se lea como producto y no como formulario */
.cw::before {
  content: '';
  position: absolute; inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--pink), var(--accent));
}

.cw-top {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}
.cw-av {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--pink));
  color: #fff;
  font-family: 'Instrument Serif', serif;
  font-size: 19px;
  flex-shrink: 0;
}
.cw-id { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.cw-id strong { font-size: 15px; font-weight: 700; letter-spacing: -.2px; }
.cw-state {
  font-size: 11px;
  color: var(--ink-soft);
  display: flex; align-items: center; gap: 6px;
}
.cw-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(0, 212, 170, .5);
  animation: cwPulse 2.4s ease-out infinite;
}
@keyframes cwPulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 212, 170, .5); }
  70%, 100% { box-shadow: 0 0 0 7px rgba(0, 212, 170, 0); }
}
.cw-badge {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--primary-soft);
  background: rgba(124, 92, 255, .12);
  border-radius: 100px;
  padding: 5px 11px;
  white-space: nowrap;
}

.cw-log {
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* Crece con la charla en vez de arrancar con un hueco vacio, pero con tope:
     asi el salto de altura es chico y la seccion no se desarma al escribir. */
  min-height: 220px;
  max-height: 360px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-hover) transparent;
  overscroll-behavior: contain;
}
.cw-log::-webkit-scrollbar { width: 6px; }
.cw-log::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 3px; }

.cw-msg {
  max-width: 86%;
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  animation: cwIn .28s cubic-bezier(.2, .7, .3, 1);
}
@keyframes cwIn { from { opacity: 0; transform: translateY(6px); } }
.cw-msg.bot {
  align-self: flex-start;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-bottom-left-radius: 5px;
  color: var(--ink);
}
.cw-msg.yo {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--primary), #6d4ef0);
  border-bottom-right-radius: 5px;
  color: #fff;
}
.cw-msg.error {
  align-self: flex-start;
  background: rgba(255, 92, 124, .1);
  border: 1px solid var(--danger);
  color: var(--danger);
  border-bottom-left-radius: 5px;
}
.cw-msg strong { font-weight: 700; }

/* Los tres puntitos mientras piensa */
.cw-typing {
  align-self: flex-start;
  display: flex; gap: 4px;
  padding: 15px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 16px;
  border-bottom-left-radius: 5px;
}
.cw-typing i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ink-faint);
  animation: cwBlink 1.3s ease-in-out infinite;
}
.cw-typing i:nth-child(2) { animation-delay: .18s; }
.cw-typing i:nth-child(3) { animation-delay: .36s; }
@keyframes cwBlink {
  0%, 60%, 100% { opacity: .3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

.cw-chips {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 0 18px 14px;
}
.cw-chips:empty { display: none; }
.cw-chip {
  font-family: inherit;
  font-size: 12.5px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--border-hover);
  border-radius: 100px;
  padding: 7px 14px;
  transition: all .2s;
}
.cw-chip:hover {
  color: var(--ink);
  border-color: var(--primary);
  background: rgba(124, 92, 255, .08);
}

.cw-form {
  display: flex; gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
}
.cw-input {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-size: 14.5px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 12px 18px;
  outline: none;
  transition: border-color .2s;
}
.cw-input::placeholder { color: var(--ink-faint); }
.cw-input:focus { border-color: var(--primary); }
.cw-send {
  width: 44px; height: 44px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--pink));
  color: #fff;
  font-size: 17px;
  display: grid; place-items: center;
  transition: transform .2s, opacity .2s;
}
.cw-send:hover:not(:disabled) { transform: scale(1.06); }
.cw-send:disabled { opacity: .45; cursor: not-allowed; }

.cw-foot {
  font-size: 11.5px;
  color: var(--ink-faint);
  text-align: center;
  padding: 0 18px 16px;
  line-height: 1.5;
}

/* ---------- Mobile ---------- */

@media (max-width: 900px) {
  .agentes { padding: 72px 0; }
  .agentes-grid { grid-template-columns: 1fr; gap: 36px; }
  .cw-log { min-height: 180px; max-height: 320px; }
}
@media (max-width: 560px) {
  .cw-msg { max-width: 92%; }
  .cw-badge { display: none; }
  .ag-casos { gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .cw-msg, .cw-dot, .cw-typing i { animation: none !important; }
}
