/* ==========================================================================
   Kaizen Health & Wellness — Natural Concierge Chatbot Styles
   Sophisticated, accessible, isolated component styles with organic motion.
   ========================================================================== */

/* 1. Launcher & Proactive Teaser */
#kaizen-faq-launcher-container {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9990;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.kaizen-faq-teaser {
  visibility: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  background: #ffffff;
  color: #07182b;
  padding: 10px 14px 10px 16px;
  border-radius: 16px;
  box-shadow: 0 12px 36px rgba(4, 20, 38, 0.18), 0 2px 8px rgba(4, 20, 38, 0.08);
  border: 1px solid #dce8f4;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 500;
  max-width: 280px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.kaizen-faq-teaser.show {
  visibility: visible;
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.kaizen-faq-teaser span {
  flex: 1;
}
.kaizen-teaser-open {
  margin-left: 6px;
  padding: 2px 0;
  background: transparent;
  color: #806332;
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.kaizen-teaser-open:focus-visible { outline: 2px solid #b89552; outline-offset: 2px; }

#kaizen-faq-teaser-close {
  border: 0;
  background: transparent;
  color: #8c9ba9;
  font-size: 18px;
  line-height: 1;
  padding: 2px 4px;
  cursor: pointer;
  border-radius: 4px;
}
#kaizen-faq-teaser-close:hover {
  color: #07182b;
  background: #edf3fa;
}

#kaizen-faq-launcher {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 999px;
  padding: 12px 20px 12px 14px;
  background: linear-gradient(135deg, #1852cc 0%, #236cff 50%, #35b9ff 100%);
  color: #ffffff;
  font: 700 14px/1.2 "DM Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  box-shadow: 0 10px 30px rgba(35, 108, 255, 0.38), 0 2px 8px rgba(4, 20, 38, 0.15);
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
}

#kaizen-faq-launcher:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 14px 38px rgba(35, 108, 255, 0.48), 0 4px 12px rgba(4, 20, 38, 0.2);
}

#kaizen-faq-launcher:active {
  transform: translateY(0) scale(0.98);
}

.kaizen-launcher-avatar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 50%;
}

.kaizen-online-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 9px;
  height: 9px;
  background: #10b981;
  border: 2px solid #1a56d6;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.8);
}

.kaizen-launcher-text {
  letter-spacing: 0.2px;
}

/* 2. Main Chat Panel */
#kaizen-faq-panel {
  position: fixed;
  right: 24px;
  bottom: 92px;
  z-index: 9991;
  width: min(390px, calc(100vw - 32px));
  height: min(600px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(220, 232, 244, 0.9);
  border-radius: 24px;
  background: #ffffff;
  color: #07182b;
  box-shadow: 0 24px 70px rgba(4, 20, 38, 0.24), 0 4px 16px rgba(4, 20, 38, 0.08);
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

#kaizen-faq-panel.kaizen-faq-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header */
#kaizen-faq-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(135deg, #041426 0%, #071f38 60%, #0a2d52 100%);
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.kaizen-head-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.kaizen-avatar {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1b5cdb, #35b9ff);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(35, 108, 255, 0.3);
}

.kaizen-online-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 10px;
  height: 10px;
  background: #10b981;
  border: 2px solid #071f38;
  border-radius: 50%;
}

#kaizen-faq-head strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

#kaizen-faq-head small {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  color: #a7bed8;
  font-size: 11px;
}

.kaizen-status-pulse {
  width: 6px;
  height: 6px;
  background: #10b981;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 6px #10b981;
}

.kaizen-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.kaizen-head-actions button {
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s, transform 0.15s;
}

.kaizen-head-actions button:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(1.06);
}

/* Messages area */
#kaizen-faq-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #f8fbff;
  scroll-behavior: smooth;
}

.kaizen-faq-time {
  text-align: center;
  font-size: 10px;
  color: #8c9dae;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
  margin: 4px 0;
}

.kaizen-faq-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  animation: kaizenMsgIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.kaizen-faq-row.user {
  justify-content: flex-end;
}

.kaizen-faq-row.bot {
  justify-content: flex-start;
}

.kaizen-bot-icon {
  width: 28px;
  height: 28px;
  background: #e1edf8;
  border: 1px solid #c9deef;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  flex-shrink: 0;
  margin-bottom: 2px;
}

.kaizen-faq-bubble {
  max-width: 84%;
  padding: 12px 15px;
  border-radius: 18px;
  font-size: 13.5px;
  line-height: 1.5;
  box-shadow: 0 2px 8px rgba(7, 24, 43, 0.04);
  word-break: break-word;
}

.kaizen-faq-bot {
  background: #ffffff;
  color: #07182b;
  border: 1px solid #dce8f4;
  border-bottom-left-radius: 4px;
}

.kaizen-faq-user {
  background: linear-gradient(135deg, #1f64f2 0%, #2974ff 100%);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 6px 18px rgba(35, 108, 255, 0.25);
}

.kaizen-faq-list {
  margin: 8px 0 4px 18px;
  padding: 0;
  list-style-type: disc;
}

.kaizen-faq-list li {
  margin-bottom: 5px;
}

/* Typing Indicator Animation */
.kaizen-typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 12px 18px;
  min-height: 42px;
}

.kaizen-dot {
  width: 7px;
  height: 7px;
  background: #236cff;
  border-radius: 50%;
  opacity: 0.4;
  animation: kaizenBounce 1.2s infinite ease-in-out;
}
.kaizen-dot:nth-child(1) { animation-delay: 0s; }
.kaizen-dot:nth-child(2) { animation-delay: 0.2s; }
.kaizen-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes kaizenBounce {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  40% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

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

/* In-Bubble Interactive Action Buttons */
.kaizen-faq-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #eef4fb;
}

.kaizen-action-btn {
  border: 0;
  border-radius: 12px;
  padding: 9px 13px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.kaizen-action-btn:hover {
  transform: translateY(-1px);
}

.kaizen-action-modal {
  background: linear-gradient(100deg, #1a5fe8, #2a72ff);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(35, 108, 255, 0.22);
}
.kaizen-action-modal:hover {
  box-shadow: 0 6px 16px rgba(35, 108, 255, 0.32);
}

.kaizen-action-whatsapp {
  background: #25d366;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.25);
}
.kaizen-action-whatsapp:hover {
  background: #20ba5a;
}

.kaizen-action-tel {
  background: #071f38;
  color: #ffffff;
}

.kaizen-action-scroll {
  background: #edf5fd;
  color: #174b9a;
  border: 1px solid #cfe0f3;
}

/* Suggested Question Chips */
#kaizen-faq-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 14px 10px;
  background: #f8fbff;
  border-top: 1px solid #edf4fb;
  scrollbar-width: none;
}
#kaizen-faq-chips::-webkit-scrollbar {
  display: none;
}

#kaizen-faq-chips button {
  white-space: nowrap;
  border: 1px solid #cbdbee;
  border-radius: 999px;
  padding: 7px 12px;
  background: #ffffff;
  color: #1852b4;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

#kaizen-faq-chips button:hover {
  background: #236cff;
  border-color: #236cff;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(35, 108, 255, 0.2);
}

/* Chat Input Bar */
#kaizen-faq-form {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid #e5eef7;
  background: #ffffff;
}

#kaizen-faq-input {
  min-width: 0;
  flex: 1;
  padding: 11px 14px;
  border: 1px solid #d4e2f0;
  border-radius: 12px;
  color: #07182b;
  background: #f9fcff;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

#kaizen-faq-input:focus {
  border-color: #236cff;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(35, 108, 255, 0.12);
}

#kaizen-faq-form button {
  border: 0;
  border-radius: 12px;
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #1b5cdb, #2872ff);
  color: #ffffff;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s, box-shadow 0.2s;
}

#kaizen-faq-form button:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 14px rgba(35, 108, 255, 0.35);
}

#kaizen-faq-form button:active {
  transform: scale(0.96);
}

#kaizen-faq-note {
  margin: 0;
  padding: 2px 14px 10px;
  background: #ffffff;
  color: #8899aa;
  font-size: 10px;
  text-align: center;
}

/* Focus styles for keyboard accessibility */
#kaizen-faq-launcher:focus-visible,
#kaizen-faq-close:focus-visible,
#kaizen-faq-mute:focus-visible,
#kaizen-faq-reset:focus-visible,
#kaizen-faq-form button:focus-visible,
#kaizen-faq-chips button:focus-visible {
  outline: 3px solid #35b9ff;
  outline-offset: 2px;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  #kaizen-faq-launcher-container {
    right: 14px;
    bottom: 16px;
  }
  #kaizen-faq-panel {
    right: 10px;
    bottom: 80px;
    width: calc(100vw - 20px);
    height: min(580px, calc(100vh - 100px));
    border-radius: 20px;
  }
  .kaizen-faq-teaser {
    max-width: calc(100vw - 36px);
  }
}

#kaizen-faq-launcher-container {
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
}
#kaizen-faq-launcher {
  background: linear-gradient(135deg, #d6b66e 0%, #b38d45 72%, #d7bd80 100%);
  color: #10213b;
  box-shadow: 0 12px 30px rgba(7, 27, 58, .28), 0 2px 8px rgba(4, 20, 38, .14);
}
#kaizen-faq-launcher:hover {
  box-shadow: 0 16px 38px rgba(7, 27, 58, .34), 0 4px 12px rgba(4, 20, 38, .18);
}
.kaizen-launcher-avatar {
  background: rgba(7, 27, 58, .14);
}
.kaizen-online-dot { border-color: #b38d45; }
#kaizen-faq-panel {
  height: min(600px, calc(100dvh - 120px));
  visibility: hidden;
  border-color: rgba(197, 161, 92, .42);
  box-shadow: 0 28px 76px rgba(4, 20, 38, .3), 0 4px 18px rgba(4, 20, 38, .1);
}
#kaizen-faq-panel.kaizen-faq-open {
  visibility: visible;
}
#kaizen-faq-head {
  background:
    radial-gradient(ellipse at 92% 10%, rgba(197, 161, 92, .2), transparent 38%),
    linear-gradient(135deg, #061630 0%, #0b2850 65%, #071b3a 100%);
}
.kaizen-avatar {
  background: linear-gradient(145deg, #d6b66e, #a98542);
  color: #10213b;
  box-shadow: 0 4px 12px rgba(197, 161, 92, .25);
}
.kaizen-online-badge { border-color: #0b2850; }
.kaizen-bot-icon {
  background: #f3ead6;
  border-color: #e6d6b2;
}
.kaizen-faq-user {
  background: linear-gradient(135deg, #0d315f, #071b3a);
  box-shadow: 0 6px 18px rgba(7, 27, 58, .2);
}
.kaizen-dot { background: #b89552; }
.kaizen-action-modal {
  background: linear-gradient(120deg, #d6b66e, #b38d45);
  color: #10213b;
  box-shadow: 0 4px 12px rgba(171, 135, 64, .24);
}
.kaizen-action-modal:hover { box-shadow: 0 6px 16px rgba(171, 135, 64, .34); }
.kaizen-action-tel { background: #0b2850; }
.kaizen-action-scroll { color: #735a2e; background: #f4eedf; border-color: #e4d4ad; }
#kaizen-faq-chips button { color: #735a2e; border-color: #dfd0ad; }
#kaizen-faq-chips button:hover {
  background: #b89552;
  border-color: #b89552;
  color: #10213b;
  box-shadow: 0 3px 8px rgba(171, 135, 64, .22);
}
#kaizen-faq-input:focus { border-color: #b89552; box-shadow: 0 0 0 3px rgba(197, 161, 92, .18); }
#kaizen-faq-form button {
  background: linear-gradient(135deg, #d6b66e, #b38d45);
  color: #10213b;
}
#kaizen-faq-form button:hover { box-shadow: 0 6px 14px rgba(171, 135, 64, .3); }
#kaizen-faq-launcher:focus-visible,
#kaizen-faq-close:focus-visible,
#kaizen-faq-mute:focus-visible,
#kaizen-faq-reset:focus-visible,
#kaizen-faq-form button:focus-visible,
#kaizen-faq-chips button:focus-visible {
  outline: 3px solid #d5b66e;
  outline-offset: 3px;
}
@media (max-width: 480px) {
  #kaizen-faq-panel {
    height: min(580px, calc(100dvh - 100px));
    bottom: max(80px, calc(env(safe-area-inset-bottom) + 64px));
  }
}
@media (prefers-reduced-motion: reduce) {
  #kaizen-faq-panel,
  #kaizen-faq-launcher,
  .kaizen-faq-row,
  .kaizen-dot {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
