body {
  position: relative;
  z-index: 0;
}

html, body {
  background: transparent !important;
  background-color: transparent !important;
}

:root {
  color-scheme: transparent;
  /* Main backgrounds */
  --bg: #ffffff;          /* Right side background = white */
  --panel: #ffffff;
  --panel-soft: #0f172a;  /* AI message box = dark blue */

  /* Borders */
  --line: #d1d5db;

  /* Text */
  --text: #ffffff;
  --muted: #ffffff;

  /* Accent colors */
  --accent: #dc2626;       /* Red AI icon background */
  --accent-strong: #b91c1c;

  /* Chat bubbles */
  --user: #dc2626;
  --bot: #0f172a;          /* Dark blue AI bubble */

  /* Shadow */
  --shadow: 0 20px 60px rgba(0,0,0,0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}


button,
textarea {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px;
  background: #1f5ea8;
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark,
.avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 34px;
  flex: 0 0 38px;
  border-radius: 8px;
  color: white;
  background: #dc2626;
  font-weight: 700;
}

.brand h1,
.chat-header h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: 0;
  color: white;
}
.chat-header h2 {
  color: black;
  margin: 0;
  font-size: 17px;
}
.brand p,
.chat-header p {
  margin: 4px 0 0;
  color: #cbd5e1;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.secondary-button,
.composer button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease;
}

.secondary-button {
  width: 100%;
  padding: 12px 14px;
  background: #ffffff;
  color: rgb(0, 0, 0);
  border: 1px solid #ffffff;
  font-weight: 600;
}

.secondary-button:hover,
.composer button:hover {
  transform: translateY(-1px);
}

.chat-panel {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  min-width: 0;
  min-height: 100vh;
  background: var(--panel);
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 26px;
  border-bottom: 1px solid var(--line);

  position: sticky;
  top: 0;
  z-index: 1000;
  background: white;
}

.status-badge {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(33, 195, 122, 0.12);
  color: #75e0ad;
  font-size: 12px;
  white-space: nowrap;
}

.messages {
  overflow-y: auto;
  padding: 28px;
  scroll-behavior: smooth;
}

.message {
  display: flex !important;
  align-items: flex-start !important;
  gap: 12px;
  width: 100%;
  margin-bottom: 18px;
}

.message.user {
  justify-content: flex-end;
}

.message.user .avatar {
  order: 2;
  background: var(--user);
  color: #ffffff;
}

.bubble {
  max-width: 75%;
  padding: 13px 15px;
  border-radius: 8px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: var(--shadow);
}

.bot .bubble {
    background: #1f5ea8;
    color: white !important;
    border: 1px solid #1e3a5f;
}

.bot .bubble * {
    color: white !important;
}

.user .bubble {
  background: #1f5ea8;
  color: white;
}

.sources-box {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.28);
}

.sources-title {
  font-weight: 800;
  margin-bottom: 6px;
}

.sources {
  margin: 0;
  padding-left: 22px;
  display: grid;
  gap: 6px;
}

.sources li {
  padding-left: 2px;
}

.sources a:hover {
  color: #991b1b;
  text-decoration: underline;
}

.bot .bubble strong {
  font-weight: 900;
}

.typing {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 900px;
  width: calc(100% - 56px);
  margin: 0 auto 14px;
  min-height: 46px;
}

.orbit-loader {
  position: relative;
  width: 30px;
  height: 18px;
  flex: 0 0 auto;
}

.orbit-dot {
  position: absolute;
  top: -42px;
  left: 50%;
  width: 10px;
  height: 10px;
  margin: -3.5px;
  border-radius: 50%;
  background: #ff0000;
  box-shadow: 0 0 6px rgb(168, 31, 31);
  will-change: transform, opacity;
}

.orbit-dot--a {
  z-index: 2;
  animation: orbitA 1.8s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

.orbit-dot--b {
  z-index: 1;
  animation: orbitB 1.8s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

@keyframes orbitA {
  0%   { transform: translate(11px, 0)  scale(1);    opacity: 1;    }
  25%  { transform: translate(0, -5px)  scale(0.55); opacity: 0.45; }
  50%  { transform: translate(-11px, 0) scale(1);    opacity: 1;    }
  75%  { transform: translate(0, 5px)   scale(0.55); opacity: 0.45; }
  100% { transform: translate(11px, 0)  scale(1);    opacity: 1;    }
}

@keyframes orbitB {
  0%   { transform: translate(-11px, 0) scale(0.55); opacity: 0.45; }
  25%  { transform: translate(0, -5px)  scale(1);    opacity: 1;    }
  50%  { transform: translate(11px, 0)  scale(0.55); opacity: 0.45; }
  75%  { transform: translate(0, 5px)   scale(1);    opacity: 1;    }
  100% { transform: translate(-11px, 0) scale(0.55); opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
  .orbit-dot--a, .orbit-dot--b { animation-duration: 3.2s; }
}

/* If you want it to initially be hidden, don't use .hidden in HTML, 
   use JS to toggle this class instead */
.chat-widget .typing.is-hidden {
  display: none !important;
}
.hidden {
  display: none;
}

.composer {
  display: grid;
  grid-template-columns: auto auto auto auto 1fr auto;
  gap: 12px;
  max-width: 900px;
  width: calc(100% - 56px);
  margin: 0 auto 24px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: visible;
}

.composer textarea {
  width: 100%;
  max-height: 180px;
  resize: none;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  line-height: 1.45;
  padding: 9px 4px;
  bottom: 6px;
  left: 0px;
  font-size: 14.8px;
}
.composer textarea::placeholder {
  color: #1f5ea8;
  font-weight: 500;
}

.composer button {
  align-self: end;
  min-width: 68px;
  min-height: 36px;
  padding: 0 16px;
  background: #dc2626;
  color: white;
  font-weight: 800;
  bottom: 6px;
  right: -10px;
}

.composer button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.bot .bubble a {
    color: #8FD3FF !important;
    text-decoration: underline;
}

.bot .bubble a:hover {
    color: #ffffff !important;
}

.book-btn {
    background: white;
    color: #dc2626;
    border: 2px solid #dc2626;
    border-radius: 8px;
    padding: 10px 18px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
}

.book-btn:hover {
    background: #dc2626;
    color: white;
}


.message-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

.action-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    transition: 0.2s;
}

.action-btn:hover {
    transform: scale(1.15);
}

.icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 22px;
    padding: 8px;
    color: white;
    transition: 0.2s;
    bottom: 15px;
}

.composer .icon-btn {
    min-width: 42px;
    width: 42px;
    padding: 0;
}

.icon-btn:hover {
    transform: scale(1.1);
}

.icon-btn.listening {
    background: white;
    color: #dc2626;
    border-radius: 8px;
}


.emoji-picker {
    position: fixed !important; 
    bottom: 110px !important; 
    left: 50px !important;
    z-index: 999999 !important; 
}

.hidden {
    display: none;
}

#messageInput {
    width: 100%;
}

.thumbs-up:hover {
    color: limegreen;
}

.thumbs-down:hover {
    color: red;
}

.regenerate:hover {
    color: gold;
}

.copy-btn:hover {
    color: deepskyblue;
}


.composer .icon-btn {
  background: #ffffff;
  color: white;
}


@media (max-width: 780px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    padding: 14px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .chat-panel {
    min-height: calc(100vh - 118px);
  }

  .chat-header {
    padding: 14px 16px;
    align-items: flex-start;
  }

  .messages {
    padding: 18px 14px;
  }

  .message {
    gap: 9px;
  }

  .bubble {
    max-width: calc(100vw - 90px);
  }

  .composer,
  .typing {
    width: calc(100% - 28px);
  }
}


/* Floating chatbot widget layout */
body {
  min-height: 100vh;
  background: transparent;
}

.chat-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 99998;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 112px;
  min-height: 56px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: #dc2626;
  color: #ffffff;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  font-weight: 800;
  transition: transform 180ms ease, opacity 180ms ease, visibility 180ms ease;
}

.chat-launcher:hover {
  transform: translateY(-2px);
}



.launcher-icon {
  font-size: 22px;
  line-height: 1;
}

.chat-widget {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 99990;
  width: min(450px, calc(100vw - 32px));
  height: min(650px, calc(100vh - 32px)) !important;
  max-height: min(515px, calc(100vh - 32px)) !important;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
  overflow: hidden !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(18px) scale(0.97);
  transition: opacity 180ms ease, visibility 180ms ease, transform 180ms ease, width 180ms ease, height 180ms ease, right 180ms ease, bottom 180ms ease;
}

.chat-widget.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.chat-widget.is-expanded {
  right: 50%;
  bottom: 50%;
  transform: translate(50%, 50%);
  width: min(820px, calc(100vw - 48px));
  height: min(760px, calc(100vh - 48px)) !important;
  max-height: min(760px, calc(100vh - 48px)) !important;
  border-radius: 18px;
}

.chat-widget .app-shell {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.chat-widget .sidebar {
  display: none;
}

.chat-widget .chat-panel {
  min-height: 0;
  height: 100%;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  background: #ffffff;
  overflow: hidden;
}



.chat-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.window-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #ffffff;
  color: #111827;
  cursor: pointer;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.window-btn:hover {
  background: #f3f4f6;
}

.window-btn.danger:hover {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
}

.chat-widget .chat-header {
  position: relative;
  top: auto;
  z-index: 2;
  padding: 12px 14px;
}

.chat-widget .chat-header h2 {
  color: #111827;
  white-space: nowrap;
}

.chat-widget .status-badge {
  color: #15803d;
  background: rgba(21, 128, 61, 0.12);
}

.chat-widget .messages {
  min-height: 0 !important;
  max-height: 100% !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 16px 14px;
}

.chat-widget .message {
    width: 100%;
    max-width: none;
}

.chat-widget .bubble {
  max-width: 75%;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

.chat-widget .typing {
  width: calc(100% - 28px);
  max-width: 100%;
  margin-bottom: 10px;
}

.chat-widget .composer {
  width: calc(100% - 28px);
  max-width: 100%;
  margin-bottom: 4px;
  grid-template-columns: auto auto auto auto minmax(0, 1fr) auto;
}

.chat-widget .composer button {
  min-width: 58px;
}

.chat-widget .composer .icon-btn {
  min-width: 38px;
  width: 38px;
  background: #ffffff;
  color: #dc2626;
}

#emojiPicker {
  position: fixed !important;
  bottom: 90px !important;
  right: 24px !important;
  left: auto !important;
  top: auto !important;
  z-index: 1000000 !important;
  pointer-events: auto;
}


.chat-widget .book-btn {
  padding: 8px 10px;
  font-size: 13px;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .chat-launcher {
    right: 16px;
    bottom: 16px;
  }

  .chat-widget,
  .chat-widget.is-expanded {
    right: 8px;
    bottom: 8px;
    width: calc(100vw - 16px);
    height: calc(100vh - 16px) !important;
    max-height: calc(100vh - 16px) !important;
    transform: translateY(0) scale(1);
    border-radius: 14px;
  }

  .chat-widget.is-expanded {
    transform: none;
  }

  .chat-header-actions {
    gap: 5px;
  }

  .chat-widget .book-btn {
    display: inline-flex !important;
  }

  .window-btn {
    width: 32px;
    height: 32px;
  }

  .chat-widget .composer {
    gap: 7px;
    padding: 9px;
  }

  .chat-widget .composer button {
    min-width: 48px;
    padding: 0 10px;
  }
}


/* Voice conversation mode button */
.icon-btn.talking,
.icon-btn.conversation-active {
  background: #ffffff !important;
  color: #1f5ea8 !important;
  border: 2px solid #dc2626;
  border-radius: 8px;
  animation: talkPulse 1.1s infinite ease-in-out;
}

@keyframes talkPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* === Final fixes: welcome bubble, header, composer, and mobile layout === */
.chat-widget .chat-header {
  min-height: 62px;
  padding: 12px 14px;
  gap: 10px;
}

.chat-widget .chat-title-group {
  flex: 1 1 auto;
  min-width: 0;
}

.chat-widget .status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #075e2e;
  background: #dff7e8;
  padding: 7px 11px;
}

.chat-widget .status-badge::before {
  content: "🟢";
  background: none;
  border: none;
  width: auto;
  height: auto;
}
.chat-widget .chat-header-actions {
  gap: 7px;
}

.chat-widget .window-btn {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
}

.chat-widget .message.bot:first-child {
  align-items: flex-start;
}

.chat-widget .message.bot:first-child .avatar {
  margin-top: 2px;
}

.chat-widget .welcome-bubble {
  width: 245px !important;
  min-height: 50px !important;
  display: flex !important;
  flex-direction: row !important;
  justify-content: center;
  align-items: center;
  gap: 15px;
  text-align: left;
  white-space: normal !important;
  overflow: visible;
}

.chat-widget .welcome-bubble::before,
.chat-widget .welcome-bubble::after {
  content: none !important;
  display: none !important;
}

.chat-widget .robot {
  font-size: 18px;
  margin-top: -5px;
  margin-left: -5px;
  line-height: 1;
}

.chat-widget .welcome-subtitle {
  font-size: 16px;
  font-weight: 450;
  margin-top: -3px;
  margin-left: -10px;
  line-height: 1.3;
}

.chat-widget .composer {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  border-radius: 0 !important;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  grid-template-columns: 42px 42px 42px minmax(0, 1fr) 75px;
  gap: 8px;
  align-items: end;
  
}

.chat-widget .composer .icon-btn {
  width: 35px !important;
  min-width: 35px !important;
  height: 35px !important;
  min-height: 35px !important;
  padding: 0px !important;
  display: grid;
  place-items: center;
  background: #ffffff !important;
  color: #dc2626 !important;
  border-radius: 8px;
  border: 2px solid #1f5ae8;
  font-size: 20px;
  left: -2px;
  bottom: 11px;
}

.chat-widget #messageInput {
  min-width: 0;
  height: 42px;
  max-height: 120px;
  padding: 10px 8px;
  color: #1f5ea8;
  overflow: hidden;
  font-weight: 500;
}

.chat-widget #sendBtn {
  width: 64px;
  min-width: 64px;
  height: 42px;
  min-height: 42px;
  padding: 0;
}

.chat-widget .messages {
  padding: 18px 14px 64px;
  scroll-padding-bottom: 64px;
  scrollbar-gutter: stable;
  overflow-y: scroll;
}

.chat-widget .messages::-webkit-scrollbar {
  width: 6px;
}

.chat-widget .messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-widget .messages::-webkit-scrollbar-thumb {
  background: #1f5ea8;
  border-radius: 999px;
}

.chat-widget .messages::-webkit-scrollbar-thumb:hover {
  background: #dc2626;
}

/* Firefox */
.chat-widget .messages {
  scrollbar-width: thin;
  scrollbar-color: #1f5ea8 transparent;
}

@media (max-width: 520px) {
  .chat-widget .composer {
    grid-template-columns: 38px 38px 38px 38px minmax(0, 1fr) 56px !important;
    gap: 6px;
    padding: 10px 8px;
  }

  .chat-widget .composer .icon-btn {
    width: 38px !important;
    min-width: 38px !important;
    height: 38px !important;
    min-height: 38px !important;
    font-size: 18px;
  }

  .chat-widget #sendBtn {
    width: 56px;
    min-width: 56px;
  }

  .chat-widget .welcome-bubble {
    width: calc(100vw - 140px) !important;
    min-height: 118px !important;
  }
}


/* Upload preview before sending */
.file-preview {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.preview-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 180px;
  min-height: 46px;
  padding: 6px 30px 6px 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.24);
}

.image-preview-item img {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
}

.document-preview-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.18);
}

.preview-file-name {
  font-size: 12px;
  line-height: 1.2;
  max-width: 86px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remove-preview-btn {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 22px !important;
  min-width: 22px !important;
  height: 22px !important;
  min-height: 22px !important;
  padding: 0 !important;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: #dc2626 !important;
  color: #ffffff !important;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.remove-preview-btn:hover {
  transform: scale(1.06);
}

/* Attachments displayed inside sent user messages */
.message-attachments {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.message-attachments:first-child {
  margin-top: 0;
}

.sent-attachment {
  overflow: hidden;
}

.sent-image img {
  display: block;
  max-width: min(260px, 100%);
  max-height: 260px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.sent-document {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.chat-widget .file-preview {
  max-height: 130px;
  overflow-y: auto;
}

.chat-widget .sent-image img {
  max-width: min(220px, 100%);
  max-height: 220px;
}

@media (max-width: 600px) {
  .preview-item {
    max-width: 145px;
  }

  .sent-image img {
    max-width: min(210px, 100%);
    max-height: 210px;
  }
}

.chat-widget .chat-panel {
  display: grid !important;
  grid-template-rows:
      auto
      minmax(0, 1fr)
      auto
      auto
      auto !important;
  overflow: hidden !important;
}

.chat-widget .composer {
  position: relative !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;

  background: #ffffff !important;

  padding: 28px 14px 8px 14px !important; 

  display: grid !important;
  grid-template-columns: 42px 42px 42px minmax(0, 1fr) 75px !important;
  gap: 0px !important;
  align-items: end !important;

  border-radius: 0 0 18px 18px !important;
  border-left: 0 !important;
  border-right: 0 !important;
  border-bottom: 0 !important;

}

.chat-widget .composer::after {
  content: "";
  position: absolute;
  left: 0;
  top: -7px;
  width: 98%;
  height: 100px;
  background: #ffffff !important;
  z-index: 20 !important;
  pointer-events: none;
}

.chat-widget .composer::before {
  content: "";
  position: absolute;
  left: 0;
  top: -40px !important; 
  width: 101%;
  height: 100px;
  background: #1f5ea8 !important;
  -webkit-mask-image: url("/static/drip.png");
  mask-image: url("/static/drip.png");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 200%;
  -webkit-mask-position: center 38%;
  mask-position: center 38%;
  z-index: 50 !important;
  pointer-events: none;
}

.chat-widget .composer > * {
  position: relative;
  z-index: 2;
}

.chat-widget #messageInput {
  color: #1f5ea8 !important;
  background: transparent !important;
}

.chat-widget #messageInput::placeholder {
  color: #1f5ea8 !important;
}

.chat-widget .composer .icon-btn {
  background: #ffffff !important;
  color: #dc2626 !important;
  border: 2px solid #1f5ae8 !important;
}

.chat-widget #sendBtn {
  background: #dc2626 !important;
  color: #ffffff !important;
}
.chat-widget .messages {
  position: relative;
  z-index: 1;
}

.chat-widget .composer {
  position: relative !important;
  z-index: 5 !important;
  border-top: 0 !important;
}


.chat-widget .composer > * {
  position: relative;
  z-index: 30 !important;
}
.chat-widget .file-preview,
.chat-widget .preview-item,
.chat-widget .preview-file-name {
  color: #1f5ea8 !important;
  position: relative !important;
  z-index: 200 !important;
}

.chat-widget .preview-item {
  background: #ffffff !important;
  border: 2px solid #1f5ae8 !important;
}

.chat-widget .remove-preview-btn {
  position: absolute !important;
  z-index: 500 !important;
  background: #dc2626 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
}

.chat-widget .file-preview {
  max-height: 95px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding-top: 6px !important;
  padding-bottom: 6px !important;
}

.chat-widget #messageInput {
  color: #1f5ea8 !important;
  min-height: 42px !important;
  max-height: 90px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  resize: none !important;
  line-height: 1.35 !important;
}

.chat-widget #messageInput::placeholder {
  color: #1f5ea8 !important;
  opacity: 1 !important;
}

.chat-widget .composer > * {
  position: relative !important;
  z-index: 300 !important;
}
.chat-widget .typing {
  position: relative !important;
  z-index: 500 !important;
  margin: 0 auto 10px !important;
}
.chat-branding {
    text-align: center;
    padding: 8px;
    font-size: 11px;
    color: #6b7280;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    position: relative !important;
    z-index: 60 !important;
}

.rhozix-link {
    color: #1f5ea8 !important;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.rhozix-link:hover {
    color: #dc2626 !important;
    text-decoration: underline;
}
.chat-branding a,
.rhozix-link {
    display: inline-block;
    color: #1f5ea8 !important;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer !important;
    pointer-events: auto !important;
}

.chat-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100%;
  min-height: 100vh;
}

.messages {
  overflow-y: auto;
  min-height: 0;
}

.composer {
  position: relative;
  bottom: auto;
  z-index: auto;
}
.chat-widget .composer::before {
    display: block !important;
}
body {
  z-index: 0;
}
.chat-widget {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 99990;
}

.chat-widget .chat-panel {
  display: flex !important;
  flex-direction: column !important;
  position: relative !important;
  height: 100% !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

.chat-widget .chat-header,
.chat-widget .typing,
.chat-widget .composer,
.chat-widget .chat-branding {
  flex: 0 0 auto !important;
}

.chat-widget .chat-header {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
  z-index: 100 !important;
  background: #ffffff !important;
}

.chat-widget .messages {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: auto !important;
  max-height: none !important;
  display: block !important;
  align-content: start !important;
  padding-top: 18px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

.chat-widget .message.bot:first-child {
  margin-top: 0 !important;
}

.lamp,
.display {
  position: relative;
  z-index: 999;
}

.custom-scrollbar,
.scroll-progress,
#scrollProgress,
#customScrollbar,
.progress-bar,
.scroll-indicator {
  position: fixed !important;
  z-index: 99999 !important;
  pointer-events: none;
}
.inspection-modal {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.inspection-box {
  width: min(360px, 92%);
  max-height: min(420px, calc(100% - 24px));
  overflow-y: auto;
  padding: 14px 10px 10px;
  background: #dc1f2a;
  border: 2px solid #1f5ea8;
  border-radius: 0;
  color: #ffffff;
}

.inspection-header {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 10px;
}

.inspection-header h2 {
  margin: 0;
  color: #ffffff;
  font-size: 24px;
  line-height: 1.15;
  font-weight: 900;
  text-align: center;
}

.inspection-box input,
.inspection-box select,
.inspection-box textarea {
  width: 100%;
  margin-bottom: 8px;
  padding: 7px 10px;
  color: #ffffff;
  background: #050505;
  border: 1px solid #ffffff;
  border-radius: 0;
  outline: none;
}

.inspection-box input,
.inspection-box select {
  height: 32px;
}

.inspection-box textarea {
  min-height: 70px;
  max-height: 95px;
  resize: vertical;
}

.inspection-box input::placeholder,
.inspection-box textarea::placeholder {
  color: rgba(255, 255, 255, 0.68);
}

.inspection-box select {
  cursor: pointer;
  font-weight: 700;
}

.inspection-box button {
  display: block;
  width: 84px;
  min-height: 36px;
  margin: 0 auto;
  padding: 0 16px;
  background: #1f5ea8;
  color: #ffffff;
  border: 0;
  border-radius: 0;
  cursor: pointer;
  font-weight: 800;
}

#closeInspection {
  position: absolute;
  right: 2px;
  top: -8px;
  color: #ffffff;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

@media (max-width: 520px) {
  .inspection-modal {
    padding: 14px;
  }

  .inspection-box {
    width: min(360px, 100%);
    padding: 14px 8px 9px;
  }

  .inspection-header h2 {
    font-size: 22px;
  }
}

/* --- 3D GLASS BUTTON BASE --- */
.chat-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 99998 ;
  width: 200px;
  height: 70px;
  border-radius: 50px;
  background: linear-gradient(180deg, #0b2770, #152f6e);
  box-shadow: 0 15px 40px rgba(0, 20, 80, 0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  padding: 0 12px;
  overflow: hidden; /* Keep this tightly on the container */
}

.chat-launcher:hover {
  transform: scale(1.04);
}

/* --- INNER WATER TUBE --- */
.chat-launcher::before {
  content: '';
  position: absolute;
  top: 4px; left: 4px; right: 4px; bottom: 4px;
  border-radius: 46px;
  background: linear-gradient(180deg, 
    #f0f7ff 20%, 
    #b0d7ff 35%, 
    #59aaff 40%, 
    #1a7ce8 60%, 
    #0345a8 100%);
  z-index: 0;
}

/* --- TOP GLASS SHINE --- */
.chat-launcher::after {
  content: '';
  position: absolute;
  top: 8px;
  left: 25px;
  width: 75%;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0) 70%);
  z-index: 10;
  pointer-events: none;
}

/* --- WATER WAVES (Bottom Half) --- */
.water {
  position: absolute;
  left: 4px;
  top: 30px;
  width: calc(100% - 8px);
  height: calc(50% - 4px);
  background: #003bb3; 
  border-radius: 0 0 46px 46px;
  z-index: 1;
  overflow: hidden;
}

/* --- FASTER ANIMATED WAVE LAYERS --- */
.wave-layer {
  position: absolute;
  left: -50%;
  width: 200%;
  height: 100%;
  border-radius: 45%;
  background: linear-gradient(180deg, rgba(255,255,255,0.7) 0%, rgba(0, 100, 255, 0.6) 30%, rgba(0, 60, 200, 0) 60%);
  /* Speed increased to 3s */
  animation: ripple 3s ease-in-out infinite alternate;
}

.wave-layer:nth-child(2) {
  background: linear-gradient(180deg, rgba(150, 200, 255, 0.6) 0%, rgba(0, 80, 200, 0.5) 30%, rgba(0, 50, 180, 0) 60%);
  /* Speed increased to 3.5s */
  animation-duration: 3.5s;
  animation-delay: -1s;
}

/* THE THIN NATURAL WATER LINE */
.wave-layer:nth-child(3) {
  background: rgba(255, 255, 255, 1);
  height: 2px;
  border-radius: 50px;
  top: -2px;
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.6);
  /* Speed increased to 2.5s */
  animation: waterWobble 2.5s ease-in-out infinite alternate;
}

/* Faster Ripple Movement */
@keyframes ripple {
  0% { transform: translateX(0) scaleY(1); }
  50% { transform: translateX(-25%) scaleY(1.2); }
  100% { transform: translateX(0) scaleY(0.9); }
}

/* Faster Water Wobble */
@keyframes waterWobble {
  0% { transform: translateX(-5%) scaleY(1) rotate(-0.5deg); }
  50% { transform: translateX(5%) scaleY(1.8) rotate(0.5deg); }
  100% { transform: translateX(-5%) scaleY(1) rotate(-0.5deg); }
}

/* --- THE SYNCHRONIZED CONTENT MOVEMENT --- */
/* This wrapper moves the Robot and Text exactly with the water! */
.floating-content {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding-top: 0;
  /* Matches the speed of the main wave layer (3s) but slightly offset */
  animation: floatSway 3s ease-in-out infinite alternate;
}

@keyframes floatSway {
  0% { transform: translateX(-5px) translateY(0px) rotate(-1deg); }
  50% { transform: translateX(5px) translateY(-2px) rotate(1deg); }
  100% { transform: translateX(-5px) translateY(0px) rotate(-1deg); }
}

/* --- BOT ICON --- */
.bot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.bot-icon {
  width: 38px;
  height: 32px;
  background: white;
  border-radius: 16px;
  border-color: #1e3a5f;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15), inset 0 2px 5px rgba(255,255,255,0.8);
}

/* Black Inner Face */
.bot-face {
  position: absolute;
  width: 28px;
  height: 24px;
  background: #0b1e3e;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

/* Smiling Eyes */
.bot-eyes {
  display: flex;
  gap: 8px;
}
.bot-eyes span {
  width: 5px;
  height: 5px;
  background: white;
  border-radius: 50%;
  animation: blink 2s infinite;
}

@keyframes blink {
  0%, 45%, 48%, 100% { transform: scaleY(1); }
  46%, 47% { transform: scaleY(0.1); }
}

/* Smiling Mouth */
.bot-mouth {
  width: 8px;
  height: 4px;
  border-bottom: 2px solid white;
  border-radius: 0 0 10px 10px;
  margin-top: -2px;
}

/* The antenna line (Blue) */
.bot-icon::before {
  content: "";
  position: absolute;
  width: 3px;
  height: 8px;
  background: #0b2770; /* <-- Blue */
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
}

/* The antenna ball on top (Blue) */
.bot-icon::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #0b2770; /* <-- Blue */
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 0 8px rgba(11, 39, 112, 0.5);
}

/* Ears (Blue) */
.bot-ears {
  position: absolute;
  width: 100%;
  display: flex;
  justify-content: space-between;
}
.bot-ears::before, .bot-ears::after {
  content: '';
  width: 5px;
  height: 10px;
  background: white;
  border-radius: 3px;
  margin-top: 5px;
  box-shadow: inset -1px 1px 4px rgba(0,0,0,0.2);
}
.bot-ears::before { margin-left: -3px; }
.bot-ears::after { margin-right: -3px; }

/* --- CHAT TEXT --- */
.text {
  color: white;
  font-size: 20px;
  font-weight: 700;
  font-family: sans-serif;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
  letter-spacing: 0.5px;
}

/* --- SHADOW CAUSTICS --- */
.bottom-light {
  position: absolute;
  bottom: 4px;
  left: 15%;
  width: 70%;
  height: 25px;
  background: radial-gradient(ellipse at center, rgba(100, 200, 255, 0.5) 0%, transparent 70%);
  border-radius: 50%;
  z-index: 2;
  animation: shimmer 4s ease-in-out infinite alternate;
}
@keyframes shimmer {
  0% { transform: scaleX(0.8) translateX(-5px); opacity: 0.5; }
  100% { transform: scaleX(1.2) translateX(5px); opacity: 1; }
}

/* 1. Force the AI message container to the left */
.chat-widget .message.bot {
  justify-content: flex-start !important;
}

/* 2. Force the inner text to be left-aligned */
.chat-widget .welcome-bubble,
.chat-widget .bubble {
  text-align: left !important;
}

/* ========================================================== */
/* FORCE THE BUTTON TO FLOAT OUTSIDE AND BELOW THE CHAT       */
/* ========================================================== */

/* 1. Prevent the button from being hidden by JavaScript */
.chat-launcher.is-hidden,
.chat-launcher.is-hidden:hover,
.chat-launcher.is-hidden:active {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: scale(1) !important;
  box-shadow: 0 15px 40px rgba(0, 20, 80, 0.4) !important;
}

/* 2. Force the button to sit OUTSIDE the chat, at the bottom right */
.chat-launcher {
  position: fixed !important;
  right: 24px !important;
  bottom: 10px !important; /* Sits BELOW the chat */
  z-index: 99999 !important; /* Sits ON TOP of everything else on the page */
  
  /* Exact size */
  width: 160px !important;
  height: 70px !important;
  border-radius: 50px !important;
  
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  cursor: pointer !important;
  padding: 0 12px !important;
  
  background: linear-gradient(180deg, #0b2770, #152f6e) !important;
  box-shadow: 0 15px 40px rgba(0, 20, 80, 0.4) !important;
}

/* 3. Force the chat to sit ABOVE the button */
.chat-widget,
.chat-widget.is-open,
.chat-widget.is-expanded {
  position: fixed !important;
  right: 24px !important;
  bottom: 90px !important; /* Pushes it UP so the button sits below it */
  z-index: 99990 !important;
}

/* FIX THE CLICK EFFECT SO IT DOESN'T MOVE THE BUTTON CONTENTS */
.launcher-ripple {
  position: absolute !important;
  z-index: 5 !important; /* Sits on top of the layout */
  pointer-events: none !important;
}


/* ========================================================== */
/* PERFECT MOBILE LAYOUT (FINAL POLISH)                       */
/* ========================================================== */

@media (max-width: 768px) {

  /* --- 1. FIX THE HEADER (Bring back "Online" & Spacing) --- */
  .chat-widget .chat-header {
    padding: 10px 12px !important;
    gap: 10px !important; 
    flex-wrap: wrap !important; 
  }
  
  .chat-widget .chat-title-group { gap: 6px !important; }
  .chat-widget .status-badge { font-size: 10px !important; padding: 4px 8px !important; }

  /* --- 2. FIX THE WELCOME MESSAGE (Stop it being huge) --- */
  .chat-widget .welcome-bubble {
    width: 220px !important;
    min-height: 40px !important;
    justify-content: flex-start !important;
    align-items: center !important; 
    padding: 10px 12px !important;
    gap: 10px !important;
    flex-wrap: nowrap !important; 
  }
  .chat-widget .robot { font-size: 16px !important; margin: 0 !important; }
  .chat-widget .welcome-subtitle { font-size: 13px !important; font-weight: 500 !important; margin: 0 !important; white-space: nowrap !important; }

  /* --- 3. FIX ALL OTHER MESSAGE BUBBLES --- */
  .chat-widget .bubble { max-width: 85% !important; padding: 10px 12px !important; font-size: 14px !important; }

  /* --- 4. FIX "BOOK INSPECTION" BUTTON --- */
  .chat-widget .book-btn { 
    display: inline-flex !important; 
    font-size: 10px !important; 
    padding: 4px 10px !important; 
    height: 28px !important; 
    align-items: center !important; 
  }
  /* --- 4.5 NUCLEAR OVERRIDE: MOVE BUTTONS TO THE TOP RIGHT --- */
  
  /* Force the parent container to stick everything to the top */
  .chat-widget .chat-header-actions {
    display: flex !important;
    align-items: flex-start !important;   /* PULLS BUTTONS TO THE TOP! */
    justify-content: flex-end !important;
    gap: 4px !important;
    margin-top: 0px !important;
    margin-left: auto !important; /* CRITICAL: Pushes this group to the far right edge */
    padding-left: 8px !important;
  }

  /* Force the actual window buttons to be tiny and obey flex-start */
  .chat-widget .window-btn,
  .chat-widget .window-btn.danger {
    all: initial !important; /* Resets ALL old styles */
    display: grid !important;
    place-items: center !important;
    width: 26px !important; /* Made slightly smaller for a cleaner fit */
    height: 26px !important;
    min-width: 26px !important;
    min-height: 26px !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    background: #ffffff !important;
    color: #111827 !important;
    border: 1px solid #d1d5db !important;
    border-radius: 5px !important;
    cursor: pointer !important;
    margin-top: 0px !important;
    align-self: flex-start !important; /* Locks them to the top */
    flex-shrink: 0 !important;
  }

  /* Hover colors */
  .chat-widget .window-btn:hover {
    background: #f3f4f6 !important;
  }
  .chat-widget .window-btn.danger:hover {
    background: #dc2626 !important;
    color: #ffffff !important;
    border-color: #dc2626 !important;
  }
  /* --- 5. FIX CHAT WIDGET WINDOW SIZE & POSITION --- */
  .chat-widget, .chat-widget.is-open, .chat-widget.is-expanded {
    right: 8px !important; bottom: 80px !important;
    width: calc(100vw - 16px) !important;
    height: calc(100vh - 100px) !important;
    max-height: none !important; border-radius: 16px !important;
  }

  /* --- 6. FIX THE 3D LAUNCHER BUTTON --- */
  .chat-launcher, .chat-launcher.is-hidden {
    right: 16px !important; bottom: 8px !important;
    width: 140px !important; height: 55px !important;
    transform: scale(1) !important;
  }
  .chat-launcher .text { font-size: 16px !important; }
  .chat-launcher .bot-icon { width: 30px !important; height: 26px !important; }
  .chat-launcher .bot-face { width: 22px !important; height: 18px !important; }

  /* --- 7. FIX THE BOTTOM INPUT BAR (Composer) --- */
  .chat-widget .composer {
    width: 100% !important; max-width: 100% !important;
    padding: 24px 6px 6px 6px !important;
    gap: 6px !important; /* Slightly increased to let the text input breathe */
    grid-template-columns: 28px 28px 28px minmax(0, 1fr) 48px !important;
  }

  /* --- 8. FIX THE BLUE DRIP --- */
  .chat-widget .composer::before {
    width: 100% !important; left: 0 !important; top: -10px !important;
    height: 100px !important;
    -webkit-mask-size: 100% 150% !important; mask-size: 100% 150% !important;
    -webkit-mask-position: center bottom !important; mask-position: center bottom !important;
  }

  /* --- 9. FIX THE SMALL ICONS --- */
  .chat-widget .composer .icon-btn {
    width: 28px !important;
    min-width: 28px !important;
    height: 28px !important;
    min-height: 28px !important;
    font-size: 13px !important; 
    border-radius: 5px !important; 
    border-width: 1.5px !important;
  }

  /* --- 10. FIX THE SEND BUTTON --- */
  .chat-widget #sendBtn {
    width: 48px !important;
    min-width: 48px !important;
    height: 28px !important;
    min-height: 28px !important;
    font-size: 11px !important;
  }

  /* --- 11. FIX THE INPUT BOX (More compact & cleaner) --- */
  .chat-widget #messageInput {
    font-size: 12px !important;
    height: 28px !important; /* REDUCED from 32px to 28px to match icons */
    padding: 0 4px !important; 
    min-height: 28px !important;
    max-height: 60px !important;
    overflow: hidden !important; 
    resize: none !important;
  }
  .chat-widget #messageInput::-webkit-resizer { display: none !important; }

  /* --- 12. FIX THE WATERMARK --- */
  .chat-branding { font-size: 9px !important; padding: 4px 0 !important; }
  /* --- 12. FIX THE WATERMARK --- */
  .chat-branding { font-size: 9px !important; padding: 4px 0 !important; }

  /* --- 13. FIX THE AI AVATAR SIZE --- */
  .message .avatar { width: 24px !important; height: 24px !important; font-size: 11px !important; }
}
/* --- Fix Autofill Colors (Keep them black) --- */

/* 1. Reset the normal state */
.inspection-box input,
.inspection-box select,
.inspection-box textarea {
  width: 100%;
  margin-bottom: 8px;
  padding: 7px 10px;
  color: #ffffff;
  background: #050505 !important; /* Force the black background */
  border: 1px solid #ffffff;
  border-radius: 0;
  outline: none;
}

/* 2. FORCE the autofill state to stay black */
.inspection-box input:-webkit-autofill,
.inspection-box input:-webkit-autofill:hover, 
.inspection-box input:-webkit-autofill:focus, 
.inspection-box input:-webkit-autofill:active{
    -webkit-box-shadow: 0 0 0 30px #050505 inset !important; /* Trick: Draws a massive black shadow inside */
    -webkit-text-fill-color: #ffffff !important; /* Keeps text white */
    caret-color: #ffffff !important;
}

/* --- DESKTOP SIZE LOCK (Keep it visible!) --- */
.talk-btn {
  width: 35px !important;
  min-width: 35px !important;
  height: 35px !important;
  min-height: 35px !important;
  border: 2px solid #1f5ae8 !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease !important;
  display: grid !important;
  place-items: center !important;
  position: relative !important; /* Keeps it in the grid */
}

/* --- PULSE ANIMATION FOR VOICE BUTTON --- */
@keyframes speakPulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.talk-btn.speaking {
  animation: speakPulse 0.8s ease-in-out infinite !important;
  box-shadow: 0 0 20px rgba(220, 38, 38, 0.7) !important;
  transform-origin: center center !important; /* Ensures it scales from the middle */
}
