/* ═══════════════════════════════════════════════
   CHATBOT COR HOMES v3
   ═══════════════════════════════════════════════ */

/* ── Trigger ──────────────────────────────────── */
.cor-chat-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3F5F4A 0%, #2D4A36 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 24px rgba(63,95,74,0.4);
  transition: all 0.3s ease;
  color: #fff;
  animation: corPulse 3s ease-in-out infinite;
}

.cor-chat-trigger::before {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid rgba(63,95,74,0.3);
  animation: corRing 3s ease-in-out infinite;
  z-index: -1;
}

@keyframes corPulse {
  0%, 100% { box-shadow: 0 4px 24px rgba(63,95,74,0.4); transform: scale(1); }
  50% { box-shadow: 0 4px 40px rgba(63,95,74,0.7); transform: scale(1.05); }
}

@keyframes corRing {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.25); opacity: 0; }
}

.cor-chat-trigger:hover {
  transform: scale(1.1) !important;
  box-shadow: 0 6px 36px rgba(63,95,74,0.6) !important;
  animation: none;
}

.cor-chat-trigger:hover::before { display: none; }
.cor-chat-trigger.open { animation: none; transform: scale(1); }
.cor-chat-trigger.open::before { display: none; }
.cor-chat-trigger svg { width: 28px; height: 28px; }
.cor-chat-trigger .cor-chat-close-icon { display: none; }
.cor-chat-trigger.open .cor-chat-open-icon { display: none; }
.cor-chat-trigger.open .cor-chat-close-icon { display: block; }

/* ── Window ───────────────────────────────────── */
.cor-chat-window {
  position: fixed;
  bottom: 100px;
  right: 24px;
  z-index: 9998;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 540px;
  max-height: calc(100vh - 140px);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 12px 60px rgba(0,0,0,0.2);
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: corSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.cor-chat-window.open { display: flex; }

@keyframes corSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Header ───────────────────────────────────── */
.cor-chat-header {
  background: linear-gradient(135deg, #3F5F4A 0%, #2D4A36 100%);
  color: #fff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.cor-chat-header::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 140px; height: 140px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
}

.cor-chat-header-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: #fff;
  padding: 4px;
  object-fit: contain;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.cor-chat-header-info {
  flex: 1;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.cor-chat-header-name {
  font-family: 'Prata', 'Cormorant Garamond', serif;
  font-size: 16px;
  line-height: 1.3;
}

.cor-chat-header-status {
  font-size: 11px;
  opacity: 0.85;
  display: flex;
  align-items: center;
  gap: 5px;
}

.cor-chat-header-status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #4ade80;
  display: inline-block;
  animation: corBlink 2s ease-in-out infinite;
}

@keyframes corBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

.cor-chat-header-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
  padding: 4px;
  position: relative;
  z-index: 1;
}

.cor-chat-header-close:hover { opacity: 1; }

/* ── Messages ─────────────────────────────────── */
.cor-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #F8F7F4;
}

.cor-chat-messages::-webkit-scrollbar { width: 4px; }
.cor-chat-messages::-webkit-scrollbar-track { background: transparent; }
.cor-chat-messages::-webkit-scrollbar-thumb { background: #d1d0cc; border-radius: 4px; }

/* ── Burbujas ─────────────────────────────────── */
.cor-chat-msg {
  max-width: 88%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  word-wrap: break-word;
  animation: corMsgIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes corMsgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.cor-chat-msg.bot {
  align-self: flex-start;
  background: #fff;
  color: #3d3d3a;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border-left: 3px solid #3F5F4A;
}

.cor-chat-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #3F5F4A 0%, #4A7055 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* ── Quick replies (collapsible) ──────────────── */
.cor-chat-quick-wrap {
  flex-shrink: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.25s ease;
  background: #F8F7F4;
  border-top: 1px solid #eae8e4;
  opacity: 1;
}

.cor-chat-quick-wrap.collapsed {
  opacity: 0;
  border-top: none;
}

.cor-chat-quick-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px 16px 4px;
  background: transparent;
  border: none;
  font-size: 11px;
  color: #8C8C8C;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.2s;
}

.cor-chat-quick-toggle:hover { color: #3F5F4A; }
.cor-chat-quick-toggle svg { transition: transform 0.3s; width: 14px; height: 14px; }
.cor-chat-quick-toggle.collapsed svg { transform: rotate(180deg); }

.cor-chat-quick-replies {
  padding: 4px 16px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cor-chat-quick-reply {
  background: #fff;
  border: 1px solid #d6d3cc;
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 12px;
  color: #3d3d3a;
  cursor: pointer;
  transition: all 0.25s;
  white-space: nowrap;
  font-family: inherit;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.cor-chat-quick-reply:hover {
  background: #3F5F4A;
  border-color: #3F5F4A;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(63,95,74,0.3);
}

/* ── Typing ───────────────────────────────────── */
.cor-chat-typing {
  align-self: flex-start;
  background: #fff;
  padding: 14px 20px;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  display: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border-left: 3px solid #3F5F4A;
}

.cor-chat-typing.show { display: flex; align-items: center; gap: 5px; }

.cor-chat-typing span {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #b0aea8;
  animation: corTyping 1.2s infinite ease-in-out;
}

.cor-chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.cor-chat-typing span:nth-child(3) { animation-delay: 0.4s; }

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

/* ── Responsive ───────────────────────────────── */
@media (max-width: 480px) {
  .cor-chat-window {
    bottom: 0; right: 0;
    width: 100vw; max-width: 100vw;
    height: 100vh; max-height: 100vh;
    border-radius: 0;
  }
  .cor-chat-trigger { bottom: 16px; right: 16px; width: 56px; height: 56px; }
  .cor-chat-trigger svg { width: 24px; height: 24px; }
}
