/* ResaHost liidibotti — Resapappi-kuori, Resahost-brändi */
.rh-chat *,
.rh-chat *::before,
.rh-chat *::after { box-sizing: border-box; }

.rh-chat {
  --rhc-brand: #4f55e2;
  --rhc-brand-ink: #231f20;
  --rhc-mint: #84eda6;
  --rhc-panel: #fff;
  --rhc-muted: #f1eeef;
  --rhc-bubble: #eef0fb;
  --rhc-text: #231f20;
  --rhc-sub: #5c5758;
  --rhc-z: 60;
  font-family: Manrope, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color: var(--rhc-text);
}

.rh-chat__fab {
  position: fixed;
  right: 20px;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: var(--rhc-z);
  width: 64px;
  height: 64px;
  box-sizing: border-box;
  padding: 3px;
  border: none;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(35, 31, 32, 0.22), 0 8px 18px rgba(35, 31, 32, 0.2);
  cursor: pointer;
  overflow: visible;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.rh-chat__fab:hover { transform: scale(1.06); }
.rh-chat__fab:active { transform: scale(0.96); }
.rh-chat__fab:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.rh-chat__fab img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.rh-chat__fab-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #84eda6;
  color: #231f20;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
  border: 2px solid #fff;
  pointer-events: none;
}
.rh-chat__fab.is-open .rh-chat__fab-badge { display: none; }
.rh-chat__fab.is-open {
  background: #fff;
}
.rh-chat__fab.is-open .rh-chat__fab-x {
  inset: 3px;
  border-radius: 50%;
  background: #4f55e2;
}
.rh-chat__fab.is-open img { opacity: 0; }
.rh-chat__fab-x {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.rh-chat__fab.is-open .rh-chat__fab-x { display: flex; }

.rh-chat__panel {
  position: fixed;
  right: 20px;
  bottom: calc(20px + 64px + 12px);
  z-index: var(--rhc-z);
  width: min(400px, calc(100vw - 24px));
  height: min(560px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  background: var(--rhc-panel);
  border: 1.5px solid rgba(35, 31, 32, 0.12);
  border-radius: 20px;
  box-shadow: 0 18px 50px rgba(35, 31, 32, 0.22);
  overflow: hidden;
}
.rh-chat__panel[hidden] { display: none !important; }

.rh-chat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: #4f55e2;
  color: #fff;
  flex-shrink: 0;
}
.rh-chat__who {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.rh-chat__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.28);
}
.rh-chat__name {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.15;
}
.rh-chat__role {
  margin: 3px 0 0;
  font-size: 12px;
  opacity: 0.85;
}
.rh-chat__iconbtn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.rh-chat__head-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.rh-chat__back {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 999px;
  padding: 6px 10px;
  font: 700 11px/1 Manrope, sans-serif;
  cursor: pointer;
  white-space: nowrap;
}
.rh-chat__back:hover { background: rgba(255, 255, 255, 0.22); }
.rh-chat__back[hidden] { display: none !important; }
.rh-chat__iconbtn:hover { background: rgba(255, 255, 255, 0.12); }

.rh-chat__msgs {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  background: #fff;
}
.rh-chat__welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  padding: 12px 8px 8px;
}
.rh-chat__welcome img {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 10px 28px rgba(35, 31, 32, 0.16);
}

.rh-chat__teaser {
  position: fixed;
  right: 20px;
  bottom: calc(20px + 64px + 14px);
  z-index: var(--rhc-z);
  width: min(340px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}
.rh-chat__teaser[hidden] { display: none !important; }
@keyframes rh-chat-enter {
  from {
    opacity: 0;
    transform: translate(14px, 18px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.rh-chat__teaser.is-ready {
  transform-origin: 100% 100%;
  animation: rh-chat-enter 0.48s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.rh-chat__panel:not([hidden]) {
  transform-origin: 100% 100%;
  animation: rh-chat-enter 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@media (max-width: 879px) {
  .rh-chat__panel:not([hidden]) {
    transform-origin: 100% calc(100% + 80px);
  }
}

.rh-chat__teaser > * { pointer-events: auto; }
.rh-chat__hello {
  background: #fff;
  color: #231f20;
  border-radius: 22px;
  padding: 13px 16px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28), 0 2px 8px rgba(0, 0, 0, 0.16);
  max-width: 92%;
}
.rh-chat__pills {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.rh-chat__pill {
  appearance: none;
  border: none;
  background: #c5c8f6;
  color: #231f20;
  border-radius: 999px;
  padding: 11px 16px;
  font: 700 14px/1.2 Manrope, sans-serif;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22), 0 2px 6px rgba(0, 0, 0, 0.12);
}
.rh-chat__pill:hover { filter: brightness(1.04); }
.rh-chat__promo {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  width: 100%;
  min-height: 168px;
  background: #4f55e2;
  color: #fff;
  border-radius: 18px;
  overflow: hidden;
  border: 2px solid #fff;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.32), 0 4px 12px rgba(0, 0, 0, 0.16);
}
.rh-chat__promo-copy {
  padding: 16px 12px 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}
.rh-chat__promo-h {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.rh-chat__promo-p {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.9);
}
.rh-chat__promo-cta {
  appearance: none;
  border: none;
  width: fit-content;
  background: #84eda6;
  color: #231f20;
  border-radius: 999px;
  padding: 10px 15px;
  font: 800 14px/1 Manrope, sans-serif;
  cursor: pointer;
}
.rh-chat__promo-cta:hover { filter: brightness(1.04); }
.rh-chat__promo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 12%;
  filter: grayscale(1);
}
.rh-chat__teaser-x {
  position: absolute;
  left: -8px;
  bottom: -4px;
  width: 28px;
  height: 28px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #231f20;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(35, 31, 32, 0.28);
}
@media (max-width: 879px) {
  .rh-chat__teaser:not(.is-ready) { display: none !important; }
}
@media (max-width: 879px) {
  .rh-chat__teaser {
    width: min(248px, calc(100vw - 88px));
    right: 14px;
  }
}
@media (max-width: 520px) {
  .rh-chat__teaser {
    right: 12px;
    bottom: calc(16px + 58px + 12px);
    width: min(236px, calc(100vw - 80px));
  }
  .rh-chat__hello,
  .rh-chat__pills { display: none; }
  .rh-chat__promo { min-height: 132px; }
  .rh-chat__promo-copy { padding: 12px 10px 12px 12px; gap: 4px; }
  .rh-chat__promo-h { font-size: 15px; }
  .rh-chat__promo-p { font-size: 12px; margin: 0 0 6px; }
  .rh-chat__promo-cta { padding: 8px 12px; font-size: 13px; }
}

.rh-chat__row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 10px;
}
.rh-chat__row--me { flex-direction: row-reverse; }
.rh-chat__row img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  margin-top: 2px;
}
.rh-chat__bubble {
  max-width: 82%;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
  box-shadow: 0 1px 2px rgba(35, 31, 32, 0.06);
}
.rh-chat__bubble--bot {
  background: #f3f1f2;
  color: var(--rhc-text);
  border-top-left-radius: 6px;
}
.rh-chat__bubble--me {
  background: #4f55e2;
  color: #fff;
  border-top-right-radius: 6px;
}

.rh-chat__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 10px;
  background: #fff;
}
.rh-chat__chip {
  appearance: none;
  border: 1.5px solid #4f55e2;
  background: #fff;
  color: #4f55e2;
  border-radius: 999px;
  padding: 8px 12px;
  font: 650 13px/1.3 Manrope, sans-serif;
  cursor: pointer;
  text-align: left;
}
.rh-chat__chip:hover { background: #eef0fb; }
.rh-chat__chip:disabled { opacity: 0.45; cursor: default; }

.rh-chat__fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 14px 10px;
  background: #fff;
}
.rh-chat__fields input[type="text"],
.rh-chat__fields input[type="email"],
.rh-chat__fields input[type="tel"] {
  width: 100%;
  border: 1px solid #cac5c6;
  border-radius: 12px;
  padding: 10px 12px;
  font: 400 14px/1.4 Manrope, sans-serif;
  background: #f8f7f7;
  color: #231f20;
}
.rh-chat__fields input:focus {
  outline: none;
  border-color: #4f55e2;
  box-shadow: 0 0 0 3px rgba(79, 85, 226, 0.22);
}
.rh-chat__consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: var(--rhc-sub);
  line-height: 1.4;
}
.rh-chat__consent a { color: #4f55e2; }
.rh-chat__hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.rh-chat__sendform {
  appearance: none;
  border: none;
  border-radius: 12px;
  background: #4f55e2;
  color: #fff;
  font: 700 14px/1 Manrope, sans-serif;
  padding: 11px 14px;
  cursor: pointer;
}
.rh-chat__sendform:disabled { opacity: 0.45; cursor: default; }
.rh-chat__err {
  font-size: 12px;
  color: #a92e2e;
}

.rh-chat__composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(35, 31, 32, 0.1);
  background: #fff;
  flex-shrink: 0;
}
.rh-chat__composer textarea {
  flex: 1;
  resize: none;
  min-height: 40px;
  max-height: 110px;
  border: 1px solid #cac5c6;
  border-radius: 12px;
  padding: 9px 12px;
  font: 400 14px/1.45 Manrope, sans-serif;
  background: #f8f7f7;
  color: #231f20;
}
.rh-chat__composer textarea:focus {
  outline: none;
  border-color: #4f55e2;
  box-shadow: 0 0 0 2px rgba(132, 237, 166, 0.45);
}
.rh-chat__go {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: #84eda6;
  color: #231f20;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.rh-chat__go:disabled { opacity: 0.4; cursor: default; }

@media (max-width: 879px) {
  .rh-chat__panel {
    right: 12px;
    left: 12px;
    width: auto;
    top: 10px;
    bottom: auto;
    height: calc(100dvh - 90px);
    max-height: none;
  }
  html.rh-chat-open,
  html.rh-chat-open body {
    overflow: hidden !important;
    overscroll-behavior: none;
  }
}
@media (max-width: 520px) {
  .rh-chat__fab {
    right: 14px;
    width: 58px;
    height: 58px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rh-chat__fab { transition: none; }
  .rh-chat__teaser.is-ready,
  .rh-chat__panel:not([hidden]) {
    animation: none;
  }
}
