/* ==========================================================================
   KINOVA PHYSIOTHERAPY – SMART FAQ CHATBOT + WHATSAPP WIDGET
   Matches Kinova Navy (#0C2340), Primary Blue (#0755a5), & WhatsApp Green
   ========================================================================== */

/* Hide legacy dual floating buttons when unified chatbot widget is mounted */
body.kinova-chatbot-ready .floating-contact-actions {
  display: none !important;
}

#kinova-chatbot-root {
  position: fixed;
  right: 22px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 99999 !important;
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.45;
  color: #1e293b;
}

#kinova-chatbot-root *,
#kinova-chatbot-root *::before,
#kinova-chatbot-root *::after {
  box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   1. Introductory Speech-Bubble Teaser Card
   -------------------------------------------------------------------------- */
.kinova-cb-teaser {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: 278px;
  max-width: calc(100vw - 28px);
  background: #ffffff;
  border: 2px solid #0f172a;
  border-radius: 18px;
  padding: 16px 16px 14px;
  box-shadow: 4px 5px 0 #16a34a, 0 14px 32px rgba(12, 35, 64, 0.16);
  animation: kinovaCbPopIn 0.25s ease-out;
}

.kinova-cb-teaser[hidden] {
  display: none !important;
}

.kinova-cb-teaser::after {
  content: "";
  position: absolute;
  right: 18px;
  bottom: -11px;
  width: 18px;
  height: 18px;
  background: #ffffff;
  border-right: 2px solid #0f172a;
  border-bottom: 2px solid #0f172a;
  transform: rotate(45deg);
}

.kinova-cb-teaser__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.kinova-cb-teaser__badge {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #22c55e;
  border: 1.5px solid #0f172a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}

.kinova-cb-teaser__dismiss {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.kinova-cb-teaser__dismiss:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.kinova-cb-teaser__title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 800;
  color: #0c2340;
}

.kinova-cb-teaser__text {
  margin: 0 0 12px;
  font-size: 13px;
  color: #334155;
}

.kinova-cb-teaser__cta {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: none;
  background: #0c2340;
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.kinova-cb-teaser__cta:hover {
  background: #0755a5;
  transform: translateY(-1px);
}

.kinova-cb-teaser__cta-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* --------------------------------------------------------------------------
   2. Floating Green Circular Launcher Button
   -------------------------------------------------------------------------- */
.kinova-cb-fab {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 2px solid #0f172a;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(22, 163, 74, 0.36);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  padding: 0;
}

.kinova-cb-fab:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 12px 28px rgba(22, 163, 74, 0.45);
}

.kinova-cb-fab:focus-visible,
.kinova-cb-teaser__cta:focus-visible,
.kinova-cb-teaser__dismiss:focus-visible,
.kinova-cb-icon-btn:focus-visible,
.kinova-cb-chip:focus-visible,
.kinova-cb-cta:focus-visible,
.kinova-cb-handoff-btn:focus-visible,
.kinova-cb-send:focus-visible,
.kinova-cb-input:focus-visible {
  outline: 2.5px solid #0755a5 !important;
  outline-offset: 2px !important;
}

/* --------------------------------------------------------------------------
   3. Expanded Chatbot Window
   -------------------------------------------------------------------------- */
.kinova-cb-window {
  position: fixed;
  right: 22px;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  z-index: 99999 !important;
  width: 396px;
  max-width: calc(100vw - 32px);
  height: min(600px, calc(var(--kinova-vvh, 100dvh) - 108px));
  background: #ffffff !important;
  opacity: 1 !important;
  border-radius: 16px;
  border: 1px solid #cbd5e1;
  box-shadow: 0 20px 50px rgba(12, 35, 64, 0.24);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: kinovaCbPopIn 0.16s ease-out;
}

.kinova-cb-window[hidden] {
  display: none !important;
}

/* Header */
.kinova-cb-header {
  background: #0c2340;
  color: #ffffff;
  padding: 13px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.kinova-cb-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.kinova-cb-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ffffff;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
}

.kinova-cb-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.kinova-cb-titles {
  min-width: 0;
}

.kinova-cb-title {
  margin: 0;
  font-family: 'Space Grotesk', 'Manrope', sans-serif;
  font-size: 15.5px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kinova-cb-subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.kinova-cb-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
  flex-shrink: 0;
}

.kinova-cb-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.kinova-cb-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #e2e8f0;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, color 0.15s ease;
  padding: 0;
}

.kinova-cb-icon-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

/* Messages Viewport */
.kinova-cb-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #eaf4f8;
  padding: 14px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kinova-cb-msg {
  display: flex;
  flex-direction: column;
  max-width: 90%;
  animation: kinovaCbFadeIn 0.18s ease-out;
}

.kinova-cb-msg--bot {
  align-self: flex-start;
}

.kinova-cb-msg--user {
  align-self: flex-end;
}

.kinova-cb-bubble {
  padding: 10px 13px;
  font-size: 13.5px;
  line-height: 1.55;
  word-wrap: break-word;
}

.kinova-cb-msg--bot .kinova-cb-bubble {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #d9e6ee;
  border-radius: 4px 14px 14px 14px;
  box-shadow: 0 2px 6px rgba(12, 35, 64, 0.05);
}

.kinova-cb-msg--user .kinova-cb-bubble {
  background: #dcfce7;
  color: #0f172a;
  border: 1px solid #bbf7d0;
  border-radius: 14px 4px 14px 14px;
}

.kinova-cb-bubble__heading {
  display: block;
  font-weight: 800;
  color: #0c2340;
  margin-bottom: 4px;
  font-size: 14px;
}

.kinova-cb-bubble__note {
  margin-top: 6px;
  font-size: 12.5px;
  color: #475569;
}

.kinova-cb-meta {
  font-size: 11px;
  color: #64748b;
  margin-top: 4px;
  padding: 0 2px;
}

.kinova-cb-msg--user .kinova-cb-meta {
  text-align: right;
}

/* Inline Answer CTAs */
.kinova-cb-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.kinova-cb-cta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none !important;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.kinova-cb-cta:hover {
  transform: translateY(-1px);
  filter: brightness(0.95);
}

.kinova-cb-cta--primary {
  background: #0755a5;
  color: #ffffff !important;
}

.kinova-cb-cta--secondary {
  background: #eff6ff;
  color: #0755a5 !important;
  border: 1px solid #bfdbfe;
}

.kinova-cb-cta--whatsapp {
  background: #16a34a;
  color: #ffffff !important;
}

.kinova-cb-cta--call {
  background: #0c2340;
  color: #ffffff !important;
}

/* Suggested / Quick Reply Chips */
.kinova-cb-suggestions {
  margin-top: 4px;
}

.kinova-cb-suggestions__label {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  margin: 0 0 6px;
}

.kinova-cb-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.kinova-cb-chip {
  background: #ffffff;
  color: #0755a5;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.kinova-cb-chip:hover {
  background: #eff6ff;
  border-color: #0755a5;
}

/* Typing Indicator */
.kinova-cb-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid #d9e6ee;
  border-radius: 4px 14px 14px 14px;
  align-self: flex-start;
}

.kinova-cb-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #64748b;
  animation: kinovaCbBounce 1s infinite ease-in-out;
}

.kinova-cb-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.kinova-cb-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

/* Footer Assistance & Question Composer */
.kinova-cb-footer {
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  padding: 10px 12px 10px;
  flex-shrink: 0;
}

.kinova-cb-handoff-label {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 800;
  color: #0c2340;
}

.kinova-cb-handoff-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.kinova-cb-handoff-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none !important;
  color: #ffffff !important;
  transition: filter 0.15s ease;
}

.kinova-cb-handoff-btn:hover {
  filter: brightness(0.93);
}

.kinova-cb-handoff-btn--wa {
  background: #16a34a;
}

.kinova-cb-handoff-btn--call {
  background: #0c2340;
}

.kinova-cb-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kinova-cb-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  color: #0f172a;
  font-size: 14px;
  font-family: inherit;
}

.kinova-cb-input::placeholder {
  color: #64748b;
}

.kinova-cb-send {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: none;
  background: #0755a5;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 0.15s ease;
  padding: 0;
}

.kinova-cb-send:hover {
  background: #0c2340;
}

.kinova-cb-disclaimer {
  margin: 6px 0 0;
  font-size: 11px;
  color: #64748b;
  text-align: center;
}

/* Mobile Responsive Overrides */
@media (max-width: 600px) {
  #kinova-chatbot-root {
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }

  .kinova-cb-fab {
    width: 52px;
    height: 52px;
  }

  .kinova-cb-teaser {
    bottom: 64px;
    width: min(268px, calc(100vw - 28px));
    padding: 14px 14px 12px;
  }

  .kinova-cb-window {
    left: 10px;
    right: 10px;
    width: auto;
    max-width: none;
    bottom: calc(74px + env(safe-area-inset-bottom, 0px));
    height: min(560px, calc(var(--kinova-vvh, 100dvh) - 92px));
    border-radius: 14px;
  }

  .kinova-cb-input {
    font-size: 16px;
  }
}

@media (max-width: 350px) {
  .kinova-cb-handoff-btn {
    font-size: 12px;
    padding: 8px 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .kinova-cb-teaser,
  .kinova-cb-window,
  .kinova-cb-msg,
  .kinova-cb-typing span {
    animation: none !important;
    transition: none !important;
  }
}

@keyframes kinovaCbPopIn {
  from { transform: translateY(8px) scale(0.98); }
  to { transform: translateY(0) scale(1); }
}

@keyframes kinovaCbFadeIn {
  from { transform: translateY(4px); }
  to { transform: translateY(0); }
}

@keyframes kinovaCbBounce {
  0%, 80%, 100% { transform: scale(0.75); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

