/**
 * EthicsComputer — WhatsApp-Style AI Lead Assistant CSS
 * Lightweight, executive light-mode styling with zero layout shift.
 */

/* ── 1. Floating Launcher ── */
.ec-chat-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: 'Outfit', 'Plus Jakarta Sans', system-ui, sans-serif;
}

.ec-chat-teaser {
  background: #ffffff;
  color: #0f172a;
  padding: 8px 14px;
  border-radius: 16px 16px 4px 16px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  border: 1px solid #e2e8f0;
  margin-bottom: 8px;
  cursor: pointer;
  animation: ec-fade-slide 0.4s ease-out;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.2s ease;
}

.ec-chat-teaser:hover {
  transform: translateY(-2px);
}

.ec-chat-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #ffffff;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  border: 2px solid rgba(255, 255, 255, 0.25);
}

.ec-chat-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.55);
}

.ec-chat-btn-ping {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 13px;
  height: 13px;
  background: #10b981;
  border: 2px solid #ffffff;
  border-radius: 50%;
}

/* ── 2. WhatsApp-Style Chat Panel ── */
.ec-chat-panel {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 390px;
  max-width: calc(100vw - 32px);
  height: 620px;
  max-height: calc(100vh - 120px);
  border-radius: 20px;
  background: #efeae2;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25), 0 0 1px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.ec-chat-panel.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* ── 3. Header ── */
.ec-chat-header {
  background: #075e54;
  background: linear-gradient(135deg, #075e54 0%, #128c7e 100%);
  color: #ffffff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  user-select: none;
}

.ec-chat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ec-chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.ec-chat-avatar img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.ec-chat-title {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  color: #ffffff;
}

.ec-chat-status {
  font-size: 10px;
  color: #d1fae5;
  display: flex;
  align-items: center;
  gap: 4px;
}

.ec-chat-status-dot {
  width: 6px;
  height: 6px;
  background: #25d366;
  border-radius: 50%;
}

.ec-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ec-chat-action-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ec-chat-action-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

/* ── 4. Chat Messages Feed ── */
.ec-chat-feed {
  flex: 1;
  padding: 16px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background-color: #efeae2;
  background-image: radial-gradient(rgba(0, 0, 0, 0.04) 1px, transparent 1px);
  background-size: 16px 16px;
  scroll-behavior: smooth;
}

.ec-chat-msg {
  max-width: 84%;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
  position: relative;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  word-wrap: break-word;
  animation: ec-msg-pop 0.25s ease-out;
}

/* Bot Message */
.ec-chat-msg-assistant {
  background: #ffffff;
  color: #111827;
  align-self: flex-start;
  border-top-left-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

/* User Message */
.ec-chat-msg-visitor {
  background: #d9fdd3;
  color: #111827;
  align-self: flex-end;
  border-top-right-radius: 2px;
}

/* Human Agent Message */
.ec-chat-msg-agent {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
  align-self: flex-start;
  border-top-left-radius: 2px;
}

.ec-chat-msg-agent::before {
  content: '👤 Senior Consultant';
  display: block;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  color: #0284c7;
  margin-bottom: 2px;
}

.ec-chat-msg-time {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  font-size: 9px;
  color: #64748b;
  margin-top: 4px;
}

.ec-chat-msg-ticks {
  color: #53bdeb;
  font-weight: bold;
}

/* Typing Indicator */
.ec-chat-typing {
  align-self: flex-start;
  background: #ffffff;
  padding: 8px 14px;
  border-radius: 12px;
  border-top-left-radius: 2px;
  display: flex;
  gap: 4px;
  align-items: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.ec-typing-dot {
  width: 6px;
  height: 6px;
  background: #94a3b8;
  border-radius: 50%;
  animation: ec-bounce 1.4s infinite ease-in-out both;
}

.ec-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.ec-typing-dot:nth-child(2) { animation-delay: -0.16s; }

/* ── 5. Quick Replies Container ── */
.ec-chat-replies {
  padding: 6px 12px 10px;
  background: #efeae2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 140px;
  overflow-y: auto;
}

.ec-quick-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
}

.ec-quick-btn:hover {
  background: #075e54;
  color: #ffffff;
  border-color: #075e54;
  transform: translateY(-1px);
}

.ec-quick-btn-url {
  background: #10b981;
  color: #ffffff;
  border-color: #059669;
}

.ec-quick-btn-url:hover {
  background: #047857;
}

/* ── 6. Input Area ── */
.ec-chat-input-area {
  padding: 10px 12px;
  background: #f0f2f5;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ec-chat-input {
  flex: 1;
  padding: 9px 14px;
  border-radius: 20px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  font-size: 13px;
  color: #0f172a;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}

.ec-chat-input:focus {
  border-color: #075e54;
}

.ec-chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #075e54;
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.ec-chat-send-btn:hover {
  background: #128c7e;
  transform: scale(1.05);
}

.ec-chat-footer-note {
  font-size: 9px;
  text-align: center;
  color: #64748b;
  padding: 4px 8px;
  background: #f0f2f5;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
}

/* ── 7. Animations ── */
@keyframes ec-fade-slide {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes ec-msg-pop {
  from { opacity: 0; transform: scale(0.96) translateY(4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes ec-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1.0); }
}

/* ── 8. Mobile Responsiveness ── */
@media (max-width: 640px) {
  .ec-chat-panel {
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }

  .ec-chat-launcher {
    bottom: 16px;
    right: 16px;
  }
}
