/* chat + header search dropdown - @tom aug 2026 */

#site-search-input::-webkit-search-cancel-button,
#site-search-input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

.ui-searchDropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: #fff;
  border: 1px solid #dde3ea;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 4px 10px -6px rgba(0, 0, 0, 0.1);
  max-height: 320px;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
  z-index: 120;
}

.ui-searchDropdown.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.ui-searchGroup {
  padding: 0.75rem 0;
}

.ui-searchLabel {
  margin: 0 1rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #4a5568;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ui-searchGroup ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ui-searchItem {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 0.625rem 1rem;
  border: none;
  background: transparent;
  font: inherit;
  cursor: pointer;
  color: #1a2332;
}

.ui-searchItem:hover,
.ui-searchItem:focus-visible {
  background: #eef2f6;
}

.ui-searchItem span {
  font-size: 0.75rem;
  color: #4a5568;
}

.ui-searchEmpty p {
  margin: 0 1rem 0.5rem;
  font-size: 0.875rem;
  color: #4a5568;
}

.search-bar .container {
  position: relative;
}

/* ---- chat widget ---- */

.rw-chatRoot {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 450;
  font-family: inherit;
}

.rw-chatToggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: #0d6e4f;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 2px 6px -2px rgba(0, 0, 0, 0.12);
  transition: transform 0.2s ease, background 0.2s;
}

.rw-chatToggle:hover {
  background: #094d38;
  transform: scale(1.04);
}

.rw-chatPanel {
  position: absolute;
  right: 0;
  bottom: 68px;
  width: 340px;
  max-width: calc(100vw - 24px);
  height: 440px;
  max-height: calc(100vh - 100px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 8px 16px -8px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.98);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
  overflow: hidden;
}

.rw-chatPanel.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.rw-chatHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1rem;
  background: #1a2332;
  color: #fff;
}

.rw-chatHeader h2 {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
}

.rw-chatClose {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}

.rw-chatMessages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: #f7f9fb;
}

.rw-chatMsg {
  display: flex;
  margin-bottom: 0.75rem;
}

.rw-chatMsg--user {
  justify-content: flex-end;
}

.rw-chatMsg--bot {
  justify-content: flex-start;
}

.rw-chatBubble {
  max-width: 85%;
  padding: 0.625rem 0.875rem;
  border-radius: 12px;
  font-size: 0.875rem;
  line-height: 1.45;
}

.rw-chatMsg--user .rw-chatBubble {
  background: #0d6e4f;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.rw-chatMsg--bot .rw-chatBubble {
  background: #fff;
  color: #1a2332;
  border: 1px solid #dde3ea;
  border-bottom-left-radius: 4px;
}

.rw-chatLinks {
  margin-top: 0.375rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-width: 85%;
}

.rw-chatLinks a {
  font-size: 0.8125rem;
  color: #0d6e4f;
  text-decoration: underline;
}

.rw-chatForm {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid #eef2f6;
  background: #fff;
}

.rw-chatForm input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid #c5cdd6;
  border-radius: 8px;
  font: inherit;
}

.rw-chatForm button {
  padding: 0.5rem 0.875rem;
  background: #0d6e4f;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

.rw-chatTyping .rw-chatBubble {
  display: flex;
  gap: 4px;
  padding: 0.75rem;
}

.rw-chatTyping span {
  width: 7px;
  height: 7px;
  background: #c5cdd6;
  border-radius: 50%;
  animation: rwDot 1.2s infinite ease-in-out;
}

.rw-chatTyping span:nth-child(2) { animation-delay: 0.15s; }
.rw-chatTyping span:nth-child(3) { animation-delay: 0.3s; }

@keyframes rwDot {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1); }
}

@media (max-width: 480px) {
  .rw-chatPanel {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
    bottom: 0;
  }

  .rw-chatRoot {
    right: 12px;
    bottom: 12px;
  }
}
