/* ═══════════════════════════════════════════════════════════════
   chat-widget.css — Opti360
   Chatbot conversacional para realtors.html, contractors.html,
   cruceros.html. Todos los selectores bajo .cw-* para no
   interferir con el resto del sitio.
   Palette: usa las variables CSS del dark-tech theme del sitio.
   ═══════════════════════════════════════════════════════════════ */

/* ── Shell (reemplaza .form-section internamente) ──────────────  */
.cw-shell {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface, #081626);
  border-radius: 20px;
  overflow: hidden;
  min-height: 520px;
  max-height: 600px;
  border: 1px solid var(--border, rgba(36,112,169,.25));
  box-shadow:
    0 0 0 1px rgba(41,168,224,.08),
    0 8px 32px rgba(0,0,0,.45),
    0 2px 8px rgba(0,0,0,.3);
  /* Levita suavemente */
  animation: cwFloat 7s ease-in-out infinite;
}

@keyframes cwFloat {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-5px); }
}

/* ── Header ────────────────────────────────────────────────────  */
.cw-header {
  background: var(--grad-brand, linear-gradient(135deg,#1A3A5C 0%,#29A8E0 100%));
  padding: 0.9rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.cw-header__avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.cw-header__info { flex: 1; }

.cw-header__name {
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
  letter-spacing: 0.01em;
}

.cw-header__status {
  font-size: 0.7rem;
  color: rgba(255,255,255,.75);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 1px;
}

.cw-header__status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6EE7B7;
  display: inline-block;
  animation: cwPulse 2s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(110,231,183,.5);
}

@keyframes cwPulse {
  0%   { box-shadow: 0 0 0 0 rgba(110,231,183,.5); }
  70%  { box-shadow: 0 0 0 6px rgba(110,231,183,.0); }
  100% { box-shadow: 0 0 0 0 rgba(110,231,183,.0); }
}

/* ── Message feed ──────────────────────────────────────────────  */
.cw-feed {
  flex: 1;
  overflow-y: auto;
  padding: 1.1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  background: var(--bg-base, #040d1e);
  scroll-behavior: smooth;
}

.cw-feed::-webkit-scrollbar { width: 4px; }
.cw-feed::-webkit-scrollbar-track { background: transparent; }
.cw-feed::-webkit-scrollbar-thumb {
  background: rgba(41,168,224,.25);
  border-radius: 2px;
}

/* ── Bubbles ───────────────────────────────────────────────────  */
.cw-msg {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  max-width: 88%;
  opacity: 0;
  transform: translateY(8px);
  animation: cwMsgIn 0.26s ease forwards;
}

@keyframes cwMsgIn {
  to { opacity: 1; transform: translateY(0); }
}

.cw-msg--bot  { align-self: flex-start; }
.cw-msg--user { align-self: flex-end; flex-direction: row-reverse; }

.cw-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--grad-brand2, linear-gradient(135deg,#2470A9,#29A8E0));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
  margin-bottom: 2px;
}

.cw-bubble {
  padding: 0.6rem 0.85rem;
  border-radius: 16px;
  font-size: 0.875rem;
  line-height: 1.55;
}

.cw-msg--bot .cw-bubble {
  background: var(--bg-elevated, #0d1f38);
  color: var(--text-1, #eef4ff);
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(41,168,224,.12);
}

.cw-msg--user .cw-bubble {
  background: linear-gradient(135deg, #2470A9 0%, #29A8E0 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(41,168,224,.3);
}

/* ── Typing indicator ──────────────────────────────────────────  */
.cw-typing {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  align-self: flex-start;
  opacity: 0;
  transform: translateY(8px);
  animation: cwMsgIn 0.22s ease forwards;
}

.cw-typing .cw-bubble {
  background: var(--bg-elevated, #0d1f38);
  border: 1px solid rgba(41,168,224,.12);
  border-bottom-left-radius: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.65rem 0.85rem;
}

.cw-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan-400, #4DC8F0);
  animation: cwDot 1.1s ease-in-out infinite;
}
.cw-dot:nth-child(2) { animation-delay: 0.18s; }
.cw-dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes cwDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-5px); opacity: 1; }
}

/* ── Input area ────────────────────────────────────────────────  */
.cw-input-area {
  padding: 0.7rem 0.9rem;
  background: var(--bg-surface, #081626);
  border-top: 1px solid rgba(41,168,224,.12);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex-shrink: 0;
}

/* Option buttons */
.cw-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.cw-opt-btn {
  padding: 0.45rem 0.8rem;
  border-radius: 18px;
  border: 1.5px solid var(--cyan-500, #29A8E0);
  background: transparent;
  color: var(--cyan-300, #85DAFA);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.17s, color 0.17s, transform 0.1s;
}

.cw-opt-btn:hover,
.cw-opt-btn:focus {
  background: var(--cyan-500, #29A8E0);
  color: #fff;
  outline: none;
}

.cw-opt-btn:active { transform: scale(0.95); }

/* Text input row */
.cw-text-row {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.cw-text-input {
  flex: 1;
  border: 1.5px solid rgba(41,168,224,.25);
  border-radius: 20px;
  padding: 0.5rem 0.9rem;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text-1, #eef4ff);
  background: var(--bg-elevated, #0d1f38);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.cw-text-input::placeholder { color: var(--text-3, #5a7090); }

.cw-text-input:focus {
  border-color: var(--cyan-500, #29A8E0);
  box-shadow: 0 0 0 3px rgba(41,168,224,.12);
}

.cw-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #2470A9 0%, #29A8E0 100%);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.9rem;
  transition: opacity 0.17s, transform 0.1s;
}

.cw-send-btn:hover  { opacity: 0.85; }
.cw-send-btn:active { transform: scale(0.9); }
.cw-send-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* Confirm / restart */
.cw-confirm-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 1.2rem;
  border-radius: 20px;
  border: none;
  background: linear-gradient(135deg, #2470A9 0%, #29A8E0 100%);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.17s;
  box-shadow: 0 3px 12px rgba(41,168,224,.35);
}

.cw-confirm-btn:hover { opacity: 0.88; }

.cw-restart-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 1rem;
  border-radius: 18px;
  border: 1.5px solid rgba(41,168,224,.35);
  background: transparent;
  color: var(--cyan-400, #4DC8F0);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.17s, color 0.17s;
}

.cw-restart-btn:hover { background: rgba(41,168,224,.1); }

/* ── Summary card (bot bubble variant) ────────────────────────  */
.cw-summary-card {
  background: rgba(13,31,56,.8);
  border: 1px solid rgba(41,168,224,.22);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  font-size: 0.8rem;
  line-height: 1.65;
  color: var(--text-1, #eef4ff);
  width: 100%;
}

.cw-summary-card__title {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--cyan-300, #85DAFA);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.cw-summary-card__row {
  display: flex;
  gap: 0.4rem;
  margin-top: 2px;
}

.cw-summary-card__lbl {
  color: var(--text-3, #5a7090);
  min-width: 80px;
  flex-shrink: 0;
}

.cw-summary-card__val {
  font-weight: 600;
  color: var(--text-1, #eef4ff);
}

/* Demo mode hint bubble */
.cw-demo-hint {
  font-size: 0.72rem;
  color: var(--text-2, #8aa4c0);
  text-align: center;
  padding: 0.2rem 0;
  line-height: 1.4;
}

/* ── Trust bar ─────────────────────────────────────────────────  */
.cw-trust {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  padding: 0.85rem 0.5rem 0;
}

.cw-trust-item {
  font-size: 0.72rem;
  color: var(--text-3, #5a7090);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* ── Responsive ────────────────────────────────────────────────  */
@media (max-width: 520px) {
  .cw-shell { min-height: 460px; max-height: 540px; border-radius: 14px; }
  .cw-bubble { font-size: 0.82rem; }
  .cw-opt-btn { font-size: 0.74rem; padding: 0.4rem 0.65rem; }
}
