/* File: ai-chat.css */

/* ─────────────────────────────────────────────
   Container + panel
   ───────────────────────────────────────────── */

#ai-chat-container {
  position: fixed;
  bottom: 80px;                /* 50px bubble height + gap */
  right: 20px;
  width: 400px;
  max-width: calc(100% - 40px);

  /* Auto height: grow with content until max-height, then body scrolls */
  height: auto;
  max-height: calc(100vh - 120px); /* ensure top never leaves viewport */

  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  z-index: 10000;
  overflow: hidden;
  display: none;               /* hidden by default; JS toggles .is-open */
  flex-direction: column;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Show container only when wrapper is "open" */
#ai-chat-wrapper.is-open #ai-chat-container {
  display: flex;
}

.ai-chat-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* Intro section at the top: white text on blue */
.ai-chat-header {
  display: flex;
  align-items: center;
  background-color: #0073aa;
  color: #ffffff;
  padding: 8px 12px;
}

/* Header back arrow (SVG) */
.ai-chat-back {
  border: none;
  background: transparent;
  padding: 0 8px 0 0;
  cursor: pointer;
  display: flex;
  align-items: center;
}

/* Reusable SVG back icon */
.ai-chat-back-icon {
  width: 22px;
  height: 22px;
  fill: #ffffff; /* white in header */
  stroke: none;
}

/* Inline back button in contact form */
.ai-chat-back-btn {
  border: none;
  background: transparent;
  padding: 0;
  font-size: 14px;
  cursor: pointer;
  color: #555;
  display: flex;
  align-items: center;
}

.ai-chat-back-btn .ai-chat-back-icon {
  width: 18px;
  height: 18px;
  fill: #555;   /* darker gray inside the form */
  margin-right: 4px;
}

.ai-chat-back-label {
  line-height: 1;
}

.ai-chat-header-text {
  flex: 1;
}

.ai-chat-header-title {
  margin: 0 0 2px;
  font-size: 15px;
  font-weight: 700;
  color: #FFFFFF !important;
}

.ai-chat-header-subtitle {
  margin: 0;
  font-size: 13px;
  opacity: 0.95;
  color: #FFFFFF !important;
}

/* Body is the scrollable area */
.ai-chat-body {
  flex: 1;
  min-height: 0;
  padding: 6px 10px 10px;
  background: #f7f7f7;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Box is flex column: messages live here */
#ai-chat-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.ai-chat-messages {
  margin-bottom: 6px;
}

/* Scrollbar tweaks */
.ai-chat-body::-webkit-scrollbar {
  width: 6px;
}
.ai-chat-body {
  scrollbar-width: thin;
}

/* Close button – sits over the blue header */
.chat-close-button {
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  z-index: 10001;
  color: #ffffff;
}

/* ─────────────────────────────────────────────
   Messages (new system)
   ───────────────────────────────────────────── */

.ai-chat-msg {
  margin: 4px 0;
  max-width: 80%;
  display: flex;
  clear: both;
}

/* AI bubble */
.ai-chat-msg-ai {
  margin-right: auto;
}

.ai-chat-msg-ai .ai-chat-msg-inner {
  background-color: #d7e5ff;
  border: 1px solid #7a9fe0;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  color: #00008B; /* BLUE text */
  font-weight: 600;
}

/* User bubble */
.ai-chat-msg-user {
  margin-left: auto;
  text-align: right;
}

.ai-chat-msg-user .ai-chat-msg-inner {
  background-color: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  color: #000; /* BLACK text */
  font-weight: 600;
}

/* Links inside AI messages */
.ai-chat-msg-ai a {
  color: #0047a3 !important;
  text-decoration: underline;
  font-weight: 600;
}

.ai-chat-msg-ai a:hover {
  color: #0056cc;
}

/* ─────────────────────────────────────────────
   Quick options
   ───────────────────────────────────────────── */

/* Use either .quick-options or #ai-chat-quick-row as container */
.quick-options,
#ai-chat-quick-row {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Buttons inside quick row */
.quick-options button.quick-option,
#ai-chat-quick-row button.quick-option,
#continue-button.quick-option,
#ai-chat-booking-button.quick-option,
.ai-chat-topic-btn,
.ai-chat-zoom-topic-btn {
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  font-size: 14px;
  border-radius: 12px;
  border: 1px solid #0073aa;
  background-color: #ffffff;
  color: #111111;
  cursor: pointer;
  font-weight: 500;
  transition:
    background-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.05s ease;
}

.quick-options button.quick-option:hover,
#ai-chat-quick-row button.quick-option:hover,
#continue-button.quick-option:hover,
#ai-chat-booking-button.quick-option:hover,
.ai-chat-topic-btn:hover,
.ai-chat-zoom-topic-btn:hover {
  background-color: #0073aa;
  color: #ffffff;
  box-shadow: 0 3px 8px rgba(0, 115, 170, 0.35);
  transform: translateY(-1px);
}

.ai-chat-topic-buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

/* ─────────────────────────────────────────────
   Input row (footer)
   ───────────────────────────────────────────── */

.ai-chat-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px 10px;
  border-top: 1px solid #ddd;
  background: #ffffff;
}

.ai-chat-input,
#ai-chat-input {
  flex: 1;
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 8px;
  color: #111;
  font-weight: 500;
  background-color: #ffffff;
}

.ai-chat-send,
#ai-chat-send {
  padding: 8px 14px;
  font-size: 14px;
  background-color: #0073aa;
  border: none;
  color: #ffffff;
  cursor: pointer;
  border-radius: 999px;
  font-weight: 600;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.ai-chat-send:hover,
#ai-chat-send:hover {
  background-color: #005f8a;
  box-shadow: 0 3px 8px rgba(0, 95, 138, 0.35);
}

/* ─────────────────────────────────────────────
   Floating trigger button
   ───────────────────────────────────────────── */

#ai-chat-icon {
  position: fixed;
  bottom: 20px;
  right: 20px;
  min-width: 140px;
  height: 50px;
  background-color: #0073aa;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9999;
  box-shadow: 0 0 10px 2px rgba(0, 0, 0, 0.25);
  border-radius: 50px;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

#ai-chat-icon:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.chat-icon-text {
  margin-left: 8px;
  font-size: 14px;
}

/* Manager assistance (if you still use it) */

.manager-assistance {
  background-color: #f9f9f9;
  border: 1px solid #ddd;
  padding: 10px;
  margin: 10px 0;
  border-radius: 8px;
  font-size: 14px;
  color: #333;
}

.manager-assistance button.request-manager {
  padding: 8px 16px;
  font-size: 14px;
  background-color: #0073aa;
  border: none;
  color: #ffffff;
  cursor: pointer;
  border-radius: 8px;
  margin-top: 5px;
}

/* ─────────────────────────────────────────────
   Booking overlay (Fluent Booking in a modal)
   ───────────────────────────────────────────── */

.ai-chat-booking-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.55);
  z-index: 10010;
  display: none;
  align-items: center;
  justify-content: center;
}

.ai-chat-booking-inner {
  background: #ffffff;
  width: 95%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 12px;
  padding: 20px;
  position: relative;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

/* Close button in overlay */
.ai-chat-booking-close {
  position: absolute;
  top: 10px;
  right: 15px;
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

/* Start / booking buttons */
.ai-chat-button-wrapper {
  margin: 10px 0;
  text-align: left;
}

.ai-chat-start-btn,
.ai-chat-booking-btn {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  background: var(--ll-blue, #1e73be);
  color: #fff;
}

.ai-chat-start-btn:hover,
.ai-chat-booking-btn:hover {
  opacity: 0.9;
}

/* Contact form tweaks */
.ai-chat-contact-form {
  margin-top: 10px;
  padding: 10px;
  border-radius: 8px;
  background: #f7f7f7;
}

.ai-chat-form-header-row {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 6px;
}

.ai-chat-contact-submit {
  margin-top: 10px;
  padding: 8px 14px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  background: var(--ll-blue, #1e73be);
  color: #fff;
}

/* Simple fade-in when new HTML is appended */
.ai-chat-fade-in {
  animation: aiChatFadeIn 0.15s ease-out;
}

@keyframes aiChatFadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: translateY(0); }
}
