/* Rumble Comms chat FAB — left side so it does not collide with sticky Signal CTA (right) */
.rbs-chat-fab {
  position: fixed;
  left: max(1rem, env(safe-area-inset-left));
  right: auto;
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.65rem;
  font-family: var(--sans, "Outfit", system-ui, sans-serif);
}

.rbs-chat-fab__btn {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 229, 200, 0.45);
  background: #0a1014;
  color: #00e5c8;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-family: var(--mono, "JetBrains Mono", ui-monospace, monospace);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

[data-theme="light"] .rbs-chat-fab__btn {
  background: #f7f9fb;
  color: #0a6b5e;
  border-color: rgba(0, 140, 120, 0.4);
}

.rbs-chat-fab__btn:hover {
  border-color: #00e5c8;
}

.rbs-chat-fab__btn:focus-visible {
  outline: 2px solid #00e5c8;
  outline-offset: 3px;
}

.rbs-chat-fab__panel {
  width: min(22.5rem, calc(100vw - 2rem));
  height: min(28rem, calc(100vh - 6.5rem));
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(0, 229, 200, 0.28);
  background: rgba(6, 10, 14, 0.96);
  color: #e8eef2;
  overflow: hidden;
}

[data-theme="light"] .rbs-chat-fab__panel {
  background: rgba(247, 249, 251, 0.98);
  color: #12161a;
  border-color: rgba(0, 100, 90, 0.25);
}

.rbs-chat-fab__panel[hidden] {
  display: none !important;
}

.rbs-chat-fab__head {
  padding: 0.85rem 1rem 0.7rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .rbs-chat-fab__head {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.rbs-chat-fab__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.rbs-chat-fab__sub {
  margin: 0.25rem 0 0;
  font-size: 0.72rem;
  line-height: 1.4;
  opacity: 0.65;
}

.rbs-chat-fab__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.55rem 0.85rem 0.15rem;
}

.rbs-chat-fab__chip {
  font-family: var(--mono, "JetBrains Mono", ui-monospace, monospace);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.35rem 0.55rem;
  border-radius: 4px;
  border: 1px solid rgba(0, 229, 200, 0.35);
  background: rgba(0, 229, 200, 0.1);
  color: #00e5c8;
  cursor: pointer;
}

.rbs-chat-fab__chip:hover {
  border-color: #00e5c8;
  background: rgba(0, 229, 200, 0.18);
}

.rbs-chat-fab__chip:disabled {
  opacity: 0.45;
  cursor: wait;
}

.rbs-chat-fab__chip--ghost {
  border-color: rgba(255, 255, 255, 0.15);
  background: transparent;
  color: rgba(232, 238, 242, 0.65);
}

[data-theme="light"] .rbs-chat-fab__chip {
  color: #0a6b5e;
  border-color: rgba(0, 140, 120, 0.35);
  background: rgba(0, 140, 120, 0.08);
}

[data-theme="light"] .rbs-chat-fab__chip--ghost {
  border-color: rgba(0, 0, 0, 0.12);
  color: rgba(18, 22, 26, 0.55);
}

.rbs-chat-fab__profile {
  margin: 0;
  padding: 0.15rem 0.85rem 0.45rem;
  font-size: 0.65rem;
  line-height: 1.35;
  opacity: 0.7;
}

.rbs-chat-fab__msgs {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.rbs-chat-fab__bubble {
  max-width: 92%;
  padding: 0.55rem 0.7rem;
  font-size: 0.84rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  border-radius: 14px;
}

.rbs-chat-fab__bubble--bot {
  align-self: flex-start;
  background: rgba(0, 229, 200, 0.08);
  border: 1px solid rgba(0, 229, 200, 0.18);
  white-space: normal;
  border-bottom-left-radius: 5px;
}

[data-theme="light"] .rbs-chat-fab__bubble--bot {
  background: rgba(0, 140, 120, 0.08);
  border-color: rgba(0, 140, 120, 0.18);
}

.rbs-chat-fab__bubble--user {
  align-self: flex-end;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom-right-radius: 5px;
}

[data-theme="light"] .rbs-chat-fab__bubble--user {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
}

/* SMS-style enter */
.rbs-chat-fab__bubble--enter-user {
  animation: rbs-fab-bubble-in-user 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.rbs-chat-fab__bubble--enter-bot,
.rbs-chat-fab__turn--enter {
  animation: rbs-fab-bubble-in-bot 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes rbs-fab-bubble-in-user {
  from {
    opacity: 0;
    transform: translate3d(12px, 10px, 0) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes rbs-fab-bubble-in-bot {
  from {
    opacity: 0;
    transform: translate3d(-10px, 10px, 0) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

/* Waiting: soft float + typing dots */
.rbs-chat-fab__bubble--typing {
  opacity: 1;
  min-width: 3.1rem;
  padding: 0.7rem 0.9rem;
  animation: rbs-fab-wait-bob 1.7s ease-in-out infinite;
}

.rbs-chat-fab__typing {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  height: 0.85rem;
}

.rbs-chat-fab__typing span {
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: #00e5c8;
  opacity: 0.35;
  animation: rbs-fab-dot 1.15s ease-in-out infinite;
}

.rbs-chat-fab__typing span:nth-child(2) {
  animation-delay: 0.16s;
}

.rbs-chat-fab__typing span:nth-child(3) {
  animation-delay: 0.32s;
}

[data-theme="light"] .rbs-chat-fab__typing span {
  background: #0a8f7e;
}

@keyframes rbs-fab-dot {
  0%,
  80%,
  100% {
    opacity: 0.28;
    transform: translateY(0) scale(0.92);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px) scale(1);
  }
}

@keyframes rbs-fab-wait-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

.rbs-chat-fab__bubble--streaming {
  animation: none;
}

.rbs-chat-fab__bubble--streaming::after {
  content: "";
  display: inline-block;
  width: 0.42em;
  height: 1em;
  margin-left: 0.12em;
  vertical-align: -0.12em;
  background: #00e5c8;
  opacity: 0.75;
  animation: rbs-fab-caret 0.9s steps(1, end) infinite;
}

@keyframes rbs-fab-caret {
  50% {
    opacity: 0;
  }
}

.rbs-chat-fab__bubble--landed {
  animation: rbs-fab-land 0.28s ease-out both;
}

@keyframes rbs-fab-land {
  0% {
    transform: scale(1.015);
  }
  100% {
    transform: scale(1);
  }
}

.rbs-chat-fab__stream-status {
  margin: 0.05rem 0 0;
  padding-left: 0.35rem;
  font-family: var(--mono, "JetBrains Mono", ui-monospace, monospace);
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #00e5c8;
  opacity: 0.72;
  transition: opacity 0.2s ease;
}

.rbs-chat-fab__turn {
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  max-width: 100%;
  width: 100%;
}

.rbs-chat-fab__turn .rbs-chat-fab__bubble--bot {
  max-width: 92%;
}

@media (prefers-reduced-motion: reduce) {
  .rbs-chat-fab__bubble--enter-user,
  .rbs-chat-fab__bubble--enter-bot,
  .rbs-chat-fab__turn--enter,
  .rbs-chat-fab__bubble--typing,
  .rbs-chat-fab__typing span,
  .rbs-chat-fab__bubble--streaming::after,
  .rbs-chat-fab__bubble--landed {
    animation: none !important;
  }
}

.rbs-chat-fab__md-p {
  margin: 0 0 0.55rem;
}

.rbs-chat-fab__md-p:last-child {
  margin-bottom: 0;
}

.rbs-chat-fab__md-list {
  margin: 0 0 0.55rem;
  padding-left: 1.1rem;
}

.rbs-chat-fab__md-list:last-child {
  margin-bottom: 0;
}

.rbs-chat-fab__md-list li {
  margin: 0 0 0.25rem;
}

.rbs-chat-fab__md-code {
  font-family: var(--mono, "JetBrains Mono", ui-monospace, monospace);
  font-size: 0.78em;
  padding: 0.05em 0.3em;
  border-radius: 3px;
  background: rgba(0, 229, 200, 0.12);
}

.rbs-chat-fab__bubble a {
  color: #00e5c8;
  text-decoration: none;
  border-bottom: 1px solid rgba(0, 229, 200, 0.35);
  word-break: break-all;
}

[data-theme="light"] .rbs-chat-fab__bubble a {
  color: #0a6b5e;
  border-bottom-color: rgba(0, 140, 120, 0.35);
}

.rbs-chat-fab__turn-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  max-width: 100%;
}

.rbs-chat-fab__handoff {
  margin: 0.35rem 0 0.75rem;
  padding: 0.7rem 0.8rem;
  border-radius: 8px;
  border: 1px solid rgba(0, 229, 200, 0.35);
  border-left: 3px solid #00e5c8;
  background: rgba(0, 229, 200, 0.08);
}

[data-theme="light"] .rbs-chat-fab__handoff {
  background: rgba(0, 160, 140, 0.08);
  border-color: rgba(0, 140, 120, 0.35);
}

.rbs-chat-fab__handoff-title {
  margin: 0 0 0.25rem;
  font-family: var(--mono, "JetBrains Mono", ui-monospace, monospace);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #00e5c8;
}

.rbs-chat-fab__handoff-case {
  margin: 0 0 0.45rem;
  font-family: var(--mono, "JetBrains Mono", ui-monospace, monospace);
  font-size: 0.72rem;
  color: inherit;
  opacity: 0.85;
}

.rbs-chat-fab__handoff-body {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  line-height: 1.45;
  opacity: 0.9;
}

.rbs-chat-fab__handoff-body:last-child {
  margin-bottom: 0;
}

.rbs-chat-fab__collect {
  width: 100%;
  max-width: 20rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(0, 229, 200, 0.22);
  background: rgba(0, 229, 200, 0.05);
  border-radius: 6px;
}

[data-theme="light"] .rbs-chat-fab__collect {
  border-color: rgba(0, 140, 120, 0.22);
  background: rgba(0, 140, 120, 0.05);
}

.rbs-chat-fab__collect-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin: 0;
  font-size: 0.72rem;
}

.rbs-chat-fab__collect-label {
  font-family: var(--mono, "JetBrains Mono", ui-monospace, monospace);
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.7;
}

.rbs-chat-fab__collect-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(0, 229, 200, 0.28);
  background: transparent;
  color: inherit;
  padding: 0.45rem 0.55rem;
  font: inherit;
  font-size: 0.8rem;
  border-radius: 4px;
}

.rbs-chat-fab__collect-textarea {
  resize: vertical;
  min-height: 3.5rem;
}

.rbs-chat-fab__collect-input:focus {
  outline: none;
  border-color: #00e5c8;
}

.rbs-chat-fab__collect-submit {
  align-self: flex-start;
  margin-top: 0.15rem;
  border: 1px solid #00e5c8;
  background: #00e5c8;
  color: #041014;
  padding: 0.4rem 0.75rem;
  font-family: var(--mono, "JetBrains Mono", ui-monospace, monospace);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 4px;
}

.rbs-chat-fab__collect-submit:disabled {
  opacity: 0.55;
  cursor: default;
}

.rbs-chat-fab__form {
  display: flex;
  gap: 0.4rem;
  padding: 0.65rem 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .rbs-chat-fab__form {
  border-top-color: rgba(0, 0, 0, 0.08);
}

.rbs-chat-fab__input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(0, 229, 200, 0.28);
  background: transparent;
  color: inherit;
  padding: 0.55rem 0.65rem;
  font: inherit;
  font-size: 0.85rem;
}

.rbs-chat-fab__input:focus {
  outline: none;
  border-color: #00e5c8;
}

.rbs-chat-fab__send {
  border: 1px solid #00e5c8;
  background: #00e5c8;
  color: #041014;
  padding: 0 0.85rem;
  font-family: var(--mono, "JetBrains Mono", ui-monospace, monospace);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.rbs-chat-fab__send:disabled {
  opacity: 0.5;
  cursor: wait;
}

.rbs-chat-fab__foot {
  padding: 0 0.85rem 0.65rem;
  font-size: 0.62rem;
  opacity: 0.55;
  line-height: 1.35;
}

.rbs-chat-fab__foot a {
  color: #00e5c8;
  text-decoration: none;
  border-bottom: 1px solid rgba(0, 229, 200, 0.35);
}

@media (max-width: 420px) {
  .rbs-chat-fab__panel {
    height: min(70vh, calc(100vh - 5.5rem));
  }
}
