/* Abadis Sales & Academy AI Assistant — clean, mobile-first visitor widget */
.abadis-chat {
  --ac-teal: #066163;
  --ac-teal-2: #0e7475;
  --ac-ink: var(--ink, #0a2e32);
  --ac-ink-2: var(--ink-2, #2f4e51);
  --ac-muted: var(--muted, #4e686b);
  --ac-bg: var(--surface, #ffffff);
  --ac-bg-2: var(--bg-2, #e8f3f3);
  --ac-line: var(--line, rgba(6, 97, 99, .16));
  --ac-deep: #043e40;
  font-family: Kalameh, Vazirmatn, "Segoe UI", Tahoma, sans-serif;
  color: var(--ac-ink);
  line-height: 1.68;
}

.abadis-chat-launcher {
  position: fixed;
  z-index: 95;
  inset-inline-end: 20px;
  bottom: 20px;
  width: 58px;
  height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid rgba(255, 255, 255, .28);
  border-radius: 50%;
  padding: 0;
  background: linear-gradient(135deg, #066163, #0e7475);
  color: #f3fafa;
  font: inherit;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(4, 40, 42, .34);
  transition: transform .2s ease, box-shadow .2s ease;
  -webkit-tap-highlight-color: transparent;
}
.abadis-chat-launcher:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 16px 38px rgba(4, 40, 42, .44);
}
.abadis-chat-launcher svg {
  width: 27px;
  height: 27px;
  display: block;
  flex-shrink: 0;
}
.abadis-chat-launcher-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.abadis-chat-dot {
  position: absolute;
  top: 3px;
  inset-inline-end: 3px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #f3fafa;
  border: 2px solid #066163;
  box-shadow: 0 0 0 2px rgba(243, 250, 250, .45);
}

/* Hide floating launcher when chat panel is open */
.abadis-chat.is-open .abadis-chat-launcher {
  display: none;
}

.abadis-chat-panel {
  position: fixed;
  z-index: 210;
  inset-inline-end: 20px;
  bottom: 20px;
  width: min(410px, calc(100vw - 24px));
  height: min(650px, calc(100dvh - 40px));
  display: flex;
  flex-direction: column;
  background: var(--ac-bg);
  color: var(--ac-ink);
  border: 1px solid var(--ac-line);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 22px 56px rgba(4, 40, 42, .28);
}
.abadis-chat-panel[hidden] {
  display: none !important;
}

.abadis-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #043e40, #066163);
  color: #f3fafa;
  flex-shrink: 0;
}
.abadis-chat-head > div:first-child {
  flex: 1;
  min-width: 0;
}
.abadis-chat-head h2 {
  margin: 0;
  font-size: .98rem;
  font-weight: 800;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.abadis-chat-head p {
  margin: 2px 0 0;
  font-size: .75rem;
  opacity: .86;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.abadis-chat-langs,
.abadis-chat-tabs {
  display: flex;
  gap: 4px;
}
.abadis-chat-langs button,
.abadis-chat-iconbtn,
.abadis-chat-tabs button,
.abadis-chat-chip,
.abadis-chat-choice,
.abadis-chat-send {
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.abadis-chat-langs button {
  border: 1px solid rgba(255,255,255,.24);
  background: rgba(255,255,255,.08);
  color: inherit;
  border-radius: 999px;
  min-width: 32px;
  height: 28px;
  padding: 0 7px;
  font-weight: 800;
  font-size: .72rem;
}
.abadis-chat-langs button[aria-pressed="true"] {
  background: #fff;
  color: var(--ac-deep);
  border-color: #fff;
}
.abadis-chat-iconbtn {
  border: 1px solid rgba(255,255,255,.28);
  background: rgba(255,255,255,.12);
  color: #fff;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}

.abadis-chat-tabs {
  padding: 6px 10px;
  background: var(--ac-bg-2);
  border-bottom: 1px solid var(--ac-line);
  flex-shrink: 0;
}
.abadis-chat-tabs button {
  flex: 1;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ac-ink-2);
  border-radius: 10px;
  padding: 6px 8px;
  font-weight: 800;
  font-size: .82rem;
  transition: background .15s ease, color .15s ease;
}
.abadis-chat-tabs button[aria-selected="true"] {
  background: var(--ac-bg);
  color: var(--ac-teal);
  border-color: var(--ac-line);
  box-shadow: 0 2px 6px rgba(4, 40, 42, .06);
}

.abadis-chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--ac-bg);
}
.abadis-chat-msg {
  max-width: 88%;
  padding: 11px 14px;
  border-radius: 18px;
  font-size: .92rem;
  line-height: 1.72;
  word-wrap: break-word;
}
.abadis-chat-msg strong { font-weight: 800; color: var(--ac-teal); }
.abadis-chat-msg--user strong { color: #fff; }
.abadis-chat-msg--bot {
  align-self: flex-start;
  background: var(--ac-bg-2);
  border-end-start-radius: 4px;
}
.abadis-chat-msg--user {
  align-self: flex-end;
  background: var(--ac-teal);
  color: #f3fafa;
  border-end-end-radius: 4px;
}
.abadis-chat-msg a {
  color: inherit;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.abadis-chat-msg--bot a { color: var(--ac-teal); }
.abadis-chat-src {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--ac-line);
  font-size: .78rem;
}

/* Single horizontal scrollable rail for suggestions — never stacks into multiple messy rows */
.abadis-chat-choices,
.abadis-chat-chips {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 7px;
  padding: 7px 12px;
  background: var(--ac-bg);
  border-top: 1px solid rgba(6, 97, 99, .08);
  flex-shrink: 0;
}
.abadis-chat-choices::-webkit-scrollbar,
.abadis-chat-chips::-webkit-scrollbar {
  display: none;
}
.abadis-chat-choices:empty,
.abadis-chat-chips:empty {
  display: none;
}
/* Never show both bars stacked: if choices has buttons, hide the secondary chips bar */
.abadis-chat-choices:not(:empty) + .abadis-chat-chips {
  display: none;
}

.abadis-chat-chip,
.abadis-chat-choice {
  flex: 0 0 auto;
  white-space: nowrap;
  border: 1px solid var(--ac-line);
  background: var(--ac-bg);
  color: var(--ac-ink);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: .81rem;
  font-weight: 700;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.abadis-chat-choice {
  background: rgba(6, 97, 99, .08);
  border-color: rgba(6, 97, 99, .28);
  color: var(--ac-teal);
}
.abadis-chat-chip:hover,
.abadis-chat-choice:hover {
  border-color: var(--ac-teal);
  background: var(--ac-teal);
  color: #fff;
}

/* Comfortable, ergonomic typing bar */
.abadis-chat-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--ac-line);
  background: var(--ac-bg);
  flex-shrink: 0;
}
.abadis-chat-form textarea,
.abadis-chat-form input {
  flex: 1;
  min-width: 0;
  min-height: 46px;
  max-height: 112px;
  border: 1.5px solid var(--ac-line);
  border-radius: 16px;
  padding: 11px 14px;
  font: inherit;
  font-size: 16px; /* >=16px prevents iOS Safari forced zoom on focus */
  line-height: 1.45;
  color: var(--ac-ink);
  background: var(--ac-bg-2);
  outline: none;
  resize: none;
  overflow-y: auto;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.abadis-chat-form textarea:focus,
.abadis-chat-form input:focus {
  border-color: var(--ac-teal);
  background: var(--ac-bg);
  box-shadow: 0 0 0 3px rgba(6, 97, 99, .14);
}
.abadis-chat-send {
  border: 0;
  border-radius: 16px;
  min-height: 46px;
  padding: 0 18px;
  background: var(--ac-teal);
  color: #fff;
  font-weight: 800;
  font-size: .92rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.abadis-chat-send:hover { background: var(--ac-teal-2); }

.abadis-chat.is-docked .abadis-chat-launcher { display: none; }
.abadis-chat.is-docked .abadis-chat-panel {
  position: relative;
  inset: auto;
  width: 100%;
  height: min(680px, calc(100vh - 160px));
  bottom: auto;
}

html[data-theme="dark"] .abadis-chat-panel,
html[data-theme="noir"] .abadis-chat-panel {
  box-shadow: 0 22px 56px rgba(0,0,0,.55);
}
html[data-theme="dark"] .abadis-chat-msg strong,
html[data-theme="noir"] .abadis-chat-msg strong,
html[data-theme="dark"] .abadis-chat-msg--bot a,
html[data-theme="noir"] .abadis-chat-msg--bot a,
html[data-theme="dark"] .abadis-chat-choice,
html[data-theme="noir"] .abadis-chat-choice {
  color: #9eceb4;
}

/* Mobile-specific clean full-sheet experience (iOS Chrome & Safari keyboard-safe) */
@media (max-width: 640px) {
  html.abadis-chat-lock,
  html.abadis-chat-lock body {
    overflow: hidden !important;
    overscroll-behavior: none;
  }
  .abadis-chat-launcher {
    inset-inline-end: 14px;
    bottom: 16px;
    width: 56px;
    height: 56px;
    padding: 0;
  }
  .abadis-chat-panel {
    position: fixed;
    top: var(--ac-vvt, 0px);
    bottom: auto;
    left: 0;
    right: 0;
    width: 100%;
    height: var(--ac-vvh, 100dvh);
    max-height: var(--ac-vvh, 100dvh);
    border-radius: 0;
    border: 0;
    transform: translateZ(0);
  }
  .abadis-chat-head {
    flex-wrap: wrap;
    padding: 12px 14px;
  }
  .abadis-chat-langs {
    display: flex;
    flex-wrap: wrap;
    flex: 1 1 auto;
  }
  .abadis-chat-iconbtn {
    width: 40px;
    height: 40px;
    font-size: 1.4rem;
  }
  /* When user focuses input to type on mobile, hide suggestion rail and tighten chrome so keyboard + chat log have full room */
  .abadis-chat.is-typing .abadis-chat-choices,
  .abadis-chat.is-typing .abadis-chat-chips {
    display: none;
  }
  .abadis-chat.is-typing .abadis-chat-tabs {
    padding: 4px 10px;
  }
  .abadis-chat.is-typing .abadis-chat-form {
    padding-bottom: 8px;
  }
}

body:has(.consent-bar:not([hidden])) .abadis-chat-launcher {
  bottom: 82px;
}

.abadis-chat-typing {
  opacity: .75;
  font-style: italic;
}

/* AB-59: quick-start buttons stacked under the sales welcome */
.abadis-chat-start {
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  max-width: 88%;
}
.abadis-chat-start .abadis-chat-start-btn {
  white-space: normal;
  text-align: start;
  line-height: 1.5;
  cursor: pointer;
}
