/* Chat launcher sits above .social-bar (4em, 5em from 768px) and under #toast (bottom: 130px).
   z-index is above the bar and toast (1) and below the open nav (10000) and Magnific (1042+). */

.ttb-chat-root,
.ttb-chat-root *,
.ttb-chat-root *::before,
.ttb-chat-root *::after {
  box-sizing: border-box;
}

.ttb-chat-launcher {
  position: fixed;
  z-index: 1000;
  right: 12px;
  bottom: calc(4em + 10px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  max-width: calc(100% - 24px);
  height: 44px;
  margin: 0;
  padding: 0 14px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #8a0000;
  color: #fff;
  font-family: "Roboto Condensed", "Arial Narrow", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.ttb-chat-launcher:hover {
  background: #6e0000;
  color: #fff;
}

.ttb-chat-launcher-icon {
  font-size: 1.05rem;
  line-height: 1;
}

.ttb-chat-launcher-label {
  display: inline-block;
}

.ttb-chat-panel {
  position: fixed;
  z-index: 1001;
  right: 12px;
  bottom: calc(4em + 66px);
  display: flex;
  flex-direction: column;
  width: 23.5rem;
  max-width: calc(100% - 24px);
  height: min(32rem, calc(100vh - 10rem));
  height: min(32rem, calc(100dvh - 10rem));
  max-height: calc(100vh - 10rem);
  max-height: calc(100dvh - 10rem);
  overflow: hidden;
  border: 0;
  border-radius: 1.15rem;
  background: #fff;
  color: #1a1a1a;
  font-family: "Roboto Condensed", "Arial Narrow", sans-serif;
  font-size: 1rem;
  line-height: 1.35;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.ttb-chat-panel[hidden] {
  display: none !important;
}

.ttb-chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0;
  padding: 0.75rem 0.65rem 0.75rem 0.9rem;
  background: #8a0000;
  color: #fff;
}

.ttb-chat-title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0.15rem 0 0;
  color: #fff;
  font-family: Righteous, "Roboto Condensed", sans-serif;
  font-size: 1.15rem;
  font-weight: 400;
  font-style: normal;
  line-height: 1.25;
}

.ttb-chat-close {
  flex: 0 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #fff;
  font-family: "Roboto Condensed", sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.ttb-chat-close:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.ttb-chat-notice,
.ttb-chat-privacy {
  margin: 0;
  padding: 0.65rem 0.9rem 0;
  background: #fff4f4;
  color: #1a1a1a;
  font-size: 0.92rem;
  font-weight: 400;
  line-height: 1.35;
}

.ttb-chat-privacy {
  padding-top: 0.35rem;
  padding-bottom: 0.7rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.ttb-chat-log {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: flex-start;
  min-height: 0;
  margin: 0;
  padding: 0.65rem 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #fff;
}

.ttb-chat-msg {
  width: fit-content;
  max-width: 88%;
  margin: 0.35rem 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: 1rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.ttb-chat-msg--user {
  align-self: flex-end;
  border-bottom-right-radius: 0.3rem;
  background: #8a0000;
  color: #fff;
}

.ttb-chat-msg--bot {
  margin-right: auto;
  border-bottom-left-radius: 0.3rem;
  background: #f3f4f6;
  color: #1a1a1a;
}

.ttb-chat-msg-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ttb-chat-msg-text strong {
  font-weight: 700;
}

.ttb-chat-msg-text a,
.ttb-chat-msg-text a:hover,
.ttb-chat-msg-text a:focus {
  color: #083b8a;
  text-decoration: underline;
}

.ttb-chat-msg--user .ttb-chat-msg-text a,
.ttb-chat-msg--user .ttb-chat-msg-text a:hover,
.ttb-chat-msg--user .ttb-chat-msg-text a:focus {
  color: #fff;
  text-decoration: underline;
}

.ttb-chat-typing {
  margin: 0.35rem 0.85rem;
  color: #333;
  font-size: 0.92rem;
  font-style: italic;
}

.ttb-chat-form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0;
  padding: 0.65rem 0.75rem 0.75rem;
  border-top: 1px solid #e4e4e7;
  background: #fff;
}

.ttb-chat-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ttb-chat-input {
  display: block;
  width: 100%;
  min-height: 2.75rem;
  max-height: 7rem;
  margin: 0;
  padding: 0.5rem 0.65rem;
  overflow-x: hidden;
  border: 2px solid #d0d0d4;
  border-radius: 0.75rem;
  background: #fff;
  color: #1a1a1a;
  font-family: "Roboto Condensed", "Arial Narrow", sans-serif;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.35;
  resize: none;
  overflow-wrap: anywhere;
}

.ttb-chat-input::placeholder {
  color: #595959;
  opacity: 1;
}

.ttb-chat-form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.ttb-chat-count {
  color: #333;
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ttb-chat-count--warn {
  color: #9a3412;
}

.ttb-chat-count--limit {
  color: #8a0000;
}

.ttb-chat-send {
  margin: 0;
  padding: 0.5rem 1rem;
  border: 0;
  border-radius: 999px;
  background: #8a0000;
  color: #fff;
  font-family: "Roboto Condensed", "Arial Narrow", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.ttb-chat-send:hover {
  background: #6e0000;
  color: #fff;
}

.ttb-chat-send:disabled {
  background: #e4e4e7;
  color: #52525b;
  cursor: not-allowed;
}

.ttb-chat-launcher:focus-visible,
.ttb-chat-close:focus-visible,
.ttb-chat-send:focus-visible,
.ttb-chat-input:focus-visible,
.ttb-chat-msg-text a:focus-visible {
  outline: 3px solid #111;
  outline-offset: 2px;
  box-shadow: 0 0 0 5px #ffe14a;
}

@media screen and (min-width: 768px) {
  .ttb-chat-launcher {
    bottom: calc(5em + 10px);
  }

  .ttb-chat-panel {
    bottom: calc(5em + 66px);
  }
}

@media screen and (max-width: 575px) {
  .ttb-chat-launcher {
    right: 8px;
    bottom: calc(4em + 8px);
  }

  .ttb-chat-panel {
    top: 8px;
    right: 8px;
    bottom: calc(4em + 8px);
    left: 8px;
    width: auto;
    max-width: none;
    height: auto;
    max-height: calc(100vh - 4em - 16px);
    max-height: calc(100dvh - 4em - 16px);
    border-radius: 1rem;
  }
}

@media screen and (max-width: 359px) {
  .ttb-chat-launcher {
    padding: 0 10px;
    font-size: 0.92rem;
  }
}
