/* ============================================================
   RTS SITE BOT — DEFAULT (DESKTOP) + iPHONE STABILITY FIXES
   Keeps the classic floating panel style (NOT fullscreen).
============================================================ */

/* prevents weird tap delays */
.rts-bot-btn, .rts-send, .rts-chip { touch-action: manipulation; }

/* lock background scroll when chat is open */
body.rts-bot-open { overflow: hidden; }

/* Floating button */
.rts-bot-btn{
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 999999;
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  cursor: pointer;
  background: #111827;
  color: #fff;
  box-shadow: 0 12px 30px rgba(0,0,0,.18);
}

/* Panel (classic floating card) */
.rts-bot-panel{
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: min(420px, calc(100vw - 32px));
  height: 520px;
  max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  z-index: 999999;

  display: none;
  flex-direction: column;

  border-radius: 16px;
  overflow: hidden;

  background: #ffffff;
  border: 1px solid rgba(0,0,0,.08);
  box-shadow: 0 18px 50px rgba(0,0,0,.18);

  /* smoother on iOS */
  transform: translateZ(0);
}

.rts-bot-panel.open{ display: flex; }

/* Header */
.rts-bot-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 12px;
  background: #0f172a;
  color: #fff;
}

.rts-bot-head button{
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 10px;
}

.rts-bot-head button:active{ background: rgba(255,255,255,.12); }

.rts-muted{ font-size: 12px; opacity: .85; }

/* Body scroll */
.rts-bot-body{
  flex: 1 1 auto;
  overflow: auto;
  padding: 12px;
  background: #f8fafc;
  -webkit-overflow-scrolling: touch;
}

/* Footer */
.rts-bot-foot{
  flex: 0 0 auto;
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid rgba(0,0,0,.08);
}

/* Input row */
.rts-row{
  display: flex;
  gap: 10px;
  align-items: center;
}

.rts-input{
  width: 100%;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 12px;
  padding: 12px 12px;
  outline: none;

  /* IMPORTANT: prevents iPhone zoom + reduces “jumping” */
  font-size: 16px;
}

.rts-input:focus{
  border-color: rgba(59,130,246,.6);
  box-shadow: 0 0 0 4px rgba(59,130,246,.15);
}

.rts-send{
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  background: #2563eb;
  color: #fff;
  font-size: 16px;
}

.rts-send:disabled{
  opacity: .6;
  cursor: not-allowed;
}

/* Chips */
.rts-chips{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.rts-chip{
  border: 1px solid rgba(0,0,0,.12);
  background: #fff;
  border-radius: 999px;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 14px;
}

.rts-chip:active{ transform: translateY(1px); }

/* Messages */
.rts-msg{ display: flex; margin: 10px 0; }
.rts-msg.user{ justify-content: flex-end; }
.rts-msg.bot{ justify-content: flex-start; }

.rts-bubble{
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.25;
  word-break: break-word;
  box-shadow: 0 6px 16px rgba(0,0,0,.08);
}

.rts-msg.user .rts-bubble{
  background: #2563eb;
  color: #fff;
  border-bottom-right-radius: 6px;
}

.rts-msg.bot .rts-bubble{
  background: #ffffff;
  color: #0f172a;
  border-bottom-left-radius: 6px;
}

/* Mobile keeps same style, just slightly larger width */
@media (max-width: 576px){
  .rts-bot-panel{
    width: calc(100vw - 24px);
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    height: 520px;
  }
  .rts-bot-btn{
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
  }
}
