/* Shared WhatsApp + Ask AI floating actions (works without Tailwind) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-sticky-cta,
.site-floating-actions {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.65rem;
  visibility: hidden;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}

.site-floating-actions.is-visible,
.site-sticky-cta.is-visible {
  visibility: visible !important;
  opacity: 1 !important;
  transform: translateY(0);
  pointer-events: auto !important;
}

.site-floating-actions__btn,
.site-sticky-cta__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.1rem;
  border: 0;
  border-radius: 9999px;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 12px 30px rgba(16, 45, 88, 0.18);
  transition: transform 0.15s ease, filter 0.15s ease, background 0.15s ease;
}

.site-floating-actions__btn svg,
.site-sticky-cta__btn svg,
.site-chat-panel__avatar svg,
.site-chat-panel__close svg,
.site-chat-panel__send svg {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

.site-floating-actions__btn:hover,
.site-sticky-cta__btn:hover {
  transform: translateY(-2px);
}

.site-floating-actions__btn--wa {
  color: #fff;
  background: #25d366;
}

.site-floating-actions__btn--wa:hover {
  filter: brightness(1.05);
}

.site-floating-actions__btn--ai,
.site-sticky-cta__btn--ai {
  color: #fff;
  background: #0b5fc6;
}

.site-floating-actions__btn--ai:hover,
.site-floating-actions__btn--ai.is-open,
.site-sticky-cta__btn--ai:hover,
.site-sticky-cta__btn--ai.is-open {
  background: #084fa7;
}

.site-chat-backdrop {
  position: fixed;
  inset: 0;
  z-index: 85;
  background: rgba(15, 23, 42, 0.28);
}

.site-chat-panel {
  position: fixed;
  right: 1rem;
  bottom: 6.25rem;
  z-index: 90;
  display: flex;
  flex-direction: column;
  width: min(22.5rem, calc(100vw - 2rem));
  height: min(32rem, calc(100vh - 8.5rem));
  overflow: hidden;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 1.25rem;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
  font-family: inherit;
  color: #0f172a;
}

.site-chat-panel[hidden],
.site-chat-backdrop[hidden] {
  display: none !important;
}

.site-chat-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: #0b1b3a;
  color: #fff;
}

.site-chat-panel__identity {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.site-chat-panel__avatar {
  display: flex;
  height: 2.25rem;
  width: 2.25rem;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: #3b82f6;
  color: #fff;
  flex-shrink: 0;
}

.site-chat-panel__title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.2;
}

.site-chat-panel__status {
  margin: 0.1rem 0 0;
  font-size: 0.7rem;
  color: #93c5fd;
}

.site-chat-panel__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2rem;
  width: 2rem;
  border: 0;
  border-radius: 0.55rem;
  background: transparent;
  color: #cbd5e1;
  cursor: pointer;
}

.site-chat-panel__close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.site-chat-panel__messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  background: #f8fafc;
}

.site-chat-msg {
  max-width: 88%;
  padding: 0.7rem 0.85rem;
  border-radius: 1rem;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.site-chat-msg p {
  margin: 0;
}

.site-chat-msg p + p {
  margin-top: 0.4rem;
}

.site-chat-msg a {
  color: #2563eb;
  font-weight: 700;
}

.site-chat-msg--bot {
  align-self: flex-start;
  background: #fff;
  color: #334155;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 0.3rem;
}

.site-chat-msg--user {
  align-self: flex-end;
  background: #2563eb;
  color: #fff;
  border-bottom-right-radius: 0.3rem;
}

.site-chat-msg--typing {
  color: #64748b;
}

.site-chat-panel__form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}

.site-chat-panel__form input {
  flex: 1;
  min-width: 0;
  height: 2.6rem;
  padding: 0 0.85rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.85rem;
  font-size: 0.8125rem;
  font-family: inherit;
  outline: none;
  background: #fff;
  color: #0f172a;
}

.site-chat-panel__form input:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.site-chat-panel__send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.6rem;
  width: 2.6rem;
  flex-shrink: 0;
  border: 0;
  border-radius: 0.85rem;
  color: #fff;
  background: #2563eb;
  cursor: pointer;
}

.site-chat-panel__send:hover {
  background: #1d4ed8;
}

html[dir="rtl"] .site-sticky-cta,
html[dir="rtl"] .site-floating-actions {
  right: auto;
  left: 1rem;
  align-items: flex-start;
}

html[dir="rtl"] .site-chat-panel {
  right: auto;
  left: 1rem;
}

html[data-theme="dark"] .site-chat-panel {
  background: #111827;
  border-color: #334155;
  color: #e2e8f0;
}

html[data-theme="dark"] .site-chat-panel__messages {
  background: #0b1220;
}

html[data-theme="dark"] .site-chat-msg--bot {
  background: #1e293b;
  color: #e2e8f0;
  border-color: #334155;
}

html[data-theme="dark"] .site-chat-panel__form {
  background: #111827;
  border-color: #334155;
}

html[data-theme="dark"] .site-chat-panel__form input {
  background: #0b1220;
  border-color: #334155;
  color: #f8fafc;
}

@media (max-width: 1023px) {
  .site-sticky-cta,
  .site-floating-actions {
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    flex-direction: row;
    align-items: stretch;
    justify-content: stretch;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem calc(0.65rem + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.97);
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -10px 28px rgba(15, 23, 42, 0.12);
    backdrop-filter: blur(10px);
    transform: translateY(110%);
  }

  .site-floating-actions.is-visible,
  .site-sticky-cta.is-visible {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: translateY(0) !important;
    pointer-events: auto !important;
  }

  .site-floating-actions__btn,
  .site-sticky-cta__btn {
    flex: 1 1 0;
    justify-content: center;
    min-height: 2.85rem;
    padding: 0.75rem 0.65rem;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .site-chat-panel {
    right: 0.75rem;
    left: 0.75rem;
    bottom: calc(5.1rem + env(safe-area-inset-bottom, 0px));
    width: auto;
    height: min(32rem, calc(100dvh - 9rem - env(safe-area-inset-bottom, 0px)));
    z-index: 101;
  }

  .site-chat-backdrop {
    z-index: 99;
  }

  html[dir="rtl"] .site-sticky-cta,
  html[dir="rtl"] .site-floating-actions,
  html[dir="rtl"] .site-chat-panel {
    left: 0;
    right: 0;
  }

  html[data-theme="dark"] .site-sticky-cta,
  html[data-theme="dark"] .site-floating-actions {
    background: rgba(15, 23, 42, 0.96);
    border-color: #334155;
  }

  body.atlas-menu-open .site-sticky-cta,
  body.atlas-menu-open .site-floating-actions,
  body.mobile-nav-open .site-sticky-cta,
  body.mobile-nav-open .site-floating-actions,
  body.mobile-nav-open .site-chat-panel,
  body.mobile-nav-open .site-chat-backdrop,
  body:has(.mobile-nav-drawer.is-open) .site-sticky-cta,
  body:has(.mobile-nav-drawer.is-open) .site-floating-actions,
  body:has(.mobile-nav-drawer.is-open) .site-chat-panel,
  body:has(.mobile-nav-drawer.is-open) .site-chat-backdrop {
    display: none !important;
  }
}

/* Site search dialog */
.site-search-dialog {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: start center;
  padding: 5rem 1rem 1rem;
}

.site-search-dialog[hidden] {
  display: none !important;
}

.site-search-dialog__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
}

.site-search-dialog__panel {
  position: relative;
  width: min(100%, 34rem);
  border-radius: 1rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
  overflow: hidden;
}

.site-search-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #f1f5f9;
}

.site-search-dialog__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
}

.site-search-dialog__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 0.55rem;
  background: transparent;
  color: #64748b;
  cursor: pointer;
}

.site-search-dialog__close:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.site-search-dialog__close svg {
  width: 1.25rem;
  height: 1.25rem;
}

.site-search-dialog__input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #f1f5f9;
  padding: 0.9rem 1rem;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  background: #fff;
  color: #0f172a;
}

.site-search-dialog__results {
  list-style: none;
  margin: 0;
  max-height: 18rem;
  overflow: auto;
  padding: 0.35rem;
}

.site-search-result {
  display: block;
  padding: 0.65rem 0.75rem;
  border-radius: 0.65rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
  text-decoration: none;
}

.site-search-result:hover {
  background: #eff6ff;
  color: #1d4ed8;
}

.site-search-result--empty {
  color: #64748b;
  font-weight: 500;
  padding: 0.65rem 0.75rem;
}

html[data-theme="dark"] .site-search-dialog__panel {
  background: #111827;
  border-color: #334155;
}

html[data-theme="dark"] .site-search-dialog__header {
  border-color: #1e293b;
}

html[data-theme="dark"] .site-search-dialog__title,
html[data-theme="dark"] .site-search-result {
  color: #e2e8f0;
}

html[data-theme="dark"] .site-search-dialog__close {
  color: #94a3b8;
}

html[data-theme="dark"] .site-search-dialog__close:hover {
  background: #1e293b;
  color: #f8fafc;
}

html[data-theme="dark"] .site-search-dialog__input {
  background: #111827;
  border-color: #1e293b;
  color: #f8fafc;
}

html[data-theme="dark"] .site-search-result:hover {
  background: #1e293b;
  color: #93c5fd;
}

html[data-theme="dark"] .site-search-result--empty {
  color: #94a3b8;
}
