/* ==========================================================================
   Live chat widget (rl-chat-*) — public site + user panel. Theme-aware via
   frontend.css variables (dark = gold, light = crimson accent).
   Mobile-first: full-width sheet above the bottom nav, floating card ≥769px.
   ========================================================================== */
.rl-chat { --chat-gap: 14px; --chat-nav: 78px; position: fixed; right: var(--chat-gap); bottom: calc(var(--chat-nav) + env(safe-area-inset-bottom)); z-index: 260; font-family: var(--font-body); }
.rl-chat [hidden] { display: none !important; }

/* Launcher */
.rl-chat-bubble { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 50px; padding: 0 16px 0 14px;
  border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-contrast); font: 600 14px/1 var(--font-body);
  box-shadow: 0 10px 28px rgba(0,0,0,.35); cursor: pointer; transition: transform var(--transition), box-shadow var(--transition); }
.rl-chat-bubble .fa-comments { font-size: 19px; }
.rl-chat-bubble:hover { transform: translateY(-2px); }
.rl-chat-bubble:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.rl-chat-bubble-label { display: none; }
.rl-chat-badge { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
  background: var(--crimson); color: #fff; font: 700 11px/20px var(--font-latin); text-align: center; border: 2px solid var(--bg); }
.rl-chat.is-open .rl-chat-bubble { display: none; }

/* Panel — phones: sheet pinned above the bottom nav */
.rl-chat-panel { position: fixed; left: 8px; right: 8px; bottom: calc(var(--chat-nav) + env(safe-area-inset-bottom));
  height: min(560px, calc(100dvh - var(--chat-nav) - 70px)); display: flex; flex-direction: column;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); overflow: hidden; }

.rl-chat-head { display: flex; align-items: flex-start; gap: 12px; padding: 14px 14px 12px; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--accent-soft), transparent); }
.rl-chat-head-ic { flex-shrink: 0; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-contrast); font-size: 17px; }
.rl-chat-head-txt { flex: 1; min-width: 0; }
.rl-chat-title { font: 700 16px/1.3 var(--font-body); color: var(--text); }
.rl-chat-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; line-height: 1.5; }
.rl-chat-status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.rl-chat-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim); flex-shrink: 0; }
.rl-chat-dot.is-on { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.18); }
.rl-chat-close { flex-shrink: 0; width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--border); background: transparent;
  color: var(--text-muted); cursor: pointer; display: grid; place-items: center; }
.rl-chat-close:hover { color: var(--text); border-color: var(--border-strong); }

/* Thread */
.rl-chat-thread { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.rl-chat-welcome { align-self: stretch; padding: 12px 14px; border-radius: var(--radius); background: var(--input-bg);
  border: 1px dashed var(--border-strong); color: var(--text-muted); font-size: 13px; line-height: 1.6; }
.rl-chat-msg { display: flex; flex-direction: column; max-width: 86%; }
.rl-chat-msg.is-me { align-self: flex-end; align-items: flex-end; }
.rl-chat-msg.is-staff { align-self: flex-start; align-items: flex-start; }
.rl-chat-bubble-msg { padding: 9px 12px; border-radius: 14px; font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.rl-chat-msg.is-me .rl-chat-bubble-msg { background: var(--accent); color: var(--accent-contrast); border-bottom-right-radius: 4px; }
.rl-chat-msg.is-staff .rl-chat-bubble-msg { background: var(--input-bg); color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.rl-chat-msg-body { white-space: pre-wrap; }
.rl-chat-meta { font: 500 11px/1.4 var(--font-latin); color: var(--text-dim); margin-top: 3px; padding: 0 4px; }
.rl-chat-att { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; color: inherit; text-decoration: underline; }
.rl-chat-att.is-img { display: block; text-decoration: none; }
.rl-chat-att.is-img img { display: block; max-width: 100%; max-height: 220px; border-radius: 10px; object-fit: cover; }

/* Compose */
.rl-chat-form { border-top: 1px solid var(--border); padding: 10px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.rl-chat-guest { display: grid; grid-template-columns: 1fr; gap: 8px; }
.rl-chat-compose { display: flex; align-items: flex-end; gap: 8px; }
.rl-chat-input { width: 100%; min-width: 0; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border-strong);
  background: var(--input-bg); color: var(--text); font: 400 14px/1.45 var(--font-body); }
.rl-chat-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.rl-chat-text { resize: none; height: 42px; max-height: 120px; }
.rl-chat-text.is-tall { height: 84px; }
.rl-chat-send { flex-shrink: 0; width: 42px; height: 42px; border-radius: 12px; border: 0; background: var(--accent); color: var(--accent-contrast);
  cursor: pointer; display: grid; place-items: center; font-size: 15px; }
.rl-chat-send:disabled { opacity: .55; cursor: progress; }
.rl-chat-error { font-size: 12px; color: var(--crimson); padding: 0 2px; }

/* Tablet / desktop: floating card, no bottom nav */
@media (min-width: 480px) {
  .rl-chat-guest { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 769px) {
  .rl-chat { --chat-gap: 22px; --chat-nav: 0px; bottom: var(--chat-gap); }
  .rl-chat-bubble-label { display: inline; }
  .rl-chat-panel { left: auto; right: var(--chat-gap); bottom: var(--chat-gap); width: 370px; height: min(580px, calc(100vh - 2 * var(--chat-gap))); }
}

/* Email feedback thank-you page */
.rl-chat-thanks { max-width: 520px; margin: 0 auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.rl-chat-thanks-ic { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; }
.rl-chat-thanks-ic.is-like { background: rgba(34,197,94,.14); color: #22c55e; }
.rl-chat-thanks-ic.is-dislike { background: var(--crimson-soft); color: var(--crimson); }
.rl-chat-thanks-title { font: 700 22px/1.4 var(--font-body); margin: 0; }
.rl-chat-thanks-sub { color: var(--text-muted); margin: 0 0 6px; }
