/* ==========================================================
   CHIRAAYU AYURVEDA - AI CHATBOT STYLING
   ========================================================== */

/* FAB Trigger Button for AI Chatbot */
.fab-ai-chat {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--brand-indigo) 100%);
  position: relative;
  border: none;
  outline: none;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(222, 84, 39, 0.35);
  animation: aiPulse 2.6s infinite;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fab-ai-chat:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 24px rgba(222, 84, 39, 0.45);
}

.fab-ai-chat i.ai-icon-main {
  font-size: 22px;
  color: #FFFFFF;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fab-ai-chat:hover i.ai-icon-main {
  transform: rotate(15deg) scale(1.1);
}

.fab-ai-chat .fab-sparkle {
  position: absolute;
  top: -2px;
  right: -2px;
  font-size: 13px;
  color: #FFD54F;
  animation: sparkleRotate 3s infinite linear;
}

@keyframes sparkleRotate {
  0% {
    transform: scale(0.9) rotate(0deg);
  }

  50% {
    transform: scale(1.2) rotate(180deg);
  }

  100% {
    transform: scale(0.9) rotate(360deg);
  }
}

@keyframes aiPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(222, 84, 39, 0.45);
  }

  70% {
    box-shadow: 0 0 0 14px rgba(222, 84, 39, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(222, 84, 39, 0);
  }
}

/* Teaser Prompt Bubble beside AI FAB */
.ai-fab-teaser {
  position: absolute;
  right: 62px;
  bottom: 6px;
  background: #FFFFFF;
  color: var(--text-dark);
  padding: 8px 14px;
  border-radius: 20px 20px 4px 20px;
  box-shadow: 0 8px 24px rgba(39, 25, 77, 0.15);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(222, 84, 39, 0.2);
  cursor: pointer;
  animation: teaserBounce 4s ease-in-out infinite;
  z-index: 1045;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.ai-fab-teaser.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(10px);
}

.ai-fab-teaser .teaser-sparkle {
  color: var(--primary-color);
  font-size: 14px;
}

.ai-fab-teaser .teaser-close {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 13px;
  margin-left: 4px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.ai-fab-teaser .teaser-close:hover {
  color: var(--primary-color);
}

@keyframes teaserBounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-4px);
  }
}

/* ==========================================================
   AI CHATBOT WINDOW MODAL / CARD
   ========================================================== */
.ai-chat-window {
  position: fixed;
  right: 15px;
  bottom: 15px;
  width: 390px;
  max-width: calc(100vw - 32px);
  height: 590px;
  max-height: calc(100vh - 110px);
  background: #FFFFFF;
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(39, 25, 77, 0.22), 0 4px 16px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1055;
  opacity: 0;
  pointer-events: none;
  transform: translateY(24px) scale(0.94);
  transform-origin: bottom right;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid rgba(39, 25, 77, 0.08);
  overscroll-behavior: contain;
}

.ai-chat-window.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Chat Header */
.ai-chat-header {
  background: linear-gradient(135deg, var(--brand-indigo) 0%, #351f68 60%, var(--primary-color) 100%);
  color: #FFFFFF;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  box-shadow: 0 4px 14px rgba(39, 25, 77, 0.12);
}

.ai-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-avatar-badge {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  border: 2px solid rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #FFD54F;
  flex-shrink: 0;
}

.ai-avatar-badge img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.ai-status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #25D366;
  border: 2px solid var(--brand-indigo);
}

.ai-title-wrap h4 {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
}

.ai-title-wrap p {
  font-size: 11.5px;
  margin: 2px 0 0;
  color: rgba(255, 255, 255, 0.82);
  display: flex;
  align-items: center;
  gap: 4px;
}

.ai-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-hdr-btn {
  background: rgba(255, 255, 255, 0.14);
  border: none;
  color: #FFFFFF;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ai-hdr-btn:hover {
  background: rgba(255, 255, 255, 0.28);
  transform: scale(1.06);
}

/* Chat Body / Message Stream */
.ai-chat-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  background: #F8F9FC;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: #D8D6E5 transparent;
}

/* Custom modern scrollbar */
.ai-chat-body::-webkit-scrollbar {
  width: 5px;
}

.ai-chat-body::-webkit-scrollbar-track {
  background: transparent;
}

.ai-chat-body::-webkit-scrollbar-thumb {
  background: #D8D6E5;
  border-radius: 4px;
}

/* Timestamp badge */
.ai-chat-date {
  text-align: center;
  font-size: 11px;
  color: var(--text-light);
  margin: 4px 0 8px;
  position: relative;
}

.ai-chat-date span {
  background: #ECEBF5;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

/* Messages */
.ai-msg {
  display: flex;
  gap: 10px;
  max-width: 88%;
  animation: msgFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes msgFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.ai-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.ai-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-indigo-light);
  color: var(--brand-indigo);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  border: 1px solid var(--brand-indigo-subtle);
}

.ai-msg.bot .ai-msg-avatar {
  background: #F2EEFB;
  color: var(--brand-indigo);
}

.ai-msg.user .ai-msg-avatar {
  background: var(--primary-light);
  color: var(--primary-color);
}

.ai-msg-bubble {
  padding: 12px 14px;
  border-radius: 18px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-dark);
  position: relative;
  word-break: break-word;
}

.ai-msg.bot .ai-msg-bubble {
  background: #FFFFFF;
  border-radius: 4px 18px 18px 18px;
  box-shadow: 0 2px 10px rgba(39, 25, 77, 0.05);
  border: 1px solid #EAE8F2;
}

.ai-msg.user .ai-msg-bubble {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: #FFFFFF;
  border-radius: 18px 4px 18px 18px;
  box-shadow: 0 4px 14px rgba(222, 84, 39, 0.25);
}

.ai-msg-time {
  font-size: 10px;
  color: var(--text-light);
  margin-top: 4px;
  display: block;
}

.ai-msg.user .ai-msg-time {
  color: rgba(255, 255, 255, 0.7);
  text-align: right;
}

/* Rich content inside bot replies */
.ai-msg-bubble p {
  margin: 0 0 6px;
}

.ai-msg-bubble p:last-child {
  margin-bottom: 0;
}

.ai-msg-bubble ul,
.ai-msg-bubble ol {
  margin: 6px 0;
  padding-left: 18px;
}

.ai-msg-bubble li {
  margin-bottom: 4px;
}

.ai-msg-bubble strong {
  color: var(--brand-indigo);
}

.ai-msg.user .ai-msg-bubble strong {
  color: #FFFFFF;
}

/* In-Chat Action Cards & Buttons */
.ai-card-action-wrap {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ai-chat-btn-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none !important;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
}

.ai-btn-wa {
  background: #25D366;
  color: #FFFFFF !important;
}

.ai-btn-wa:hover {
  background: #1EBE5D;
  transform: translateY(-1px);
}

.ai-btn-apt {
  background: var(--primary-color);
  color: #FFFFFF !important;
}

.ai-btn-apt:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.ai-btn-call {
  background: var(--brand-indigo-light);
  color: var(--brand-indigo) !important;
  border: 1px solid var(--brand-indigo-subtle);
}

.ai-btn-call:hover {
  background: var(--brand-indigo-subtle);
  transform: translateY(-1px);
}

/* In-Chat Interactive Preferred Time Slot Picker */
.ai-slot-picker-wrap {
  margin: 10px 0 6px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.ai-slot-choice-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  background: #FFFFFF;
  border: 1.5px solid #E2E0EC;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 3px rgba(39, 25, 77, 0.04);
}

.ai-slot-choice-btn:hover {
  background: #FFF9F6;
  border-color: var(--primary-color);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(222, 84, 39, 0.12);
}

.ai-slot-choice-btn:active {
  transform: translateY(0);
}

.ai-slot-choice-btn .slot-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(222, 84, 39, 0.08);
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.ai-slot-choice-btn:nth-child(1) .slot-icon {
  background: rgba(236, 160, 39, 0.12);
  color: #D98200;
}

.ai-slot-choice-btn:nth-child(2) .slot-icon {
  background: rgba(222, 84, 39, 0.1);
  color: var(--primary-color);
}

.ai-slot-choice-btn:nth-child(3) .slot-icon {
  background: rgba(39, 25, 77, 0.08);
  color: var(--brand-indigo);
}

.ai-slot-choice-btn .slot-details {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.ai-slot-choice-btn .slot-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--brand-indigo);
  line-height: 1.2;
}

.ai-slot-choice-btn .slot-time {
  font-size: 11.5px;
  color: #6B697B;
  margin-top: 2px;
  font-weight: 500;
}

.ai-slot-choice-btn .slot-badge {
  font-size: 10px;
  font-weight: 700;
  color: #15803D;
  background: #DCFCE7;
  padding: 2px 7px;
  border-radius: 10px;
  letter-spacing: 0.2px;
}

/* Interactive Choice Buttons & Decision Trees */
.ai-choice-group {
  margin: 10px 0 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.ai-choice-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  background: #FFFFFF;
  border: 1.5px solid #DFDCED;
  border-radius: 20px;
  color: var(--brand-indigo);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  line-height: 1.35;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 3px rgba(39, 25, 77, 0.04);
  text-align: left;
  user-select: none;
}

.ai-choice-btn:hover {
  background: #FFF7F3;
  border-color: var(--primary-color);
  color: var(--primary-color);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(222, 84, 39, 0.12);
}

.ai-choice-btn:active {
  transform: translateY(0);
}

.ai-choice-btn.is-danger {
  border-color: #F8D7DA;
  color: #C0392B;
  background: #FFF5F5;
}

.ai-choice-btn.is-danger:hover {
  background: #C0392B;
  color: #FFFFFF;
  border-color: #C0392B;
}

.ai-choice-btn.is-primary {
  background: var(--primary-color);
  color: #FFFFFF;
  border-color: var(--primary-color);
  font-weight: 600;
}

.ai-choice-btn.is-primary:hover {
  background: var(--primary-dark);
}

/* Multi-select symptom list inside message */
.ai-multiselect-wrap {
  margin: 10px 0 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ai-multi-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #FFFFFF;
  border: 1.5px solid #DFDCED;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-dark);
  transition: all 0.2s ease;
  user-select: none;
}

.ai-multi-item:hover {
  background: #F8F7FC;
  border-color: #C4BFD9;
}

.ai-multi-item.is-selected {
  background: #FFF7F3;
  border-color: var(--primary-color);
  color: var(--primary-color);
  font-weight: 600;
}

.ai-multi-item .multi-check {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1.5px solid #C4BFD9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: transparent;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.ai-multi-item.is-selected .multi-check {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #FFFFFF;
}

.ai-multi-confirm-btn {
  margin-top: 6px;
  padding: 8px 16px;
  background: var(--primary-color);
  color: #FFFFFF;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  align-self: flex-start;
}

.ai-multi-confirm-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

/* Typing indicator */
.ai-typing-indicator {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: #FFFFFF;
  border-radius: 4px 16px 16px 16px;
  border: 1px solid #EAE8F2;
  box-shadow: 0 2px 8px rgba(39, 25, 77, 0.04);
  width: fit-content;
}

.ai-typing-dot {
  width: 7px;
  height: 7px;
  background: var(--primary-color);
  border-radius: 50%;
  animation: typingBounce 1.3s infinite ease-in-out;
  opacity: 0.6;
}

.ai-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
  background: var(--accent-gold);
}

.ai-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
  background: var(--brand-indigo);
}

@keyframes typingBounce {

  0%,
  60%,
  100% {
    transform: translateY(0);
  }

  30% {
    transform: translateY(-5px);
  }
}

/* Quick Suggestion Chips Carousel */
.ai-chips-wrap {
  position: relative;
  background: #FFFFFF;
  border-top: 1px solid #F0EFF6;
  display: flex;
  align-items: center;
  padding: 4px 6px;
}

.ai-chips-container {
  padding: 6px 8px 8px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scroll-behavior: smooth;
  cursor: grab;
  flex: 1;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #D6D2E8 #F4F3F9;
}

.ai-chips-container:active {
  cursor: grabbing;
}

/* Elegant slim modern scrollbar for desktop */
.ai-chips-container::-webkit-scrollbar {
  height: 4px;
}

.ai-chips-container::-webkit-scrollbar-track {
  background: #F4F3F9;
  border-radius: 4px;
}

.ai-chips-container::-webkit-scrollbar-thumb {
  background: #CDC8E2;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.ai-chips-container::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color);
}

/* Nav arrows for easy 1-click scrolling */
.ai-chip-nav {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 1px solid #E4E2ED;
  box-shadow: 0 2px 6px rgba(39, 25, 77, 0.12);
  color: var(--brand-indigo);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  cursor: pointer;
  z-index: 2;
  flex-shrink: 0;
  transition: all 0.2s ease;
  padding: 0;
}

.ai-chip-nav:hover {
  background: var(--brand-indigo);
  color: #FFFFFF;
  border-color: var(--brand-indigo);
  transform: scale(1.08);
}

.ai-chip-nav:disabled,
.ai-chip-nav.is-hidden {
  opacity: 0.25;
  pointer-events: none;
}

.ai-chip {
  background: var(--brand-indigo-light);
  color: var(--brand-indigo);
  border: 1px solid var(--brand-indigo-subtle);
  border-radius: var(--radius-pill);
  padding: 6px 13px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  user-select: none;
}

.ai-chip i {
  color: var(--primary-color);
  font-size: 12.5px;
}

.ai-chip:hover {
  background: var(--primary-light);
  color: var(--primary-color);
  border-color: var(--primary-subtle);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(222, 84, 39, 0.15);
}

.ai-chip:active {
  transform: translateY(0) scale(0.98);
}

/* Chat Input Bar */
.ai-chat-input-area {
  padding: 10px 14px 8px;
  background: #FFFFFF;
  border-top: 1px solid #EAE8F2;
}

.ai-input-form {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #F6F5FB;
  border-radius: 28px;
  padding: 4px 6px 4px 14px;
  border: 1.5px solid transparent;
  transition: all 0.2s ease;
}

.ai-input-form:focus-within {
  border-color: var(--primary-color);
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(222, 84, 39, 0.12);
}

.ai-chat-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13.5px;
  color: var(--text-dark);
  font-family: var(--font-body);
  padding: 6px 0;
}

.ai-chat-input::placeholder {
  color: #9D9AA8;
}

.ai-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-gold) 100%);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.ai-send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(222, 84, 39, 0.3);
}

.ai-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Disclaimer Footer */
.ai-disclaimer {
  text-align: center;
  font-size: 10px;
  color: var(--text-light);
  margin-top: 6px;
  line-height: 1.3;
}

/* Mobile Responsiveness */
@media (max-width: 575.98px) {
  .ai-chat-window {
    right: 12px;
    left: 12px;
    bottom: 80px;
    width: auto;
    max-width: none;
    height: calc(100vh - 100px);
    max-height: 560px;
    border-radius: 20px;
  }

  .ai-fab-teaser {
    display: none;
    /* Hide teaser on small mobile screens to keep view uncluttered */
  }

  .ai-msg {
    max-width: 92%;
  }
}