/* ============================================================
   JN ∴ — Widget de chat IA para demos por sector
   Simula la experiencia real del cotizador: lenguaje natural
   → IA procesa → cotización estructurada
   ============================================================ */

/* Chat container */
.ia-chat {
  background: rgba(21, 21, 28, .94);
  backdrop-filter: blur(18px);
  border: 1px solid var(--hair);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 460px;
  max-height: 540px;
  box-shadow: var(--shadow-2);
  position: relative;
}

/* Header */
.ia-chat__hd {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--hair);
  background: rgba(14, 14, 18, .6);
  flex-shrink: 0;
}

.ia-chat__av {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #000;
}

.ia-chat__av svg {
  width: 16px;
  height: 16px;
}

.ia-chat__name {
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.2;
}

.ia-chat__status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.ia-chat__dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
}

/* Messages area */
.ia-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--hair) transparent;
}

/* Message rows */
.ia-msg {
  display: flex;
  flex-direction: column;
  max-width: 90%;
}

.ia-msg--user { align-self: flex-end; }
.ia-msg--bot  { align-self: flex-start; }

.ia-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.55;
  font-family: var(--sans);
}

.ia-msg--user .ia-bubble {
  background: var(--gold);
  color: #000;
  border-bottom-right-radius: 5px;
  font-weight: 500;
}

.ia-msg--bot .ia-bubble {
  background: rgba(32, 32, 42, .95);
  border: 1px solid var(--hair);
  color: var(--fg);
  border-bottom-left-radius: 5px;
}

/* Typing indicator */
.ia-typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 10px 14px;
}

.ia-typing__d {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: ia-bounce 1.1s infinite ease-in-out;
}

.ia-typing__d:nth-child(2) { animation-delay: .18s; }
.ia-typing__d:nth-child(3) { animation-delay: .36s; }

@keyframes ia-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .6; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Detected items inside a bot bubble */
.ia-quote {
  margin-top: 10px;
  border-top: 1px solid rgba(244, 240, 232, .1);
  padding-top: 10px;
}

.ia-quote__line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(244, 240, 232, .07);
  font-size: 12px;
  font-family: var(--mono);
}

.ia-quote__line:last-child { border-bottom: 0; }

.ia-quote__desc { color: var(--lead); flex: 1; min-width: 0; }
.ia-quote__qty  { color: var(--muted); white-space: nowrap; }
.ia-quote__amt  { color: var(--fg); font-weight: 600; white-space: nowrap; }

.ia-quote__total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(227, 165, 62, .3);
}

.ia-quote__total-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.ia-quote__total-amt {
  font-family: var(--display);
  font-size: 28px;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

/* Post-quote CTA inside chat */
.ia-quote__cta {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ia-quote__cta .btn {
  font-size: 12px;
  padding: 8px 14px;
}

/* Chips row */
.ia-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  overflow-x: auto;
  border-top: 1px solid var(--hair);
  background: rgba(14, 14, 18, .4);
  flex-shrink: 0;
  scrollbar-width: none;
}

.ia-chips::-webkit-scrollbar { display: none; }

.ia-chip {
  flex-shrink: 0;
  padding: 5px 11px;
  border-radius: var(--r-pill);
  border: 1px solid rgba(244, 240, 232, .18);
  background: rgba(244, 240, 232, .05);
  color: var(--lead);
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, color .15s, background .15s;
  line-height: 1.3;
}

.ia-chip:hover,
.ia-chip:focus-visible {
  border-color: rgba(227, 165, 62, .55);
  color: var(--gold);
  background: var(--gold-soft);
  outline: none;
}

.ia-chip:disabled { opacity: .4; cursor: default; }

/* Input row */
.ia-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--hair);
  background: rgba(14, 14, 18, .5);
  flex-shrink: 0;
}

.ia-input {
  flex: 1;
  min-width: 0;
  background: rgba(32, 32, 42, .9);
  border: 1px solid var(--hair);
  border-radius: 22px;
  padding: 9px 16px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--fg);
  outline: none;
  transition: border-color .15s;
}

.ia-input:focus { border-color: rgba(227, 165, 62, .5); }
.ia-input::placeholder { color: var(--muted); }
.ia-input:disabled { opacity: .5; }

.ia-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--gold);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity .15s, transform .15s;
  color: #000;
}

.ia-send:hover { opacity: .85; }
.ia-send:active { transform: scale(.93); }
.ia-send:disabled { opacity: .35; cursor: default; transform: none; }

.ia-send svg { width: 15px; height: 15px; fill: currentColor; }

/* Disclaimer note at bottom of chat */
.ia-note {
  padding: 6px 14px 10px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid rgba(244, 240, 232, .06);
  flex-shrink: 0;
}

/* IA badge on header card (replaces old demo-shop) */
.ia-label-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: var(--r-pill);
  background: rgba(227, 165, 62, .15);
  border: 1px solid rgba(227, 165, 62, .3);
  color: var(--gold);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-left: auto;
}

/* Responsive */
@media (max-width: 1040px) {
  .ia-chat { min-height: 420px; max-height: none; }
}

@media (max-width: 760px) {
  .ia-chat { min-height: 380px; }
  .ia-quote__total-amt { font-size: 22px; }
}
