
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&display=swap');

/* ══════════════════════════════════════════════
   DESIGN TOKENS
   Primary:   #0a2540  (deep navy)
   Accent:    #00c2a8  (electric teal)
   Mid:       #0d3461  (mid navy)
   Surface:   #f4f7fb  (cool off-white)
   ══════════════════════════════════════════════ */

/* ========== FAB BUTTON ========== */
#chatFab {
  position: fixed;
  right: 28px;
  bottom: 28px;
  width: 60px;
  height: 60px;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  z-index: 9999;
  background: linear-gradient(145deg, #0d3461, #0a2540);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .25s cubic-bezier(.34, 1.56, .64, 1), box-shadow .25s ease;
  box-shadow: 0 8px 24px rgba(10, 37, 64, .55), 0 2px 8px rgba(10, 37, 64, .25),
              inset 0 1px 0 rgba(255, 255, 255, .1);
}

#chatFab:hover {
  transform: scale(1.1) translateY(-3px);
  box-shadow: 0 16px 40px rgba(10, 37, 64, .65);
}

/* Ripple ring — teal glow */
#chatFab::before {
  content: '';
  position: absolute;
  inset: -7px;
  border-radius: 26px;
  border: 2px solid rgba(190, 102, 9, 0.4);
  animation: fabRing 2.6s ease-out infinite;
}

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

#chatFab:hover::before {
  animation: none;
  opacity: 0;
}

/* Notification dot */
.notif-dot {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 15px;
  height: 15px;
  background: #f97316;
  border-radius: 50%;
  border: 2.5px solid #fff;
  animation: dotPop .35s cubic-bezier(.34, 1.56, .64, 1) both;
}

@keyframes dotPop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

/* ========== CHAT WINDOW ========== */
#chatWindow {
  position: fixed;
  right: 28px;
  bottom: 104px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 120px);
  background: #f4f7fb;
  border-radius: 24px;
  box-shadow: 0 32px 96px rgba(0, 0, 0, .3), 0 8px 32px rgba(0, 0, 0, .15),
              0 0 0 1px rgba(255, 255, 255, .08);
  display: none;
  flex-direction: column;
  z-index: 9999;
  font-family: 'DM Sans', sans-serif;
  overflow: hidden;
  transform-origin: bottom right;
}

#chatWindow.open {
  display: flex;
  animation: windowOpen .3s cubic-bezier(.34, 1.56, .64, 1) both;
}

#chatWindow.closing {
  animation: windowClose .22s ease forwards;
}

@keyframes windowOpen {
  from { opacity: 0; transform: scale(.86) translateY(16px); }
  to   { opacity: 1; transform: scale(1)   translateY(0);    }
}

@keyframes windowClose {
  from { opacity: 1; transform: scale(1)   translateY(0);    }
  to   { opacity: 0; transform: scale(.88) translateY(12px); }
}

/* ========== HEADER ========== */
#chatHeader {
  flex: 0 0 auto;
  background: linear-gradient(135deg, #0a2540 0%, #0d3461 100%);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

/* Grain texture */
#chatHeader::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.03'/%3E%3C/svg%3E");
  pointer-events: none;
}

/* Teal glow orb */
#chatHeader::before {
  content: '';
  position: absolute;
  right: -30px;
  top: -30px;
  width: 110px;
  height: 110px;
  background: radial-gradient(circle, rgba(217, 122, 5, 0.18) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.header-info {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.avatar-shell {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: linear-gradient(145deg, rgba(145, 85, 6, 0.25), rgba(10, 37, 64, .5));
  border: 1px solid rgba(255, 255, 255, .18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
}

.online-ring {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 13px;
  height: 13px;
  background: #f97316;
  border-radius: 50%;
  border: 2.5px solid #0a2540;
  box-shadow: 0 0 8px rgba(205, 143, 9, 0.7);
  animation: pulse 2s ease infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 8px  rgba(206, 132, 6, 0.5); }
  50%       { box-shadow: 0 0 18px rgba(193, 132, 10, 0.95); }
}

.header-text { line-height: 1.25; }

.header-text strong {
  font-family: 'Syne', sans-serif;
  font-size: 14.5px;
  font-weight: 700;
  color: #fff;
  display: block;
  letter-spacing: .01em;
}

.header-text span {
  font-size: 11.5px;
  color: rgba(255, 255, 255, .55);
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 5px;
}

.header-text span::before {
  content: '';
  width: 6px;
  height: 6px;
  background: #f97316;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.header-actions {
  display: flex;
  gap: 8px;
  position: relative;
  z-index: 1;
}

#closeChat {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, .15);
  background: rgba(255, 255, 255, .08);
  color: rgba(255, 255, 255, .8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .15s;
}

#closeChat:hover {
  background: rgba(255, 255, 255, .18);
  transform: scale(1.07);
}

/* ========== QUICK CHIPS ========== */
#quickChips {
  flex: 0 0 auto;
  padding: 10px 14px 6px;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  background: #f4f7fb;
  scroll-behavior: smooth;
}

#quickChips::-webkit-scrollbar       { width: 3px; }
#quickChips::-webkit-scrollbar-track { background: transparent; }
#quickChips::-webkit-scrollbar-thumb { background: #c5d4e3; border-radius: 4px; }

.chip {
  flex-shrink: 0;
  padding: 6px 13px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  border: 1.5px solid #d8e3ef;
  background: #fff;
  color: #1e3a52;
  cursor: pointer;
  white-space: nowrap;
  transition: all .18s ease;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .06);
}

.chip:hover {
  border-color: #f97316;
  color: #0a2540;
  background: #e8faf8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(194, 158, 0, 0.2);
}

/* ========== MESSAGES ========== */
#chatBody {
  flex: 1 1 auto;
  padding: 10px 14px;
  overflow-y: auto;
  background: #f4f7fb;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

#chatBody::-webkit-scrollbar       { width: 3px; }
#chatBody::-webkit-scrollbar-track { background: transparent; }
#chatBody::-webkit-scrollbar-thumb { background: #c5d4e3; border-radius: 4px; }

.msg {
  display: flex;
  gap: 8px;
  animation: msgIn .22s ease both;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px) scale(.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1);   }
}

.msg.user { justify-content: flex-end; }
.msg.bot  { justify-content: flex-start; align-items: flex-end; }

/* In-message bot icon — NOT .avatar-shell (that's the header only) */
.bot-icon {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: linear-gradient(145deg, #0a2540, #0d3461);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(10, 37, 64, .3);
}

.bubble {
  max-width: 78%;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  position: relative;
}

/* User bubble — teal gradient */
.user .bubble {
  background: linear-gradient(135deg, #f97316, #f97316);
  color: #fff;
  border-radius: 16px 16px 4px 16px;
  box-shadow: 0 4px 16px rgba(0, 194, 168, .3);
}

/* Bot bubble — white card */
.bot .bubble {
  background: #fff;
  color: #0d1f30;
  border: 1px solid #dce8f2;
  border-radius: 4px 16px 16px 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .07);
}

/* Timestamps */
.msg-time {
  font-size: 10px;
  color: #8fafc8;
  margin-top: 3px;
  text-align: right;
  padding: 0 4px;
}

.msg.bot .msg-time {
  text-align: left;
  padding-left: 36px;
}

/* Typing indicator */
.typing-dots {
  display: flex;
  gap: 5px;
  padding: 13px 16px;
  background: #fff;
  border: 1px solid #dce8f2;
  border-radius: 4px 16px 16px 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .07);
}

.typing-dots span {
  width: 7px;
  height: 7px;
  background: #8fafc8;
  border-radius: 50%;
  animation: typingDot 1.3s ease infinite;
}

.typing-dots span:nth-child(2) { animation-delay: .22s; }
.typing-dots span:nth-child(3) { animation-delay: .44s; }

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

/* ========== FOOTER / INPUT AREA ========== */
#chatFooter {
  flex: 0 0 auto;
  background: #fff;
  border-top: 1px solid #dce8f2;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Email row */
.email-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f4f7fb;
  border-radius: 12px;
  border: 1.5px solid #d8e3ef;
  transition: border-color .15s, box-shadow .15s;
}

.email-row:focus-within {
  border-color: #f97316;
  box-shadow: 0 0 0 3px rgba(0, 194, 168, .12);
}

.email-icon {
  width: 16px;
  height: 16px;
  color: #7a9cb8;
  flex-shrink: 0;
}

.email-row input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 12.5px;
  color: #0d1f30;
  outline: none;
}

.email-row input::placeholder { color: #a8c0d4; }

/* Message input row */
.msg-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  background: #f4f7fb;
  border-radius: 14px;
  border: 1.5px solid #d8e3ef;
  transition: border-color .15s, box-shadow .15s;
}

.msg-input-row:focus-within {
  border-color: #f97316;
  box-shadow: 0 0 0 3px rgba(0, 194, 168, .12);
}

#chatMessage {
  flex: 1;
  border: none;
  background: transparent;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  color: #0d1f30;
  outline: none;
  resize: none;
  min-height: 20px;
  max-height: 80px;
  line-height: 1.45;
  overflow-y: auto;
}

#chatMessage::placeholder { color: #a8c0d4; }

/* Send button */
#sendBtn {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  border: none;
  background: linear-gradient(145deg, #f97316, #f97316);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform .2s cubic-bezier(.34, 1.56, .64, 1), box-shadow .2s ease, opacity .2s;
  box-shadow: 0 4px 14px rgba(0, 194, 168, .4);
}

#sendBtn:hover:not(:disabled) {
  transform: scale(1.12) translateY(-1px);
  box-shadow: 0 8px 22px rgba(240, 151, 17, 0.55);
}

#sendBtn:disabled {
  opacity: .4;
  cursor: not-allowed;
  transform: none;
}

/* Bottom meta bar */
.footer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#status {
  font-size: 11.5px;
  color: #5a7a96;
  min-height: 14px;
}

#status.success { color: #059669; font-weight: 500; }
#status.error   { color: #dc2626; font-weight: 500; }

/* WhatsApp in-widget button */
.wa-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 8px;
  border: 1px solid #dcfce7;
  background: #f0fdf4;
  color: #166534;
  font-size: 11.5px;
  font-weight: 600;
  font-family: 'Syne', sans-serif;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, transform .15s;
}

.wa-btn:hover {
  background: #dcfce7;
  transform: translateY(-1px);
  color: #166534;
  text-decoration: none;
}

.wa-btn svg { color: #16a34a; }

/* ========== SUPPORT ESCALATION PANEL ========== */
#supportPanel {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #eef4fb, #f4f7fb);
  border-top: 1px solid #ccdded;
  animation: slideUp .22s ease both;
}

#supportPanel.visible {
  display: flex;
}

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

.support-header {
  font-family: 'Syne', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: #4a6f8a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.support-header svg { color: #0a2540; }

/* Support button */
#supportBtn {
  width: 100%;
  height: 42px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #0d3461, #0a2540);
  color: #fff;
  font-family: 'Syne', sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform .2s cubic-bezier(.34, 1.56, .64, 1), box-shadow .2s ease, opacity .2s;
  box-shadow: 0 4px 16px rgba(10, 37, 64, .35);
  position: relative;
  overflow: hidden;
}

/* Shimmer sweep */
#supportBtn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(0, 194, 168, .12) 50%, transparent 100%);
  transform: translateX(-100%);
  transition: transform .4s ease;
}

#supportBtn:hover::before { transform: translateX(100%); }

#supportBtn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(10, 37, 64, .45);
}

#supportBtn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

#supportStatus {
  font-size: 11.5px;
  min-height: 14px;
  text-align: center;
  color: #4a6f8a;
}

#supportStatus.success { color: #059669; font-weight: 600; }
#supportStatus.error   { color: #dc2626; font-weight: 600; }

/* ========== FLOATING WHATSAPP BUTTON ========== */
#waButton {
  position: fixed;
  right: 20px;
  bottom: 100px;
  width: 58px;
  height: 58px;
  background: #25D366;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .28);
  z-index: 10000;
  text-decoration: none;
  transition: transform .18s ease-in-out;
}

#waButton:hover { transform: scale(1.08); }

/* Tooltip bubble */
#waButton .waTooltip {
  position: absolute;
  right: 70px;
  top: 50%;
  transform: translateY(-50%);
  background: #0a2540;
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 10px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease-in-out, transform .15s ease-in-out;
  box-shadow: 0 10px 20px rgba(0, 0, 0, .22);
}

/* Tooltip arrow */
#waButton .waTooltip::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: transparent transparent transparent #0a2540;
}

#waButton:hover .waTooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(-2px);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 420px) {
  #chatWindow {
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 24px 24px 0 0;
    height: 92vh;
    max-height: 92vh;
  }

  #chatFab { right: 20px; bottom: 20px; }

  #waButton { right: 16px; bottom: 92px; }
  #waButton .waTooltip { display: none; }
}