.rds-chatbot-root {
  --rds-primary: #e30613;
  --rds-dark: #1b1b1f;
  --rds-light: #ffffff;
  --rds-neutral: #f4f4f6;
  --rds-kb-offset: 0px;
  --rds-toggle-bg: #e30613;
  --rds-toggle-text: #ffffff;
  position: fixed;
  right: 20px;
  bottom: calc(20px + var(--rds-kb-offset));
  z-index: 99999;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

.rds-chatbot-root.rds-chatbot-pos-left {
  left: 20px;
  right: auto;
}

.rds-chatbot-root.rds-chatbot-pos-right {
  left: auto;
  right: 20px;
  transform: none;
}

.rds-chatbot-root.rds-chatbot-pos-center {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
}

.rds-chatbot-root.rds-chatbot-pos-left .rds-chatbot-toggle,
.rds-chatbot-root.rds-chatbot-pos-center .rds-chatbot-toggle {
  margin-left: 0;
}

.rds-chatbot-toggle {
  min-height: 52px;
  border: 0;
  border-radius: 999px;
  background: var(--rds-toggle-bg);
  color: var(--rds-toggle-text);
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(227, 6, 19, 0.3);
  margin-left: 25px;
  max-width: calc(100vw - 41px);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-align: left;
}

.rds-chatbot-toggle-icon {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
}

.rds-chatbot-toggle-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.rds-chatbot-toggle-title {
  font-size: 15px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rds-chatbot-toggle-subtitle {
  font-size: 11px;
  line-height: 1.2;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rds-chatbot-toggle.rds-chatbot-toggle-attention {
  animation: rdsChatbotNudge 1.25s ease-in-out 1;
}

@keyframes rdsChatbotNudge {
  0% {
    transform: translateX(0) scale(1);
    box-shadow: 0 12px 28px rgba(227, 6, 19, 0.3);
  }
  25% {
    transform: translateX(-3px) scale(1.01);
    box-shadow: 0 14px 30px rgba(227, 6, 19, 0.38);
  }
  50% {
    transform: translateX(2px) scale(1.01);
    box-shadow: 0 15px 34px rgba(227, 6, 19, 0.42);
  }
  100% {
    transform: translateX(0) scale(1);
    box-shadow: 0 12px 28px rgba(227, 6, 19, 0.3);
  }
}

.rds-chatbot-panel {
  margin-top: 10px;
  width: min(360px, calc(100vw - 24px));
  height: min(520px, 76vh);
  background: var(--rds-light);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(227, 6, 19, 0.2);
}

.rds-chatbot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--rds-dark), #333740);
  color: var(--rds-light);
}

.rds-chatbot-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rds-chatbot-brand small {
  opacity: 0.85;
  display: block;
  font-size: 11px;
}

.rds-chatbot-logo,
.rds-chatbot-logo-fallback {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}

.rds-chatbot-logo-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--rds-primary);
  color: var(--rds-light);
  font-weight: 800;
}

.rds-chatbot-close {
  border: 0;
  background: transparent;
  color: var(--rds-light);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.rds-chatbot-messages {
  flex: 1;
  overflow-y: auto;
  background: linear-gradient(180deg, #fff, var(--rds-neutral));
  padding: 14px;
}

.rds-chatbot-contact-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid #eaebef;
  background: #fff8f8;
  font-size: 12px;
}

.rds-chatbot-contact-phone {
  color: #121212;
  text-decoration: none;
  font-weight: 700;
}

.rds-chatbot-contact-link {
  color: var(--rds-primary);
  text-decoration: none;
  font-weight: 700;
}

.rds-chatbot-message {
  max-width: 86%;
  border-radius: 14px;
  margin-bottom: 10px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.42;
  white-space: pre-wrap;
}

.rds-chatbot-message.user {
  margin-left: auto;
  background: var(--rds-dark);
  color: var(--rds-light);
}

.rds-chatbot-message.bot {
  margin-right: auto;
  background: #fff;
  color: #131313;
  border: 1px solid #ececf1;
}

.rds-chatbot-message.bot a {
  color: var(--rds-primary);
  font-weight: 700;
  text-decoration: underline;
}

.rds-chatbot-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #ededf2;
  background: #fff;
  position: relative;
  z-index: 3;
}

.rds-chatbot-escalation {
  border-top: 1px solid #ededf2;
  padding: 8px 10px;
  background: #fafafb;
}

.rds-chatbot-escalation-toggle {
  border: 0;
  background: linear-gradient(135deg, #ff5a2a, var(--rds-primary));
  color: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 10px 18px rgba(227, 6, 19, 0.2);
}

.rds-chatbot-escalation-toggle:hover {
  filter: brightness(1.03);
}

.rds-chatbot-escalation-toggle-icon {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
}

.rds-chatbot-escalation-toggle-label {
  line-height: 1.1;
}

.rds-chatbot-escalation-form {
  margin-top: 8px;
  display: grid;
  gap: 6px;
}

.rds-chatbot-escalation-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.rds-chatbot-escalation-title {
  font-size: 12px;
  font-weight: 700;
  color: #2f3440;
}

.rds-chatbot-escalation-close {
  border: 1px solid #d6dae5;
  background: #fff;
  border-radius: 8px;
  width: 28px;
  height: 28px;
  line-height: 1;
  font-size: 20px;
  cursor: pointer;
}

.rds-chatbot-escalation-form input,
.rds-chatbot-escalation-form textarea,
.rds-chatbot-escalation-form select {
  border: 1px solid #d4d6dd;
  border-radius: 8px;
  padding: 8px;
  font-size: 13px;
  background: #fff;
}

.rds-chatbot-escalation-form textarea {
  resize: vertical;
  min-height: 56px;
  max-height: 110px;
}

.rds-chatbot-escalation-submit {
  border: 0;
  border-radius: 8px;
  background: var(--rds-primary);
  color: #fff;
  padding: 8px 10px;
  font-weight: 700;
  cursor: pointer;
}

.rds-chatbot-escalation-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.rds-chatbot-escalation-cancel {
  border: 1px solid #d6dae5;
  border-radius: 8px;
  background: #fff;
  color: #252a32;
  padding: 8px 10px;
  font-weight: 700;
  cursor: pointer;
}

.rds-chatbot-form input {
  flex: 1;
  border: 1px solid #d4d6dd;
  border-radius: 10px;
  padding: 10px;
  min-width: 0;
  font-size: 16px;
}

.rds-chatbot-form button {
  border: 0;
  border-radius: 10px;
  background: var(--rds-primary);
  color: var(--rds-light);
  padding: 0 14px;
  font-weight: 700;
  font-size: 16px;
  min-width: 112px;
  cursor: pointer;
  touch-action: manipulation;
}

.rds-chatbot-suggestions {
  display: grid;
  gap: 8px;
  margin: 8px 0 10px;
}

.rds-chatbot-suggestion-card {
  border: 1px solid #e3e6ef;
  background: #ffffff;
  border-radius: 12px;
  padding: 10px;
}

.rds-chatbot-suggestion-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
}

.rds-chatbot-suggestion-card p {
  margin: 0 0 8px;
  color: #4a4d55;
  font-size: 12px;
}

.rds-chatbot-cta {
  display: inline-block;
  border-radius: 999px;
  background: var(--rds-primary);
  color: #fff !important;
  padding: 7px 11px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}

.rds-chatbot-sources {
  margin: -2px 0 10px;
  padding: 8px 10px;
  border: 1px solid #e7eaf2;
  border-radius: 10px;
  background: #fff;
  display: grid;
  gap: 4px;
}

.rds-chatbot-sources-label {
  font-size: 11px;
  font-weight: 700;
  color: #555b66;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.rds-chatbot-sources a {
  font-size: 12px;
  color: var(--rds-primary);
  text-decoration: none;
}

.rds-chatbot-sources a:hover {
  text-decoration: underline;
}

.rds-chatbot-feedback {
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid #e7eaf2;
  border-radius: 10px;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12px;
}

.rds-chatbot-feedback-btn {
  border: 1px solid #d8dde8;
  border-radius: 999px;
  background: #fff;
  color: #1e232c;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.rds-chatbot-feedback-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.rds-chatbot-recovery {
  margin: -2px 0 10px;
  display: grid;
  gap: 6px;
}

.rds-chatbot-recovery-toggle {
  border: 1px solid #d8dde8;
  border-radius: 999px;
  background: #fff;
  color: #1f2632;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  justify-self: flex-start;
}

.rds-chatbot-recovery-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rds-chatbot-recovery-chip {
  border: 1px solid #e3e8f2;
  border-radius: 999px;
  background: #fff;
  color: #202735;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

@media (max-width: 640px) {
  .rds-chatbot-root {
    right: 10px;
    bottom: calc(10px + var(--rds-kb-offset));
  }

  .rds-chatbot-root.rds-chatbot-pos-left {
    left: 10px;
    right: auto;
  }

  .rds-chatbot-root.rds-chatbot-pos-right {
    left: auto;
    right: 10px;
    transform: none;
  }

  .rds-chatbot-root.rds-chatbot-pos-center {
    left: 50%;
    right: auto;
  }

  .rds-chatbot-toggle {
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    margin-left: 0;
  }

  .rds-chatbot-panel {
    width: calc(100vw - 20px);
    height: 74vh;
  }

  .rds-chatbot-contact-bar {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .rds-chatbot-contact-link,
  .rds-chatbot-contact-phone {
    font-size: 11px;
  }

  .rds-chatbot-form input,
  .rds-chatbot-form button {
    min-height: 42px;
  }
}

@media (max-width: 420px) {
  .rds-chatbot-root {
    left: 0;
    right: 0;
    bottom: var(--rds-kb-offset);
    transform: none;
  }

  .rds-chatbot-toggle {
    border-radius: 12px 12px 0 0;
    width: 100vw;
  }

  .rds-chatbot-panel {
    width: 100vw;
    height: calc(84vh - env(safe-area-inset-bottom, 0px));
    border-radius: 12px 12px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
  }

  .rds-chatbot-messages {
    padding: 10px;
  }

  .rds-chatbot-message {
    max-width: 92%;
    font-size: 13px;
  }

  .rds-chatbot-escalation,
  .rds-chatbot-form {
    padding-left: max(10px, env(safe-area-inset-left, 0px));
    padding-right: max(10px, env(safe-area-inset-right, 0px));
  }

  .rds-chatbot-escalation-actions {
    grid-template-columns: 1fr;
  }

  .rds-chatbot-root.rds-chatbot-keyboard-open .rds-chatbot-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .rds-chatbot-root.rds-chatbot-keyboard-open .rds-chatbot-form button {
    width: 100%;
    min-height: 46px;
  }
}

.rds-chatbot-root.rds-chatbot-compact .rds-chatbot-toggle {
  min-height: 44px;
  padding: 8px 10px;
}

.rds-chatbot-root.rds-chatbot-compact .rds-chatbot-toggle-icon {
  width: 20px;
  height: 20px;
  min-width: 20px;
  font-size: 11px;
}

.rds-chatbot-root.rds-chatbot-compact .rds-chatbot-toggle-title {
  font-size: 13px;
}

.rds-chatbot-root.rds-chatbot-compact .rds-chatbot-toggle-subtitle {
  font-size: 10px;
}

.rds-chatbot-root.rds-chatbot-compact .rds-chatbot-panel {
  height: min(76vh, 560px);
}

.rds-chatbot-root.rds-chatbot-compact .rds-chatbot-header {
  padding: 10px 11px;
}

.rds-chatbot-root.rds-chatbot-compact .rds-chatbot-logo,
.rds-chatbot-root.rds-chatbot-compact .rds-chatbot-logo-fallback {
  width: 30px;
  height: 30px;
}

.rds-chatbot-root.rds-chatbot-compact .rds-chatbot-contact-bar {
  padding: 6px 9px;
  font-size: 11px;
}

.rds-chatbot-root.rds-chatbot-compact .rds-chatbot-messages {
  padding: 8px;
}

.rds-chatbot-root.rds-chatbot-compact .rds-chatbot-message {
  font-size: 12px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.rds-chatbot-root.rds-chatbot-compact .rds-chatbot-escalation {
  padding: 6px 8px;
}

.rds-chatbot-root.rds-chatbot-compact .rds-chatbot-escalation-toggle,
.rds-chatbot-root.rds-chatbot-compact .rds-chatbot-escalation-submit,
.rds-chatbot-root.rds-chatbot-compact .rds-chatbot-form button {
  min-height: 38px;
}

.rds-chatbot-root.rds-chatbot-compact .rds-chatbot-form {
  padding: 8px;
}

.rds-chatbot-root.rds-chatbot-compact .rds-chatbot-form input {
  min-height: 38px;
  font-size: 13px;
}
