/* Scoped widget styles; existing public/owner styles are untouched. */
.visitor-assistant {
  --va-navy: #12355b;
  --va-deep: #0b2745;
  --va-gold: #d6a84b;
  --va-paper: #f7f5ef;
  --va-white: #fffdf8;
  --va-soft: #526b80;
  --va-line: rgba(18, 53, 91, 0.19);
  font-family: "Noto Kufi Arabic", "Noto Sans", sans-serif;
  color: var(--va-deep);
  font-size: 13px;
  line-height: 1.9;
}
.visitor-assistant[hidden],
.visitor-assistant [hidden] {
  display: none !important;
}
.visitor-assistant *,
.visitor-assistant *::before,
.visitor-assistant *::after {
  box-sizing: border-box;
}
.visitor-assistant button,
.visitor-assistant textarea {
  font: inherit;
}
.visitor-assistant button,
.visitor-assistant a {
  -webkit-tap-highlight-color: transparent;
}
.visitor-assistant button {
  cursor: pointer;
}
.visitor-assistant button:disabled {
  cursor: wait;
  opacity: 0.65;
}
.visitor-assistant :focus-visible {
  outline: 3px solid var(--va-gold);
  outline-offset: 3px;
}
.va-launch {
  position: fixed;
  bottom: calc(22px + env(safe-area-inset-bottom));
  left: 22px;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  max-width: 44px;
  padding: 3px;
  border: 1px solid var(--va-gold);
  border-radius: 10px;
  background: var(--va-navy);
  color: var(--va-white);
  box-shadow:
    4px 4px 0 var(--va-gold),
    0 9px 27px rgba(11, 39, 69, 0.18);
  text-align: right;
  font-weight: 800;
  transition:
    transform 0.16s ease,
    background 0.16s ease;
}
.va-launch:hover {
  transform: translateY(-3px);
  background: var(--va-deep);
}
.va-launch small {
  display: block;
  color: #e8e0c9;
  font-size: 10px;
  font-weight: 400;
}
.va-mark {
  position: relative;
  display: block;
  width: 36px;
  height: 36px;
  color: var(--va-gold);
  flex-shrink: 0;
}
.va-logo {
  display: block;
  width: 36px;
  height: 36px;
  border-radius: 7px;
  object-fit: contain;
}
.va-panel {
  position: fixed;
  inset: auto auto calc(22px + env(safe-area-inset-bottom)) 22px;
  width: 420px;
  max-width: calc(100vw - 32px);
  height: min(740px, calc(100dvh - 44px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--va-gold);
  border-radius: 7px;
  background: var(--va-paper);
  color: var(--va-deep);
  box-shadow:
    6px 6px 0 rgba(214, 168, 75, 0.7),
    0 25px 80px rgba(11, 39, 69, 0.3);
  font: inherit;
}
.va-panel[open] {
  display: flex;
  flex-direction: column;
  animation: va-reveal 0.18s ease-out;
}
.va-panel::backdrop {
  background: rgba(11, 39, 69, 0.34);
}
.va-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: var(--va-deep);
  border-bottom: 3px solid var(--va-gold);
  color: var(--va-white);
  flex-shrink: 0;
}
.va-eyebrow {
  display: block;
  color: #e1c078;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.va-header h2 {
  margin: 2px 0 0;
  color: var(--va-white);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.7;
}
.va-close {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(247, 245, 239, 0.3);
  border-radius: 3px;
  background: transparent;
  color: var(--va-white);
  font-size: 26px !important;
  line-height: 1;
}
.va-close:hover {
  background: rgba(255, 255, 255, 0.1);
}
.va-disclosure {
  padding: 12px 18px;
  background: #eee9dc;
  border-bottom: 1px solid var(--va-line);
  flex-shrink: 0;
}
.va-disclosure strong {
  display: block;
  font-size: 11px;
  font-weight: 700;
}
.va-disclosure p {
  margin: 5px 0 0;
  font-size: 10px;
  line-height: 1.9;
  color: #41596d;
}
.va-log {
  flex: 1 1 auto;
  min-height: 80px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 18px 8px;
  scroll-behavior: smooth;
  background-image: linear-gradient(
    rgba(18, 53, 91, 0.025) 1px,
    transparent 1px
  );
  background-size: 100% 28px;
}
.va-welcome {
  margin: 0 0 12px;
  color: var(--va-soft);
  font-size: 11px;
}
.va-message {
  margin: 0 0 14px;
  border: 1px solid var(--va-line);
  border-inline-start: 3px solid var(--va-gold);
  border-radius: 3px;
  padding: 11px 12px;
  background: var(--va-white);
  overflow-wrap: anywhere;
}
.va-message--user {
  margin-inline-start: 28px;
  background: #e6edf2;
  border-inline-start-color: var(--va-navy);
}
.va-message-label {
  display: block;
  color: var(--va-soft);
  font-size: 9px;
}
.va-message p {
  margin: 5px 0 0;
  white-space: pre-wrap;
  font-size: 12px;
  line-height: 2;
  max-width: none;
}
.va-sources-title {
  display: block;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--va-line);
  font-size: 10px;
  font-weight: 800;
}
.va-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
}
.va-sources a {
  display: inline-block;
  padding: 5px 0;
  color: var(--va-navy);
  font-size: 10px;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--va-gold);
}
.va-sources a:hover {
  color: #845d14;
}
.va-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 7px 18px;
  flex-shrink: 0;
}
.va-suggestions button {
  padding: 6px 8px;
  border: 1px solid var(--va-line);
  border-radius: 3px;
  background: var(--va-white);
  color: var(--va-navy);
  font-size: 10px;
  text-align: right;
  line-height: 1.7;
  min-height: 34px;
}
.va-suggestions button:hover {
  border-color: var(--va-gold);
  background: #f4ead2;
}
.va-feedback {
  padding: 0 18px;
  flex-shrink: 0;
}
.va-status {
  margin: 2px 0 6px;
  font-size: 10px;
  color: var(--va-soft);
  line-height: 1.8;
  min-height: 18px;
}
.va-status--error {
  color: #943b2b;
}
.va-retry {
  background: transparent;
  color: var(--va-navy);
  padding: 4px 0 8px;
  border: 0;
  font-size: 11px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  min-height: 36px;
}
.va-form {
  margin: 0;
  padding: 9px 18px 10px;
  border-top: 1px solid var(--va-line);
  background: var(--va-white);
  flex-shrink: 0;
}
.va-input-label {
  display: block;
  margin-bottom: 6px;
  font-size: 10px;
  font-weight: 700;
}
.va-composer {
  display: flex;
  align-items: stretch;
  gap: 7px;
}
.va-composer textarea {
  flex: 1;
  min-width: 0;
  resize: none;
  min-height: 62px;
  max-height: 100px;
  padding: 8px 10px;
  border: 1px solid var(--va-line);
  border-radius: 3px;
  background: var(--va-paper);
  color: var(--va-deep);
  font-size: 12px;
  line-height: 1.8;
}
.va-composer textarea::placeholder {
  color: #617488;
}
.va-send {
  flex-shrink: 0;
  align-self: stretch;
  padding: 9px 11px;
  min-width: 64px;
  border: 1px solid var(--va-navy);
  border-radius: 3px;
  background: var(--va-navy);
  color: var(--va-white);
  font-size: 11px !important;
  font-weight: 700 !important;
}
.va-send:hover {
  background: var(--va-deep);
}
.va-form > small {
  display: block;
  margin-top: 5px;
  font-size: 9px;
  color: var(--va-soft);
}
.va-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 18px;
  border-top: 1px solid var(--va-line);
  flex-shrink: 0;
}
.va-footer a,
.va-clear {
  display: flex;
  align-items: center;
  min-height: 36px;
  border: 0;
  background: transparent;
  padding: 4px 0;
  color: var(--va-navy);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 10px !important;
}
.va-clear {
  color: var(--va-soft);
}
@keyframes va-reveal {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (max-width: 480px) {
  .va-launch {
    left: 14px;
    bottom: calc(15px + env(safe-area-inset-bottom));
    padding: 3px;
    min-height: 44px;
    font-size: 12px;
  }
  .va-launch small {
    font-size: 9px;
  }
  .va-panel {
    left: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    height: calc(100dvh - 28px - env(safe-area-inset-bottom));
    max-height: calc(100dvh - 20px);
  }
  .va-header {
    padding: 12px 14px;
  }
  .va-disclosure {
    padding: 10px 14px;
  }
  .va-log {
    padding: 12px 14px 6px;
  }
  .va-suggestions,
  .va-feedback,
  .va-form,
  .va-footer {
    padding-inline: 14px;
  }
  .va-composer textarea {
    font-size: 16px;
  }
}
@media (max-height: 650px) {
  .va-header {
    padding-block: 9px;
  }
  .va-disclosure {
    padding-block: 7px;
  }
  .va-disclosure p {
    font-size: 9px;
  }
  .va-suggestions {
    display: none;
  }
  .va-form {
    padding-block: 6px;
  }
  .va-form > small {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .va-panel[open] {
    animation: none;
  }
  .va-launch {
    transition: none;
  }
  .va-log {
    scroll-behavior: auto;
  }
}
