/* ==========================================================================
   Rush Telecom — Webchat Widget
   Drop-in, dependency-free. Version 1.0.0
   Scoped under .rcw-root so it cannot collide with site CSS.
   ========================================================================== */

.rcw-root {
  --rcw-primary: #0a4d8c;
  --rcw-primary-hover: #08396a;
  --rcw-accent: #17a673;
  --rcw-bg: #ffffff;
  --rcw-bg-alt: #f4f7fa;
  --rcw-border: #dde5ed;
  --rcw-text: #14202b;
  --rcw-text-muted: #5b6b7c;
  --rcw-radius: 16px;
  --rcw-shadow: 0 12px 40px rgba(10, 35, 60, 0.18);
  --rcw-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,                                                                                                                                                        sans-serif;

  position: fixed;
  z-index: 2147483000;
  right: 24px;
  bottom: 24px;
  font-family: var(--rcw-font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--rcw-text);
}

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

/* ---------- Launcher ---------- */
.rcw-launcher {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--rcw-primary);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 13px 20px 13px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--rcw-shadow);
  transition: background 0.18s ease, transform 0.18s ease;
}
.rcw-launcher:hover { background: var(--rcw-primary-hover); transform: translateY(-1px                                                                                                                                                       ); }
.rcw-launcher:focus-visible { outline: 3px solid var(--rcw-accent); outline-offset: 2p                                                                                                                                                       x; }
.rcw-launcher[hidden] { display: none; }

.rcw-launcher-icon {
  position: relative;
  width: 22px; height: 22px;
  flex: 0 0 22px;
}
.rcw-launcher-icon svg { width: 100%; height: 100%; display: block; }

/* Unread / availability dot */
.rcw-dot {
  position: absolute;
  top: -3px; right: -4px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--rcw-accent);
  border: 2px solid var(--rcw-primary);
}
.rcw-dot[hidden] { display: none; }

/* ---------- Panel ---------- */
.rcw-panel {
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 48px);
  background: var(--rcw-bg);
  border-radius: var(--rcw-radius);
  box-shadow: var(--rcw-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  animation: rcw-pop 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.rcw-panel[hidden] { display: none; }

@keyframes rcw-pop {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Header ---------- */
.rcw-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: var(--rcw-primary);
  color: #fff;
  flex: 0 0 auto;
}
.rcw-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  flex: 0 0 38px;
}
.rcw-header-text { flex: 1 1 auto; min-width: 0; }
.rcw-header-title { font-weight: 650; font-size: 15px; margin: 0; }
.rcw-header-status {
  font-size: 12.5px;
  opacity: 0.9;
  margin: 1px 0 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.rcw-header-status::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.25);
}

.rcw-iconbtn {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  width: 32px; height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 17px;
  line-height: 1;
  flex: 0 0 32px;
  transition: background 0.15s ease;
}
.rcw-iconbtn:hover { background: rgba(255, 255, 255, 0.26); }
.rcw-iconbtn:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }

/* ---------- Transcript ---------- */
.rcw-log {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px;
  background: var(--rcw-bg-alt);
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
}
.rcw-log::-webkit-scrollbar { width: 8px; }
.rcw-log::-webkit-scrollbar-thumb {
  background: #c3cfda;
  border-radius: 4px;
  border: 2px solid var(--rcw-bg-alt);
}

.rcw-daystamp {
  align-self: center;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--rcw-text-muted);
  background: #e6ecf2;
  padding: 3px 10px;
  border-radius: 999px;
}

.rcw-msg {
  max-width: 82%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 14.5px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  animation: rcw-msg-in 0.18s ease;
}
@keyframes rcw-msg-in {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: none; }
}

.rcw-msg-bot {
  align-self: flex-start;
  background: var(--rcw-bg);
  border: 1px solid var(--rcw-border);
  border-bottom-left-radius: 4px;
}

.rcw-msg-user {
  align-self: flex-end;
  background: var(--rcw-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Bot meta line (who answered) */
.rcw-msg-meta {
  display: block;
  font-size: 11px;
  margin-top: 6px;
  color: var(--rcw-text-muted);
}
.rcw-msg-user .rcw-msg-meta { color: rgba(255, 255, 255, 0.75); }

/* Typing indicator */
.rcw-typing {
  align-self: flex-start;
  background: var(--rcw-bg);
  border: 1px solid var(--rcw-border);
  border-bottom-left-radius: 4px;
  padding: 12px 15px;
  display: flex;
  gap: 4px;
}
.rcw-typing[hidden] { display: none; }
.rcw-typing i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #9aa9b8;
  animation: rcw-bounce 1.3s infinite ease-in-out;
}
.rcw-typing i:nth-child(2) { animation-delay: 0.18s; }
.rcw-typing i:nth-child(3) { animation-delay: 0.36s; }
@keyframes rcw-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30%           { transform: translateY(-4px); opacity: 1; }
}

/* Quick replies */
.rcw-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px 14px 0;
  background: var(--rcw-bg-alt);
}
.rcw-quick[hidden] { display: none; }
.rcw-chip {
  background: var(--rcw-bg);
  border: 1px solid var(--rcw-primary);
  color: var(--rcw-primary);
  border-radius: 999px;
  padding: 6px 13px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.rcw-chip:hover { background: var(--rcw-primary); color: #fff; }
.rcw-chip:focus-visible { outline: 2px solid var(--rcw-accent); outline-offset: 2px; }

/* ---------- Composer ---------- */
.rcw-form {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 12px;
  background: var(--rcw-bg);
  border-top: 1px solid var(--rcw-border);
}
.rcw-input {
  flex: 1 1 auto;
  min-width: 0;
  resize: none;
  border: 1px solid var(--rcw-border);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14.5px;
  color: var(--rcw-text);
  background: var(--rcw-bg-alt);
  max-height: 96px;
  min-height: 42px;
}
.rcw-input:focus {
  outline: none;
  border-color: var(--rcw-primary);
  background: var(--rcw-bg);
  box-shadow: 0 0 0 3px rgba(10, 77, 140, 0.12);
}
.rcw-send {
  flex: 0 0 42px;
  width: 42px; height: 42px;
  align-self: flex-end;
  border: none;
  border-radius: 10px;
  background: var(--rcw-primary);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s ease;
}
.rcw-send:hover:not(:disabled) { background: var(--rcw-primary-hover); }
.rcw-send:disabled { opacity: 0.45; cursor: not-allowed; }
.rcw-send:focus-visible { outline: 3px solid var(--rcw-accent); outline-offset: 2px; }
.rcw-send svg { width: 19px; height: 19px; }

/* ---------- Footer ---------- */
.rcw-footer {
  flex: 0 0 auto;
  padding: 8px 14px;
  background: var(--rcw-bg);
  border-top: 1px solid var(--rcw-border);
  font-size: 11.5px;
  color: var(--rcw-text-muted);
  text-align: center;
}
.rcw-footer a { color: var(--rcw-primary); text-decoration: none; }
.rcw-footer a:hover { text-decoration: underline; }

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
  .rcw-root { right: 12px; bottom: 12px; left: 12px; }
  .rcw-panel {
    width: 100%;
    height: calc(100vh - 24px);
    max-height: none;
  }
  .rcw-launcher { width: 100%; justify-content: center; }
  .rcw-msg { max-width: 88%; }
}

@media (prefers-reduced-motion: reduce) {
  .rcw-root *,
  .rcw-panel,
  .rcw-msg,
  .rcw-typing i { animation: none !important; transition: none !important; }
}

/* ---------- High contrast ---------- */
@media (prefers-contrast: more) {
  .rcw-panel { border: 2px solid var(--rcw-text); }
  .rcw-msg { border-width: 2px; }
