/* ─── EEC Symptoms-Inquiry chat widget ──────────────────────────────────── */

#eec-chat-root, #eec-chat-root * { box-sizing: border-box; }

/* Floating launcher ─────────────────────────────────────────────────────── */
.eec-chat-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9998;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px 12px 14px;
  background: #116DA5;
  color: #fff;
  border: none;
  border-radius: 999px;
  font: 600 14px/1 'Inter', system-ui, -apple-system, sans-serif;
  letter-spacing: 0.01em;
  box-shadow: 0 8px 24px rgba(17, 109, 165, 0.32), 0 2px 6px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.eec-chat-fab:hover { background: #0a4d7a; transform: translateY(-1px); box-shadow: 0 12px 28px rgba(17,109,165,0.4); }
.eec-chat-fab:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.eec-chat-fab svg { width: 22px; height: 22px; flex: 0 0 22px; }
.eec-chat-fab .eec-chat-fab__dot {
  position: absolute; top: 6px; right: 6px;
  width: 10px; height: 10px; background: #f43f5e; border: 2px solid #fff; border-radius: 50%;
  display: none;
}
.eec-chat-fab[data-unread="1"] .eec-chat-fab__dot { display: block; }

/* Panel ────────────────────────────────────────────────────────────────── */
.eec-chat-panel {
  position: fixed;
  right: 20px;
  bottom: 84px;
  width: 380px;
  max-width: calc(100vw - 24px);
  height: min(620px, calc(100vh - 110px));
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(10, 35, 60, 0.22), 0 4px 12px rgba(0,0,0,0.06);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  font: 14px/1.5 'Inter', system-ui, -apple-system, sans-serif;
  color: #1a2332;
  transform-origin: bottom right;
  animation: eec-chat-pop 0.18s ease-out;
}
@keyframes eec-chat-pop {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.eec-chat-panel[data-open="1"] { display: flex; }

.eec-chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: #116DA5;
  color: #fff;
}
.eec-chat-header__title { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; }
.eec-chat-header__title svg { width: 22px; height: 22px; }
.eec-chat-header__close {
  background: rgba(255,255,255,0.22);
  border: none; color: #fff;
  width: 34px; height: 34px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease;
}
.eec-chat-header__close:hover { background: rgba(255,255,255,0.35); }
.eec-chat-header__close svg { width: 18px; height: 18px; stroke-width: 2.4; }

/* Body ─────────────────────────────────────────────────────────────────── */
.eec-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 8px;
  background: #f7f9fb;
  scroll-behavior: smooth;
}
.eec-chat-body::-webkit-scrollbar { width: 6px; }
.eec-chat-body::-webkit-scrollbar-thumb { background: #cbd5e0; border-radius: 3px; }

/* Step header card (the first-screen frame) */
.eec-chat-stephead {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px 18px 16px;
  margin-bottom: 12px;
}
.eec-chat-stephead__kicker {
  font-size: 11px; font-weight: 700; letter-spacing: 0.12em;
  color: #116DA5;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.eec-chat-stephead__q {
  font-size: 18px; font-weight: 600; line-height: 1.3;
  color: #1a2332;
  margin: 0 0 10px;
}
.eec-chat-stephead__step {
  font-size: 12px; color: #6b7886; font-weight: 500;
  display: inline-flex; align-items: center; gap: 8px;
}
.eec-chat-stephead__bar {
  display: inline-block;
  width: 60px; height: 4px; border-radius: 2px;
  background: #e2e8f0;
  position: relative; overflow: hidden;
}
.eec-chat-stephead__bar::after {
  content: ''; position: absolute; inset: 0;
  background: #116DA5;
  width: var(--p, 25%);
  transition: width 0.3s ease;
}

/* Messages ─────────────────────────────────────────────────────────────── */
.eec-msg { display: flex; margin-bottom: 10px; }
.eec-msg__bubble {
  max-width: 84%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.eec-msg--bot .eec-msg__bubble { background: #fff; border: 1px solid #e2e8f0; border-bottom-left-radius: 4px; }
.eec-msg--user { justify-content: flex-end; }
.eec-msg--user .eec-msg__bubble { background: #116DA5; color: #fff; border-bottom-right-radius: 4px; }
.eec-msg--urgent .eec-msg__bubble {
  background: #fef2f2; border: 1px solid #fecaca; color: #991b1b;
  border-bottom-left-radius: 4px;
}
.eec-msg--urgent .eec-msg__bubble strong { color: #7f1d1d; }

/* Quick-reply chips ────────────────────────────────────────────────────── */
.eec-chips { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 14px; }
.eec-chip {
  text-align: left;
  background: #fff;
  border: 1px solid #d8e1ea;
  color: #1a2332;
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  font-weight: 500;
  display: flex; align-items: center; justify-content: space-between;
  transition: all 0.15s ease;
}
.eec-chip:hover { border-color: #116DA5; background: #f0f7fc; color: #116DA5; }
.eec-chip:focus-visible { outline: 2px solid #116DA5; outline-offset: 1px; }
.eec-chip__arrow { color: #94a3b8; font-size: 16px; transition: transform 0.15s ease, color 0.15s ease; }
.eec-chip:hover .eec-chip__arrow { color: #116DA5; transform: translateX(2px); }
.eec-chips--inline { flex-direction: row; flex-wrap: wrap; }
.eec-chips--inline .eec-chip { padding: 8px 12px; border-radius: 999px; font-size: 13px; }
.eec-chips--inline .eec-chip__arrow { display: none; }

.eec-chip--urgent {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
  font-weight: 600;
}
.eec-chip--urgent:hover { border-color: #dc2626; background: #fee2e2; color: #7f1d1d; }
.eec-chip--urgent .eec-chip__arrow { color: #dc2626; }

/* Summary suggestion card ─────────────────────────────────────────────── */
.eec-suggest {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  margin: 8px 0 14px;
}
.eec-suggest__label { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: #116DA5; font-weight: 700; margin-bottom: 6px; }
.eec-suggest__title { font-size: 16px; font-weight: 600; color: #1a2332; margin-bottom: 8px; line-height: 1.3; }
.eec-suggest__text { font-size: 13px; color: #4a5568; margin-bottom: 12px; }
.eec-suggest__ctas { display: flex; flex-wrap: wrap; gap: 8px; }
.eec-suggest__cta {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px;
  background: #116DA5; color: #fff;
  text-decoration: none;
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
  transition: background 0.15s ease;
}
.eec-suggest__cta:hover { background: #0a4d7a; }
.eec-suggest--urgent { border-color: #fecaca; background: #fff5f5; }
.eec-suggest--urgent .eec-suggest__label { color: #b91c1c; }
.eec-suggest__cta--call { background: #dc2626; }
.eec-suggest__cta--call:hover { background: #991b1b; }
.eec-suggest__cta--ghost { background: transparent; color: #116DA5; border: 1px solid #116DA5; }
.eec-suggest__cta--ghost:hover { background: #f0f7fc; }

/* Footer / input ──────────────────────────────────────────────────────── */
.eec-chat-foot {
  border-top: 1px solid #e2e8f0;
  background: #fff;
  padding: 10px 12px;
}
.eec-chat-foot__row { display: flex; gap: 8px; align-items: flex-end; }
.eec-chat-foot__input {
  flex: 1;
  resize: none;
  border: 1px solid #d8e1ea;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  color: #1a2332;
  max-height: 96px;
  min-height: 40px;
  outline: none;
  transition: border-color 0.15s ease;
}
.eec-chat-foot__input:focus { border-color: #116DA5; }
.eec-chat-foot__send {
  background: #116DA5;
  border: none;
  width: 40px; height: 40px;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s ease;
}
.eec-chat-foot__send:hover:not(:disabled) { background: #0a4d7a; }
.eec-chat-foot__send:disabled { background: #cbd5e0; cursor: not-allowed; }
.eec-chat-foot__send svg { width: 18px; height: 18px; }
.eec-chat-foot__hint { font-size: 11px; color: #94a3b8; margin: 6px 4px 0; text-align: center; }

.eec-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.eec-typing span {
  width: 6px; height: 6px; border-radius: 50%; background: #cbd5e0;
  animation: eec-typing 1s infinite ease-in-out;
}
.eec-typing span:nth-child(2) { animation-delay: 0.15s; }
.eec-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes eec-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-3px); opacity: 1; }
}

/* Reset chip */
.eec-chat-reset {
  background: none; border: none; color: #6b7886; font-size: 12px; cursor: pointer; padding: 6px 8px;
}
.eec-chat-reset:hover { color: #116DA5; text-decoration: underline; }

/* Slot picker ─────────────────────────────────────────────────────────── */
.eec-slot-picker {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px;
  margin: 8px 0 14px;
}
.eec-slot-picker__head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.eec-slot-picker__head svg { width: 22px; height: 22px; color: #116DA5; flex: 0 0 22px; }
.eec-slot-picker__title { font-size: 14px; font-weight: 600; color: #1a2332; line-height: 1.2; }
.eec-slot-picker__sub   { font-size: 11px; color: #6b7886; margin-top: 2px; }

.eec-slot-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.eec-slot-col { display: flex; flex-direction: column; gap: 6px; }
.eec-slot-col__head {
  font-size: 11px; font-weight: 700; color: #6b7886;
  text-transform: uppercase; letter-spacing: 0.05em;
  text-align: center; padding-bottom: 4px;
  border-bottom: 1px solid #e2e8f0;
}
.eec-slot {
  background: #fff;
  border: 1px solid #d8e1ea;
  border-radius: 8px;
  padding: 8px 0;
  font: 600 13px/1 'Inter', system-ui, sans-serif;
  color: #116DA5;
  cursor: pointer;
  transition: all 0.15s ease;
}
.eec-slot:hover { background: #f0f7fc; border-color: #116DA5; }
.eec-slot--selected { background: #116DA5; color: #fff; border-color: #116DA5; }
.eec-slot--selected:hover { background: #0a4d7a; }

.eec-slot-loading {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 12px;
  color: #6b7886;
  padding: 14px;
}
.eec-slot-loading--err { color: #b91c1c; }

.eec-slot-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.eec-slot-btn {
  flex: 1 1 auto;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: 600 13px/1 'Inter', system-ui, sans-serif;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.eec-slot-btn--primary { background: #116DA5; color: #fff; }
.eec-slot-btn--primary:hover:not(:disabled) { background: #0a4d7a; }
.eec-slot-btn--primary:disabled { background: #cbd5e0; cursor: not-allowed; }
.eec-slot-btn--whatsapp { background: #25d366; color: #fff; }
.eec-slot-btn--whatsapp:hover { background: #1ebe57; }
.eec-slot-btn--whatsapp svg { width: 16px; height: 16px; }

/* Booked confirmation */
.eec-suggest--booked { border-color: #bbf7d0; background: #f0fdf4; }
.eec-suggest--booked .eec-suggest__label {
  color: #15803d;
  display: inline-flex; align-items: center; gap: 6px;
}
.eec-suggest--booked .eec-suggest__label svg { width: 14px; height: 14px; }

/* Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 520px) {
  .eec-chat-panel {
    right: 0; left: 0; bottom: 0;
    width: 100%; max-width: 100%;
    height: 100dvh;
    border-radius: 18px 18px 0 0;
  }
  .eec-chat-fab { right: 14px; bottom: 14px; }
  .eec-side-fabs { right: 14px; bottom: 76px; gap: 10px; }
  .eec-fab { width: 48px; height: 48px; }
  .eec-fab svg { width: 24px; height: 24px; }
  /* Larger, more tappable close button on mobile. */
  .eec-chat-header__close {
    width: 44px; height: 44px;
    background: rgba(255,255,255,0.28);
  }
  .eec-chat-header__close svg { width: 22px; height: 22px; stroke-width: 2.6; }
}

/* Hide floating FABs while the mobile nav or the chat widget is open.
   Belt-and-braces: both html-class and :has() selectors. */
html.mobile-menu-open .eec-side-fabs,
html.eec-chat-open .eec-side-fabs,
html.eec-chat-open .eec-chat-fab,
html:has(.mobile-menu.open) .eec-side-fabs,
html:has(.eec-chat-panel[data-open="1"]) .eec-side-fabs,
html:has(.eec-chat-panel[data-open="1"]) .eec-chat-fab {
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

/* Scroll-direction reveal — pair with eec-shared.js scrollReveal().
   When html.fabs-hidden is set (user scrolling DOWN past threshold)
   the side stack + chat fab slide DOWN out of view. Opposite of the
   nav, which slides UP. 0.5s ease per spec. */
.eec-side-fabs, .eec-chat-fab {
  transition: transform 0.5s ease, opacity 0.2s ease;
  will-change: transform;
}
html.fabs-hidden .eec-side-fabs,
html.fabs-hidden .eec-chat-fab {
  transform: translateY(180%);
}

/* Print: hide widget entirely */
@media print {
  .eec-chat-fab, .eec-chat-panel, .eec-side-fabs { display: none !important; }
}

/* Side FAB stack (Zalo, WhatsApp) — sits ABOVE the Symptoms-Inquiry FAB ── */
.eec-side-fabs {
  position: fixed;
  right: 20px;
  bottom: 82px;            /* clears the chat FAB which is bottom:20px, ~46px tall */
  z-index: 9998;
  display: flex;
  flex-direction: column;  /* top→bottom: Zalo, WhatsApp */
  gap: 12px;
  pointer-events: none;    /* let children opt back in */
}
.eec-side-fabs .eec-fab { pointer-events: auto; }
.eec-fab {
  width: 52px; height: 52px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; text-decoration: none;
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.eec-fab:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,0,0,0.22); }
.eec-fab:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.eec-fab svg { width: 26px; height: 26px; display: block; }
.eec-fab.fab-zalo { background: #0068FF; }
.eec-fab.fab-whatsapp { background: #25D366; }
