/* chat.css - Premium Wellness AI Chat Widget */
.ai-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: 'Outfit', 'Inter', -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Floating Launch Button */
.ai-chat-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #25D366, #128C7E);
  color: #fff;
  border: none;
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.ai-chat-btn:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 10px 28px rgba(37, 211, 102, 0.5);
}
.ai-chat-btn svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}

/* Chat Window Container */
.ai-chat-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 360px;
  height: 520px;
  max-height: calc(100vh - 120px);
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.95);
  transform-origin: bottom right;
  transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
  border: 1px solid rgba(0,0,0,0.04);
}
.ai-chat-window.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Header with Gradient */
.ai-chat-header {
  background: linear-gradient(135deg, #075E54, #128C7E);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.ai-chat-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.2px;
}
.ai-chat-title-icon {
  width: 34px;
  height: 34px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
/* Live Status Pulse Dot */
.ai-chat-title-icon::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background: #4caf50;
  border: 2px solid #131211;
  border-radius: 50%;
  box-shadow: 0 0 8px #4caf50;
}
.ai-chat-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  opacity: 0.6;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
}
.ai-chat-close:hover { opacity: 1; }

/* Chat Body (Conversation Thread) */
.ai-chat-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: #fbfaf7;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

/* Custom Sleek Scrollbar */
.ai-chat-body::-webkit-scrollbar {
  width: 5px;
}
.ai-chat-body::-webkit-scrollbar-track {
  background: transparent;
}
.ai-chat-body::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.1);
  border-radius: 10px;
}

/* Chat Messages */
.ai-message {
  max-width: 82%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.92rem;
  line-height: 1.45;
  word-wrap: break-word;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.ai-message--ai {
  background: #ffffff;
  color: #22201e;
  border: 1px solid rgba(0,0,0,0.05);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.ai-message--user {
  background: linear-gradient(135deg, #dd8b6e, #cc785c);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  box-shadow: 0 3px 10px rgba(204, 120, 92, 0.15);
}

/* Interactive Action Buttons (Options) */
.ai-btn-option {
  display: inline-block;
  margin: 6px 6px 0 0;
  padding: 8px 14px;
  background: #ffffff;
  border: 1px solid rgba(204, 120, 92, 0.2);
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 500;
  color: #cc785c;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.03);
}
.ai-btn-option:hover {
  background: #cc785c;
  color: #ffffff;
  border-color: #cc785c;
  box-shadow: 0 4px 8px rgba(204, 120, 92, 0.25);
  transform: translateY(-1px);
}

/* Interactive Dropdown Option */
.ai-select-option {
  display: block;
  width: 100%;
  max-width: 250px;
  margin: 8px 0 0 0;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid rgba(204, 120, 92, 0.3);
  border-radius: 12px;
  font-size: 0.85rem;
  color: #22201e;
  cursor: pointer;
  outline: none;
  font-family: inherit;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23cc785c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
}
.ai-select-option:hover, .ai-select-option:focus {
  border-color: #cc785c;
  box-shadow: 0 4px 12px rgba(204, 120, 92, 0.15);
}

/* Interactive Booking Form Container */
#aiBookingForm {
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.06);
  padding: 16px;
  border-radius: 12px;
  margin-top: 10px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.04);
}
#aiBookingForm b {
  font-size: 0.95rem;
  color: #22201e;
}
.ai-input {
  width: 100%;
  padding: 10px 12px;
  margin: 6px 0 10px 0;
  border: 1px solid #e0dfdb;
  border-radius: 8px;
  box-sizing: border-box;
  font-size: 0.85rem;
  outline: none;
  font-family: inherit;
  transition: all 0.2s;
}
.ai-input:focus {
  border-color: #cc785c;
  box-shadow: 0 0 0 3px rgba(204, 120, 92, 0.15);
}
.ai-btn-submit {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #dd8b6e, #cc785c);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s;
  box-shadow: 0 4px 10px rgba(204, 120, 92, 0.25);
}
.ai-btn-submit:hover {
  background: linear-gradient(135deg, #e39377, #d98265);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(204, 120, 92, 0.35);
}
.ai-btn-submit:disabled {
  background: #ccc;
  box-shadow: none;
  cursor: not-allowed;
}

/* Typing Indicator Animation */
.ai-typing span {
  display: inline-block;
  font-style: italic;
  color: #888;
}

/* Input text area at the bottom */
.ai-chat-input-area {
  padding: 14px 16px;
  background: #ffffff;
  border-top: 1px solid rgba(0,0,0,0.06);
  display: flex;
  gap: 10px;
  align-items: center;
}
.ai-chat-input {
  flex: 1;
  border: 1px solid #e0dfdb;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 0.92rem;
  outline: none;
  font-family: inherit;
  transition: all 0.2s;
  background: #fafaf9;
}
.ai-chat-input:focus {
  background: #ffffff;
  border-color: #cc785c;
  box-shadow: 0 0 0 3px rgba(204, 120, 92, 0.1);
}
.ai-chat-send {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #dd8b6e, #cc785c);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: 0 3px 8px rgba(204, 120, 92, 0.2);
}
.ai-chat-send:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(204, 120, 92, 0.3);
}
.ai-chat-send svg { width: 18px; height: 18px; fill: currentColor; }

/* Settings Header & Dropdown */
.ai-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ai-chat-settings-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  opacity: 0.6;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s, transform 0.2s;
}
.ai-chat-settings-btn:hover {
  opacity: 1;
  transform: rotate(45deg);
}
.ai-chat-settings-menu {
  position: absolute;
  top: 60px;
  right: 20px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  padding: 14px;
  width: 220px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px);
  transition: all 0.25s cubic-bezier(0.165, 0.84, 0.44, 1);
  border: 1px solid rgba(0,0,0,0.05);
  z-index: 100;
}
.ai-chat-settings-menu.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.ai-chat-settings-info {
  font-size: 0.85rem;
  color: #555;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}
.ai-chat-settings-label {
  font-weight: 600;
  color: #222;
  margin-bottom: 6px;
  font-size: 0.9rem;
}
.ai-chat-settings-value {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}
.ai-chat-btn-clear {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}
.ai-chat-btn-clear:hover {
  background: #fecaca;
}
.ai-chat-window.is-open ~ .ai-chat-btn {
  display: none !important;
}

@media (max-width: 480px) {
  .ai-chat-widget {
    bottom: 80px; /* Geser ke atas agar tidak menabrak tab menu mobile footer */
    right: 16px;
  }
  .ai-chat-window {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    border-radius: 0;
    box-shadow: none;
    z-index: 99999;
  }
  .ai-chat-header, .ai-chat-input-area {
    flex-shrink: 0; /* Kunci agar tidak menyusut / tenggelam saat keyboard qwerty muncul */
  }
}
