/* File: ai-chat.css */

/* ─────────────────────────────────────────────
   Container + panel
   ───────────────────────────────────────────── */

#ai-chat-container {
  position: fixed;
  /* Sit ABOVE the trigger bubble instead of overlapping it */
  bottom: 80px;                /* 50px bubble height + ~10–15px gap */
  right: 20px;

  width: 360px;
  max-width: calc(100% - 40px);

  /* Auto height: grow with content until max-height, then body scrolls */
  height: auto;
  /* Ensure top never leaves the viewport */
  max-height: calc(100vh - 120px);

  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  z-index: 9998;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.ai-chat-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  /* Critical when used inside a fixed/max-height container */
  min-height: 0;
}

/* Intro section at the top: white text on blue */
.ai-chat-header {
  display: flex;
  align-items: center;
  background-color: #0073aa; /* your blue */
  color: #ffffff;
  padding: 8px 12px; /* slightly tighter to reduce gap */
}

.ai-chat-back {
  border: none;
  background: transparent;
  color: #ffffff;
  font-size: 18px;
  margin-right: 8px;
  cursor: pointer;
}

.ai-chat-header-text {
  flex: 1;
}

.ai-chat-header-title {
  margin: 0 0 2px;
  font-size: 15px;
  font-weight: 700;
}

.ai-chat-header-subtitle {
  margin: 0;
  font-size: 13px;
  opacity: 0.95;
}

/* Body is the scrollable area */
.ai-chat-body {
  flex: 1;
  min-height: 0;                /* CRITICAL for flexbox scrolling */
  padding: 6px 10px 10px;
  background: #f7f7f7;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Box is also flex column: messages + quick options + input row */
#ai-chat-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;                /* allow inner content to scroll */
}

.ai-chat-messages {
  margin-bottom: 6px;
}

/* optional: keep if you like thin scrollbar inside body instead of browser default */
.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: 1001;
  color: #ffffff; /* white on blue header */
}

/* ─────────────────────────────────────────────
   Messages
   ───────────────────────────────────────────── */

.ai-response,
.ai-response.greeting {
  background-color: #d7e5ff;    /* lighter, softer blue */
  padding: 8px 10px;
  margin: 4px 0;
  border: 1px solid #7a9fe0;
  border-radius: 8px;
  max-width: 80%;
  text-align: left;
  margin-right: auto;
  clear: both;
  font-size: 14px;
  color: #111111;               /* darker text for readability */
}

.ai-response.greeting {
  font-size: 14px;
  margin-top: 6px;
}

.ai-response.greeting p {
  margin: 0;
}

.ai-response a {
  color: #003366 !important;
  font-weight: 600;
  text-decoration: underline;
}
.ai-response a:hover {
  color: #0056b3;
}

.user-message {
  background-color: #f9f9f9;
  padding: 8px 10px;
  margin: 4px 0;
  border: 1px solid #ddd;
  border-radius: 8px;
  color: #333;
  font-size: 14px;
  max-width: 80%;
  text-align: right;
  margin-left: auto;
  clear: both;
}

/* Force darker AI/user text regardless of theme styles */
.ai-response,
.ai-response p {
  color: #111111 !important;
  font-weight: 600;
}

.user-message,
.user-message p {
  color: #111111 !important;
  font-weight: 600;
}

/* ─────────────────────────────────────────────
   Quick options → “menu button” style
   ───────────────────────────────────────────── */

.quick-options {
  margin-top: 6px; /* reduced gap between header and first button */
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Normal: black text on white background.
   Hover: white text on blue background. */
.quick-options button.quick-option,
#continue-button.quick-option,
#ai-chat-booking-button.quick-option {
  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,
#continue-button.quick-option:hover,
#ai-chat-booking-button.quick-option:hover {
  background-color: #0073aa;
  color: #ffffff;
  box-shadow: 0 3px 8px rgba(0, 115, 170, 0.35);
  transform: translateY(-1px);
}

/* ─────────────────────────────────────────────
   Input row
   ───────────────────────────────────────────── */

.ai-chat-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.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;
}
