/* R&W Bundaberg chat widget. All classes prefixed rwc- to avoid clashes. */
.rwc{
  --rwc-navy:#151d2b; --rwc-navy-2:#1f2a3c; --rwc-red:#d91f35; --rwc-red-dk:#b5172a;
  --rwc-cream:#f4ede3; --rwc-ink:#1a2230; --rwc-muted:#6b7280; --rwc-line:#e6dfd3;
  font-family:inherit; color:var(--rwc-ink); font-size:15px; line-height:1.5; text-align:left; letter-spacing:normal; text-transform:none;
  position:fixed; right:20px; bottom:calc(20px + env(safe-area-inset-bottom,0px)); z-index:2147483000;
}
.rwc *{ box-sizing:border-box; }
.rwc button, .rwc input, .rwc textarea, .rwc select{ font:inherit; }

/* Launcher */
.rwc-launch{
  display:flex; align-items:center; gap:10px; margin-left:auto;
  background:var(--rwc-red); color:#fff; border:0; cursor:pointer;
  padding:12px 18px 12px 12px; border-radius:999px; font-weight:700; font-size:14px;
  box-shadow:0 10px 28px -8px rgba(21,29,43,.55);
}
.rwc-launch:hover{ background:var(--rwc-red-dk); }
.rwc-launch:focus-visible, .rwc button:focus-visible, .rwc a:focus-visible{ outline:3px solid #ffd166; outline-offset:2px; }
.rwc-launch img{ width:36px; height:36px; border-radius:50%; object-fit:cover; border:2px solid #fff; }
.rwc-launch svg{ width:22px; height:22px; }
.rwc.is-open .rwc-launch{ display:none; }

.rwc-nudge{
  position:absolute; right:0; bottom:64px; width:230px; background:#fff; border:1px solid var(--rwc-line);
  padding:12px 34px 12px 14px; font-size:14px; box-shadow:0 10px 24px -10px rgba(21,29,43,.4); border-radius:10px;
}
.rwc-nudge button{ position:absolute; top:6px; right:6px; background:none; border:0; color:var(--rwc-muted); cursor:pointer; font-size:18px; line-height:1; padding:4px; }
.rwc-nudge[hidden]{ display:none; }

/* Panel */
.rwc-panel{
  width:380px; height:min(600px, calc(100vh - 40px)); background:#fff; display:none; flex-direction:column;
  border-radius:14px; overflow:hidden; box-shadow:0 24px 60px -18px rgba(21,29,43,.6);
  border:1px solid rgba(21,29,43,.08);
}
.rwc.is-open .rwc-panel{ display:flex; }

.rwc-head{ background:var(--rwc-navy); color:#fff; padding:14px 14px 14px 16px; display:flex; align-items:center; gap:12px; border-bottom:3px solid var(--rwc-red); }
.rwc-avatar{ position:relative; flex:none; width:44px; height:44px; }
.rwc-head img{ width:44px; height:44px; border-radius:50%; object-fit:cover; border:2px solid var(--rwc-red); display:block; }
.rwc-ai{ position:absolute; right:-4px; bottom:-3px; background:#fff; color:var(--rwc-navy); font-size:9px; font-weight:800; line-height:1; padding:3px 4px; border-radius:6px; border:1.5px solid var(--rwc-navy); letter-spacing:.02em; }
.rwc-head__txt{ flex:1; min-width:0; }
.rwc-head__title{ font-weight:700; font-size:15px; margin:0; color:#fff; }
.rwc-head__sub{ font-size:12px; color:rgba(255,255,255,.65); margin:0; }
.rwc-iconbtn{ background:none; border:0; color:#fff; cursor:pointer; padding:8px; border-radius:8px; display:flex; }
.rwc-iconbtn:hover{ background:rgba(255,255,255,.1); }
.rwc-iconbtn svg{ width:20px; height:20px; }

.rwc-agentbar{ display:flex; justify-content:space-between; align-items:center; gap:10px; padding:9px 16px; background:var(--rwc-cream); font-size:13px; border-bottom:1px solid var(--rwc-line); }
.rwc-agentbar a{ color:var(--rwc-ink); font-weight:600; text-decoration:none; }
.rwc-linkbtn{ background:none; border:0; padding:0; color:var(--rwc-red); font-weight:700; cursor:pointer; font-size:13px; text-decoration:underline; text-underline-offset:3px; }

/* Messages */
.rwc-body{ flex:1; overflow-y:auto; padding:16px; background:#faf8f4; overscroll-behavior:contain; }
.rwc-msg{ max-width:85%; margin:0 0 10px; padding:10px 13px; border-radius:14px; white-space:pre-wrap; word-wrap:break-word; }
.rwc-msg--bot{ background:#fff; border:1px solid var(--rwc-line); border-bottom-left-radius:4px; }
.rwc-msg--user{ background:var(--rwc-navy); color:#fff; margin-left:auto; border-bottom-right-radius:4px; }
.rwc-msg--note{ background:none; border:0; color:var(--rwc-muted); font-size:12px; text-align:center; max-width:100%; padding:2px 8px 10px; }
.rwc-msg a{ color:var(--rwc-red); font-weight:600; }
.rwc-msg--user a{ color:#fff; }
.rwc-handoff{ display:inline-block; margin:0 0 12px; background:var(--rwc-red); color:#fff; border:0; padding:10px 14px; border-radius:8px; font-weight:700; font-size:14px; cursor:pointer; }
.rwc-handoff:hover{ background:var(--rwc-red-dk); }

.rwc-typing{ display:inline-flex; gap:4px; padding:12px 14px; }
.rwc-typing span{ width:7px; height:7px; border-radius:50%; background:#b8b2a8; animation:rwc-blink 1.2s infinite ease-in-out; }
.rwc-typing span:nth-child(2){ animation-delay:.15s; } .rwc-typing span:nth-child(3){ animation-delay:.3s; }
@keyframes rwc-blink{ 0%,80%,100%{ opacity:.3 } 40%{ opacity:1 } }

.rwc-chips{ display:flex; flex-wrap:wrap; gap:8px; margin:4px 0 8px; }
.rwc-chip{ background:#fff; border:1px solid var(--rwc-red); color:var(--rwc-red); padding:7px 12px; border-radius:999px; font-size:13px; font-weight:600; cursor:pointer; }
.rwc-chip:hover{ background:var(--rwc-red); color:#fff; }

.rwc-input{ display:flex; gap:8px; padding:10px; border-top:1px solid var(--rwc-line); background:#fff; }
.rwc-input textarea{
  flex:1; resize:none; border:1px solid var(--rwc-line); border-radius:10px; padding:10px 12px; font-size:16px; /* 16px stops iOS zoom */
  max-height:110px; min-height:44px; line-height:1.4; color:var(--rwc-ink); background:#fff;
}
.rwc-input textarea:focus{ outline:none; border-color:var(--rwc-navy); }
.rwc-send{ background:var(--rwc-red); color:#fff; border:0; border-radius:10px; width:46px; cursor:pointer; display:flex; align-items:center; justify-content:center; }
.rwc-send:disabled{ background:#d9c9cb; cursor:default; }
.rwc-send svg{ width:20px; height:20px; }
.rwc-foot{ font-size:11px; color:var(--rwc-muted); text-align:center; padding:0 12px 8px; background:#fff; }

/* Contact form */
.rwc-form{ flex:1; overflow-y:auto; padding:18px 16px; background:#fff; }
.rwc-form h3{ margin:0 0 4px; font-size:17px; }
.rwc-form > p{ margin:0 0 16px; color:var(--rwc-muted); font-size:14px; }
.rwc-field{ margin:0 0 12px; }
.rwc-field label{ display:block; font-size:13px; font-weight:600; margin:0 0 4px; }
.rwc-field input, .rwc-field textarea, .rwc-field select{
  width:100%; border:1px solid var(--rwc-line); border-radius:8px; padding:10px 12px; font-size:16px; color:var(--rwc-ink); background:#fff;
}
.rwc-field textarea{ min-height:84px; resize:vertical; }
.rwc-field input:focus, .rwc-field textarea:focus, .rwc-field select:focus{ outline:none; border-color:var(--rwc-navy); }
.rwc-row{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.rwc-pref{ display:flex; gap:8px; flex-wrap:wrap; }
.rwc-pref label{ display:flex; align-items:center; gap:6px; font-weight:500; border:1px solid var(--rwc-line); border-radius:999px; padding:6px 12px; cursor:pointer; margin:0; }
.rwc-pref input{ width:auto; accent-color:var(--rwc-red); }
.rwc-err{ color:var(--rwc-red-dk); font-size:13px; margin:0 0 10px; min-height:1em; }
.rwc-submit{ width:100%; background:var(--rwc-red); color:#fff; border:0; border-radius:8px; padding:13px; font-weight:700; cursor:pointer; font-size:15px; }
.rwc-submit:disabled{ opacity:.6; cursor:default; }
.rwc-privacy{ font-size:12px; color:var(--rwc-muted); margin:10px 0 0; }
.rwc-back{ background:none; border:0; color:var(--rwc-muted); cursor:pointer; font-size:13px; padding:0; margin:0 0 12px; }
.rwc-done{ text-align:center !important; padding:40px 20px; }
.rwc-done svg{ width:48px; height:48px; color:var(--rwc-red); }
.rwc-done h3{ margin:12px 0 6px; }
.rwc-done p{ color:var(--rwc-muted); margin:0 0 16px; }

[data-view] { display:none; }
.rwc[data-current="chat"] [data-view="chat"],
.rwc[data-current="form"] [data-view="form"],
.rwc[data-current="done"] [data-view="done"]{ display:flex; flex-direction:column; flex:1; min-height:0; }

/* Phones: full screen */
@media (max-width:480px){
  .rwc{ right:14px; bottom:calc(14px + env(safe-area-inset-bottom,0px)); }
  .rwc.is-open{ inset:0; right:0; bottom:0; }
  .rwc.is-open .rwc-panel{ width:100%; height:100%; border-radius:0; border:0; padding-top:env(safe-area-inset-top,0px); padding-bottom:env(safe-area-inset-bottom,0px); }
  .rwc-launch span{ display:none; }
  .rwc-launch{ padding:10px; }
  .rwc-row{ grid-template-columns:1fr; }
}
@media (prefers-reduced-motion:reduce){ .rwc-typing span{ animation:none; opacity:.7; } }
