/* ============================================================
   CLARIDGE SOLAR – AI CHATBOT UI
   Sola: Your Solar AI Assistant
   Colors: Teal #0F3D3E + Amber #E6A00D
   ============================================================ */

/* ── FLOATING TRIGGER BUTTON ────────────────────────────────── */
.chat-float-wrap {
  position: fixed;
  bottom: 28px;
  right: 24px;
  z-index: 9990;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

/* Attention popup bubble */
.chat-attention {
  background: #fff;
  color: #0F3D3E;
  padding: 12px 18px;
  border-radius: 14px 14px 4px 14px;
  font-size: 0.84rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  box-shadow: 0 8px 30px rgba(0,0,0,0.18);
  max-width: 230px;
  line-height: 1.4;
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px) scale(0.94);
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
  position: relative;
  border: 1px solid rgba(15,61,62,0.1);
}
.chat-attention.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}
.chat-attention::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 18px;
  width: 0; height: 0;
  border-left: 8px solid transparent;
  border-right: 0 solid transparent;
  border-top: 8px solid #fff;
}
.chat-attention-close {
  display: inline-block;
  margin-left: 8px;
  color: #7A9090;
  font-size: 0.8rem;
  font-weight: 400;
  cursor: pointer;
}

/* The floating button itself */
.chat-float-btn {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0F3D3E 0%, #1A5E5F 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  flex-shrink: 0;
}
.chat-float-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 10px 28px rgba(0,0,0,0.5);
}
.chat-float-btn:active { transform: scale(0.96); }

/* Pulse rings */
.chat-float-btn::before,
.chat-float-btn::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(15,61,62,0.45);
  animation: chatPulse 2.5s ease-out infinite;
}
.chat-float-btn::after {
  inset: -13px;
  border-color: rgba(15,61,62,0.22);
  animation-delay: 0.8s;
}
.chat-float-btn.active::before,
.chat-float-btn.active::after { animation: none; border: none; }

@keyframes chatPulse {
  0%   { transform: scale(1); opacity: 1; }
  70%  { transform: scale(1.3); opacity: 0; }
  100% { transform: scale(1.3); opacity: 0; }
}

/* Chat icon inside button */
.chat-float-btn .chat-btn-icon {
  width: 28px;
  height: 28px;
  color: #E6A00D;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.chat-float-btn .chat-btn-close {
  position: absolute;
  width: 22px; height: 22px;
  color: #fff;
  opacity: 0;
  transform: rotate(-90deg) scale(0.6);
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.chat-float-btn.active .chat-btn-icon {
  opacity: 0;
  transform: rotate(90deg) scale(0.6);
}
.chat-float-btn.active .chat-btn-close {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* Notification dot */
.chat-notif-dot {
  position: absolute;
  top: 3px; right: 3px;
  width: 14px; height: 14px;
  background: #E6A00D;
  border-radius: 50%;
  border: 2px solid #0F3D3E;
  font-size: 0.55rem;
  font-weight: 800;
  color: #0F3D3E;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.chat-float-btn.active .chat-notif-dot {
  transform: scale(0);
  opacity: 0;
}

/* ── CHAT WINDOW ────────────────────────────────────────────── */
.chat-window {
  position: fixed;
  bottom: 106px;
  right: 24px;
  width: 385px;
  height: 560px;
  background: #06100F;
  border-radius: 22px;
  box-shadow:
    0 20px 60px rgba(0,0,0,0.55),
    0 0 0 1px rgba(15,61,62,0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9989;
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transform-origin: bottom right;
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s ease;
}
.chat-window.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

/* ── CHAT HEADER ────────────────────────────────────────────── */
.chat-header {
  background: linear-gradient(135deg, #0F3D3E 0%, #1A5E5F 100%);
  padding: 16px 18px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  position: relative;
}
.chat-header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: rgba(230,160,13,0.2);
}

/* AI Avatar */
.chat-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #E6A00D 0%, #F2B530 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
  box-shadow: none;
  position: relative;
}
.chat-avatar::after {
  content: '';
  position: absolute;
  bottom: 1px; right: 1px;
  width: 10px; height: 10px;
  background: #22C55E;
  border-radius: 50%;
  border: 2px solid #0F3D3E;
}

.chat-header-info { flex: 1; min-width: 0; }
.chat-header-name {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1rem;
  color: #fff;
  line-height: 1.2;
}
.chat-header-status {
  font-size: 0.73rem;
  color: rgba(255,255,255,0.65);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.chat-status-dot {
  width: 7px; height: 7px;
  background: #22C55E;
  border-radius: 50%;
  animation: statusPulse 2s ease-in-out infinite;
}
@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* Header actions */
.chat-header-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.chat-header-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.8);
  transition: background 0.2s ease, color 0.2s ease;
}
.chat-header-btn:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
}
.chat-header-btn svg { width: 16px; height: 16px; }

/* Powered by bar */
.chat-powered {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.4);
  text-align: center;
  margin-top: 4px;
  letter-spacing: 0.5px;
}
.chat-powered span { color: rgba(230,160,13,0.7); }

/* ── MESSAGES AREA ─────────────────────────────────────────── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(15,61,62,0.5);
  border-radius: 4px;
}

/* Date divider */
.chat-date-divider {
  text-align: center;
  font-size: 0.68rem;
  color: #4A6060;
  margin: 4px 0;
  position: relative;
}
.chat-date-divider::before,
.chat-date-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 28%;
  height: 1px;
  background: #1E3535;
}
.chat-date-divider::before { left: 0; }
.chat-date-divider::after  { right: 0; }

/* Message row */
.chat-msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  animation: msgIn 0.3s cubic-bezier(0.34,1.2,0.64,1) both;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.chat-msg-row.user { flex-direction: row-reverse; }

/* Mini avatar in messages */
.chat-msg-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #E6A00D 0%, #F2B530 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
  margin-bottom: 2px;
}

/* Message bubble */
.chat-bubble {
  max-width: 78%;
  padding: 11px 14px;
  border-radius: 18px;
  font-family: 'Inter', sans-serif;
  font-size: 0.87rem;
  line-height: 1.55;
  position: relative;
}
.chat-bubble.bot {
  background: #112020;
  color: #C0CCCC;
  border-radius: 4px 18px 18px 18px;
  border: 1px solid #1E3535;
}
.chat-bubble.user {
  background: #E6A00D;
  color: #06100F;
  border-radius: 18px 18px 4px 18px;
  font-weight: 600;
}

/* Markdown bold rendering */
.chat-bubble strong {
  font-weight: 700;
  color: #E6A00D;
}
.chat-bubble.user strong { color: #06100F; }

/* Multi-line list in bubble */
.chat-bubble .chat-list {
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chat-bubble .chat-list li {
  padding-left: 4px;
}

/* Timestamp */
.chat-time {
  font-size: 0.62rem;
  color: #4A6060;
  margin-top: 3px;
  text-align: right;
}
.chat-msg-row.user .chat-time { text-align: left; }

/* ── TYPING INDICATOR ──────────────────────────────────────── */
.chat-typing-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  animation: msgIn 0.3s ease both;
}
.chat-typing-bubble {
  background: #112020;
  border: 1px solid #1E3535;
  border-radius: 4px 18px 18px 18px;
  padding: 13px 16px;
  display: flex;
  gap: 5px;
  align-items: center;
}
.chat-typing-dot {
  width: 7px; height: 7px;
  background: #2A4A4A;
  border-radius: 50%;
  animation: typingBounce 1.2s ease-in-out infinite;
}
.chat-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); background: #2A4A4A; }
  30%            { transform: translateY(-6px); background: #E6A00D; }
}

/* ── HANDOVER BANNER ──────────────────────────────────────── */
.chat-handover-banner {
  margin: 4px 0;
  background: linear-gradient(135deg, rgba(15,61,62,0.5), rgba(26,94,95,0.3));
  border: 1px solid rgba(230,160,13,0.3);
  border-radius: 14px;
  padding: 14px 16px;
  text-align: center;
  animation: msgIn 0.3s ease both;
}
.chat-handover-banner p {
  font-size: 0.8rem;
  color: #C0CCCC;
  margin-bottom: 10px;
  line-height: 1.5;
}
.chat-handover-wa {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #25D366;
  color: #fff;
  padding: 9px 20px;
  border-radius: 100px;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease;
}
.chat-handover-wa:hover {
  background: #128C7E;
  transform: translateY(-1px);
}
.chat-handover-wa svg { width: 16px; height: 16px; }

/* ── QUICK REPLIES ────────────────────────────────────────── */
.chat-quick-replies {
  padding: 6px 14px 10px;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
}
.chat-quick-replies::-webkit-scrollbar { display: none; }

.chat-quick-btn {
  background: transparent;
  border: 1px solid rgba(230,160,13,0.4);
  color: #E6A00D;
  padding: 7px 14px;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
  flex-shrink: 0;
}
.chat-quick-btn:hover {
  background: rgba(230,160,13,0.12);
  border-color: #E6A00D;
  transform: translateY(-1px);
}
.chat-quick-btn:active { transform: translateY(0); }

/* ── INPUT AREA ───────────────────────────────────────────── */
.chat-input-area {
  padding: 10px 14px 14px;
  background: #06100F;
  border-top: 1px solid #1E3535;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}

.chat-input-wrap {
  flex: 1;
  background: #112020;
  border: 1.5px solid #1E3535;
  border-radius: 14px;
  display: flex;
  align-items: flex-end;
  padding: 8px 12px;
  transition: border-color 0.25s ease;
  min-height: 44px;
}
.chat-input-wrap:focus-within { border-color: rgba(230,160,13,0.5); }

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: #C0CCCC;
  font-family: 'Inter', sans-serif;
  font-size: 0.87rem;
  line-height: 1.4;
  max-height: 80px;
  overflow-y: auto;
  scrollbar-width: none;
}
.chat-input::placeholder { color: #4A6060; }
.chat-input::-webkit-scrollbar { display: none; }

.chat-send-btn {
  width: 44px; height: 44px;
  border-radius: 14px;
  background: #E6A00D;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s ease, transform 0.15s ease;
}
.chat-send-btn:hover  { background: #F2B530; transform: scale(1.06); }
.chat-send-btn:active { transform: scale(0.96); }
.chat-send-btn:disabled { background: #2A4A4A; cursor: default; transform: none; }
.chat-send-btn svg { width: 18px; height: 18px; color: #06100F; }

/* ── DISCLAIMER ───────────────────────────────────────────── */
.chat-disclaimer {
  text-align: center;
  font-size: 0.62rem;
  color: #4A6060;
  padding: 0 14px 10px;
  font-family: 'Inter', sans-serif;
}
.chat-disclaimer a { color: rgba(230,160,13,0.6); }

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 480px) {
  .chat-window {
    right: 0; left: 0; bottom: 0;
    width: 100%;
    height: 92dvh;
    border-radius: 22px 22px 0 0;
    max-height: 92dvh;
  }
  .chat-float-wrap {
    bottom: 20px;
    right: 16px;
  }
  .chat-attention { max-width: 200px; font-size: 0.8rem; }
}

/* ── HIDE OLD FLOAT WA ────────────────────────────────────── */
.float-wa { display: none !important; }
