/* The chat bubble and panel (js/chat-widget.js). Same look as the
   reliefcorner-operations-hub widget, release 21.12: a labelled pill
   ("Chat with us") with a green dot and a soft ring when someone is online,
   a panel above it. Standalone: used by the app AND the public course pages,
   so every colour has a fallback to the Academy's navy. */

.rc-chat { --c-brand: var(--color-primary, #0D475C); --c-ink: var(--color-text, #1B2A33); --c-muted: var(--color-text-muted, #55636B);
  --c-line: var(--color-border, #E2DCD2); --c-soft: var(--color-surface-alt, #F3EFE8); --c-card: var(--color-surface, #fff);
  position: fixed; right: 20px; bottom: 20px; z-index: 300; display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
  font-family: var(--font-family, "Nunito Sans", system-ui, sans-serif); color: var(--c-ink); }

.rc-chat-bubble {
  position: relative; height: 56px; min-width: 56px; padding: 0 20px 0 16px; box-sizing: border-box;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 999px; background: var(--c-brand); color: #fff;
  font: 600 .95rem var(--font-family, system-ui, sans-serif); cursor: pointer; white-space: nowrap;
  box-shadow: 0 6px 18px rgba(13, 71, 92, .28);
}
.rc-chat-bubble:focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 5px var(--c-brand); }
.rc-chat-bubble-icon { font-size: 1.25rem; line-height: 1; position: relative; z-index: 1; }
.rc-chat-bubble-label { position: relative; z-index: 1; }
@media (max-width: 480px) { .rc-chat-bubble { padding: 0; } .rc-chat-bubble-label { display: none; } }

/* Someone is online: a green dot and a ring that spreads now and then. */
.rc-chat-dot { position: absolute; top: 4px; left: 4px; width: 12px; height: 12px; border-radius: 999px;
  background: #2fb344; border: 2px solid #fff; box-sizing: border-box; z-index: 2; }
.rc-chat-dot[hidden] { display: none; }
.rc-chat-bubble.is-online::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: inherit;
  z-index: 0; opacity: 0; pointer-events: none; animation: rc-chat-ring 5s ease-out infinite; }
@keyframes rc-chat-ring { 0% { inset: 0; opacity: .45; } 35% { inset: -7px; opacity: 0; } 100% { inset: -7px; opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .rc-chat-bubble.is-online::before { animation: none; } }

.rc-chat-badge { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: #b3352c; color: #fff; font-size: .72rem; font-weight: 700; line-height: 20px; text-align: center; z-index: 2; }
.rc-chat-badge[hidden] { display: none; }

.rc-chat-panel { width: min(360px, calc(100vw - 32px)); height: min(520px, calc(100vh - 110px)); display: flex; flex-direction: column;
  background: var(--c-card); border: 1px solid var(--c-line); border-radius: 16px; overflow: hidden;
  box-shadow: 0 14px 40px rgba(27, 42, 51, .22); }
.rc-chat-panel[hidden] { display: none; }
.rc-chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--c-brand); color: #fff;
  box-shadow: inset 0 -3px 0 0 var(--color-accent, #F0A443); }
.rc-chat-head h3 { margin: 0; flex: 1; font-size: 1rem; font-family: var(--font-heading, Georgia, serif); color: #fff; }
.rc-chat-head p { margin: 2px 0 0; font-size: .78rem; opacity: .9; }
.rc-chat-icon-btn { background: none; border: none; color: #fff; font-size: 1.3rem; line-height: 1; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.rc-chat-icon-btn:hover, .rc-chat-icon-btn:focus-visible { background: rgba(255, 255, 255, .15); }

.rc-chat-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; background: #fbfaf7; }
.rc-chat-greeting { font-size: .9rem; color: var(--c-muted); margin: 0 0 4px; }
.rc-chat-msg { max-width: 85%; padding: 7px 11px; border-radius: 12px; font-size: .9rem; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.rc-chat-msg small { display: block; font-size: .72rem; opacity: .75; margin-bottom: 2px; }
.rc-chat-msg.from-visitor { align-self: flex-end; background: var(--c-brand); color: #fff; border-bottom-right-radius: 4px; }
.rc-chat-msg.from-staff { align-self: flex-start; background: var(--c-soft); border-bottom-left-radius: 4px; }
.rc-chat-msg.from-system { align-self: center; background: none; color: var(--c-muted); font-size: .8rem; font-style: italic; text-align: center; }

.rc-chat-form { display: grid; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--c-line); background: var(--c-card); }
.rc-chat-form input, .rc-chat-form textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: .9rem; color: var(--c-ink);
  border: 1px solid var(--c-line); border-radius: 8px; padding: 8px 10px; background: #fff; }
.rc-chat-form textarea { resize: none; min-height: 60px; }
.rc-chat-form input:focus, .rc-chat-form textarea:focus { outline: 2px solid var(--c-brand); outline-offset: 0; border-color: var(--c-brand); }
.rc-chat-form label { font-size: .78rem; font-weight: 600; color: var(--c-muted); margin: 0; }
.rc-chat-row { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.rc-chat-send { background: var(--c-brand); color: #fff; border: none; border-radius: 999px; padding: 8px 18px; font: 700 .9rem inherit; cursor: pointer; }
.rc-chat-send:disabled { opacity: .6; cursor: default; }
.rc-chat-link { background: none; border: none; color: var(--c-muted); font: inherit; font-size: .8rem; text-decoration: underline; cursor: pointer; padding: 0; }
.rc-chat-error { color: #b3352c; font-size: .82rem; margin: 0; }
.rc-chat-error:empty { display: none; }
/* Only robots fill this in. */
.rc-chat-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
