/* webchat.css — the shop-site chat in the POS (Luis, 2026-10-06).
   Opened from the chat bell in the top bar on every page (webchat.js) as a
   window centred over the page, after Luis's reference: a pale frame, a white
   card with "Messages" on the left and the conversation on the right, the
   conversation in a soft grey well with the message bar inside it. Ink for
   the shop's own bubbles, white for the customer's, the in-house green for
   "online", the house red for the open row and unread counts. Linked from
   topbar.php, so it is on every page that has the bar. */

/* The bell's glyph shows whatever theme is on (the other bells' .lq-ico only
   shows under Apple). */
.wc-bell .lq-ico { display: block; }

/* ── The window ── */
html.wc-lock { overflow: hidden; }
.wc-overlay {
  position: fixed; inset: 0; z-index: 1500;
  display: none; align-items: center; justify-content: center; padding: 24px;
  background: rgba(15, 17, 21, 0.38);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.wc-overlay.open { display: flex; animation: wcFade .2s ease; }
@keyframes wcFade { from { opacity: 0; } to { opacity: 1; } }
.wc-panel {
  width: min(1180px, 100%); height: min(800px, calc(100vh - 48px));
  display: flex; flex-direction: column; gap: 12px; box-sizing: border-box;
  padding: 16px 20px 20px; border-radius: 28px;
  background: #eceef1; color: #1d1d1f;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.6) inset;
  font-family: var(--ap-font, var(--font-ui, inherit)); font-size: 13.5px;
}
.wc-overlay.open .wc-panel { animation: wcPop .42s var(--ease-liquid, ease); }
@keyframes wcPop { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }

.wc-top { display: flex; align-items: center; gap: 12px; padding: 0 2px; }
.wc-back-link { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 4px 2px; font: inherit; font-size: 13px; font-weight: 600; color: #3a3a3c; cursor: pointer; }
.wc-back-link:hover { color: #000; }
.wc-top-src { font-size: 12px; color: #8e8e93; }
.wc-x { margin-left: auto; border: 0; background: rgba(0, 0, 0, 0.06); width: 32px; height: 32px; border-radius: 50%; font-size: 18px; line-height: 1; cursor: pointer; color: #1d1d1f; flex: 0 0 auto; }
.wc-x:hover { background: rgba(0, 0, 0, 0.1); }

.wc-card {
  flex: 1; min-height: 0; display: grid; grid-template-columns: 320px minmax(0, 1fr);
  background: #ffffff; border-radius: 16px; overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 10px 30px rgba(0, 0, 0, 0.06);
}

/* ── Messages (the list) ── */
.wc-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid #efeff2; }
.wc-side-head { display: flex; align-items: center; gap: 10px; padding: 22px 20px 14px; }
.wc-side-head b { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.wc-count { margin-left: auto; font-size: 11.5px; font-weight: 700; color: #6e6e73; background: #f2f2f5; border-radius: 999px; padding: 3px 9px; }
.wc-count:empty { display: none; }
.wc-count.new { color: #ffffff; background: #e5484d; }
.wc-search { display: flex; align-items: center; gap: 8px; margin: 0 16px 12px; }
.wc-search input { flex: 1; min-width: 0; height: 40px; box-sizing: border-box; border: 1px solid #e5e5ea; border-radius: 10px; padding: 0 12px; font: inherit; font-size: 13px; color: #1d1d1f; background: #fafafb; }
.wc-search input:focus { outline: none; border-color: #0066cc; background: #fff; box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.12); }
.wc-filter { position: relative; width: 38px; height: 38px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; border: 1px solid #e5e5ea; border-radius: 10px; background: #fff; color: #3a3a3c; cursor: pointer; }
.wc-filter:hover { background: #f5f5f7; }
.wc-filter.on { background: #1d1d1f; border-color: #1d1d1f; color: #fff; }
.wc-list { flex: 1; overflow-y: auto; border-top: 1px solid #efeff2; }
.wc-row { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid #f2f2f4; background: transparent; padding: 14px 18px; cursor: pointer; font: inherit; color: inherit; }
.wc-row:hover { background: #fafafb; }
.wc-row.on { background: #f6f6f8; }
.wc-row.on::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: #e5484d; }
.wc-row-txt { flex: 1; min-width: 0; }
.wc-row-top { display: flex; align-items: baseline; gap: 8px; }
.wc-row-top b { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wc-row-top time { margin-left: auto; font-size: 11.5px; color: #8e8e93; white-space: nowrap; }
.wc-row-bot { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.wc-row-bot p { flex: 1; min-width: 0; margin: 0; font-size: 12.5px; color: #6e6e73; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wc-row.unread .wc-row-bot p { color: #1d1d1f; font-weight: 600; }
.wc-n { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #e5484d; color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.wc-row.closed { opacity: .55; }
.wc-divider { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: #8e8e93; padding: 14px 18px 6px; background: #fafafb; border-bottom: 1px solid #f2f2f4; }
.wc-none { padding: 34px 18px; text-align: center; color: #8e8e93; font-size: 12.5px; line-height: 1.5; }

/* ── Avatars: initials on a colour that follows the name ── */
.wc-av { position: relative; flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #ffffff; font-size: 15px; font-weight: 700; letter-spacing: .02em; }
.wc-av.sm { width: 32px; height: 32px; font-size: 12px; }
.wc-av.lg { width: 84px; height: 84px; font-size: 28px; box-shadow: 0 0 0 4px #ffffff, 0 8px 24px rgba(0, 0, 0, 0.12); }
.wc-av.me { background: #1d1d1f !important; }
.wc-av-dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: #c7c7cc; border: 2px solid #ffffff; }
.wc-av-dot.on { background: #34c759; }

/* ── The conversation ── */
.wc-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.wc-head { display: flex; align-items: center; gap: 16px; padding: 16px 22px; }
.wc-head-who { min-width: 0; }
.wc-head-who b { display: block; font-size: 16px; font-weight: 700; }
.wc-head-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 4px; font-size: 12px; color: #6e6e73; }
.wc-head-line a { color: #0066cc; text-decoration: none; }
.wc-head-line a:hover { text-decoration: underline; }
.wc-state { display: inline-flex; align-items: center; gap: 6px; }
.wc-state i { width: 7px; height: 7px; border-radius: 50%; background: #c7c7cc; }
.wc-state.on { color: #3f7a68; font-weight: 600; }
.wc-state.on i { background: #34c759; box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.18); }
.wc-ctx { display: flex; align-items: center; gap: 10px; margin-left: auto; min-width: 0; }
.wc-ctx-img { width: 42px; height: 42px; border-radius: 9px; object-fit: cover; flex: 0 0 auto; }
.wc-ctx b { display: block; font-size: 14px; font-weight: 700; white-space: nowrap; }
.wc-ctx span { display: flex; align-items: center; gap: 4px; margin-top: 2px; font-size: 12px; color: #8e8e93; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.wc-btn { border: 1px solid rgba(0, 0, 0, 0.12); background: #fff; color: #1d1d1f; border-radius: 999px; padding: 7px 14px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; flex: 0 0 auto; }
.wc-btn:hover { background: #f5f5f7; }
.wc-back { display: none; }

.wc-thread { flex: 1; min-height: 0; display: flex; flex-direction: column; margin: 0 18px 18px; border-radius: 16px; background: #eef0f3; overflow: hidden; }
.wc-msgs { flex: 1; overflow-y: auto; padding: 24px 28px 12px; }
.wc-intro { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0 2px; text-align: center; }
.wc-intro b { margin-top: 12px; font-size: 17px; font-weight: 700; }
.wc-intro .wc-intro-sub { font-size: 12.5px; color: #8e8e93; }
.wc-day { display: flex; align-items: center; gap: 14px; margin: 18px 0 16px; color: #9a9aa0; font-size: 12px; }
.wc-day::before, .wc-day::after { content: ""; flex: 1; height: 1px; background: #d9dce1; }
.wc-m { display: flex; align-items: flex-end; gap: 10px; margin: 0 0 12px; max-width: 78%; }
.wc-m.staff { margin-left: auto; justify-content: flex-end; }
.wc-m.sys { max-width: 100%; justify-content: center; }
.wc-col { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.wc-m.staff .wc-col { align-items: flex-end; }
.wc-bub { padding: 10px 14px; border-radius: 12px; white-space: pre-wrap; word-wrap: break-word; line-height: 1.45; font-size: 13.5px; }
.wc-m.cust .wc-bub { background: #ffffff; border-bottom-left-radius: 4px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06); }
.wc-m.staff .wc-bub { background: #1d1d1f; color: #ffffff; border-bottom-right-radius: 4px; }
.wc-m.sys .wc-bub { background: none; color: #8e8e93; font-size: 12px; text-align: center; padding: 2px 8px; }
.wc-meta { font-size: 10.5px; color: #8e8e93; margin: 4px 2px 0; }
.wc-meta .bad { color: #c02b22; font-weight: 600; }
.wc-meta .good { color: #3f7a68; font-weight: 600; }
.wc-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 30px; text-align: center; color: #8e8e93; line-height: 1.5; }
.wc-empty b { color: #1d1d1f; font-size: 16px; font-weight: 700; }
.wc-empty-ico { color: #c7c7cc; margin-bottom: 4px; }

/* ── The message bar, inside the grey well ── */
.wc-compose { padding: 10px 14px 12px; }
.wc-compose-bar { display: flex; align-items: flex-end; gap: 10px; background: #ffffff; border-radius: 12px; padding: 7px 7px 7px 14px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06); }
.wc-compose-bar:focus-within { box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15), 0 1px 3px rgba(0, 0, 0, 0.06); }
.wc-compose textarea { flex: 1; min-width: 0; resize: none; border: 0; outline: none; background: transparent; min-height: 40px; max-height: 140px; padding: 10px 0; box-sizing: border-box; font: inherit; font-size: 14px; color: #1d1d1f; }
/* The theme dresses every textarea (border, ring, fill) and outranks the line
   above (apple.css :is(input, select, textarea):not(...):focus, specificity 0-3-2); inside the bar
   the bar is the field, so the textarea stays bare. */
.wc-overlay .wc-panel .wc-compose-bar textarea,
.wc-overlay .wc-panel .wc-compose-bar textarea:focus,
.wc-overlay .wc-panel .wc-compose-bar textarea:focus-visible { border: 0 !important; outline: none !important; box-shadow: none !important; background: transparent !important; border-radius: 0 !important; }
/* The hint clears once the box is clicked into (Luis, 2026-10-06) — the same
   way the top bar's search does — and comes back if it is left empty. */
.wc-overlay .wc-panel .wc-compose-bar textarea:focus::placeholder { color: transparent !important; }
.wc-send { width: 44px; height: 44px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 10px; background: #1d1d1f; color: #ffffff; cursor: pointer; }
.wc-send:hover { background: #000; }
.wc-send:disabled { opacity: .45; cursor: default; }
.wc-compose-opts { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; padding: 8px 4px 0; }
.wc-text { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: #3a3a3c; cursor: pointer; }
.wc-text input { width: 16px; height: 16px; margin: 0; }
.wc-text.off { color: #a1a1a6; cursor: default; }
.wc-err { color: #c02b22; font-size: 12px; display: none; }

/* Medium screens: the "started on" card gives its room to the name. */
@media (max-width: 1100px) { .wc-ctx { display: none; } .wc-card { grid-template-columns: 280px minmax(0, 1fr); } }
/* Narrow (and the iPad in portrait): one pane at a time, the window fills the screen. */
@media (max-width: 860px) {
  .wc-overlay { padding: 0; }
  .wc-panel { width: 100%; height: 100%; border-radius: 0; padding: 10px; }
  .wc-card { grid-template-columns: minmax(0, 1fr); }
  .wc-panel.has-thread .wc-side { display: none; }
  .wc-panel:not(.has-thread) .wc-main { display: none; }
  .wc-back { display: inline-flex; }
  .wc-thread { margin: 0 10px 10px; }
  .wc-msgs { padding: 18px 14px 10px; }
}

/* ── Dark Apple ── */
body.apple-dark .wc-panel { background: #1a1a1c; color: #fffdfb; box-shadow: 0 40px 100px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.06); }
body.apple-dark .wc-card { background: #111111; box-shadow: none; }
body.apple-dark .wc-side, body.apple-dark .wc-list, body.apple-dark .wc-row, body.apple-dark .wc-divider { border-color: rgba(255, 255, 255, 0.07); }
body.apple-dark .wc-row:hover, body.apple-dark .wc-divider { background: rgba(255, 255, 255, 0.04); }
body.apple-dark .wc-row.on { background: #1c1c1e; }
body.apple-dark .wc-row.unread .wc-row-bot p, body.apple-dark .wc-empty b, body.apple-dark .wc-x, body.apple-dark .wc-btn,
body.apple-dark .wc-back-link, body.apple-dark .wc-compose textarea, body.apple-dark .wc-search input { color: #fffdfb; }
body.apple-dark .wc-search input, body.apple-dark .wc-filter, body.apple-dark .wc-btn { background: #1c1c1e; border-color: rgba(255, 255, 255, 0.12); color: #fffdfb; }
body.apple-dark .wc-count { background: rgba(255, 255, 255, 0.08); color: rgba(255, 253, 251, 0.75); }
body.apple-dark .wc-x { background: rgba(255, 255, 255, 0.1); }
body.apple-dark .wc-thread { background: #0b0b0c; }
body.apple-dark .wc-day::before, body.apple-dark .wc-day::after { background: rgba(255, 255, 255, 0.1); }
body.apple-dark .wc-m.cust .wc-bub, body.apple-dark .wc-compose-bar { background: #1c1c1e; box-shadow: none; }
body.apple-dark .wc-m.staff .wc-bub, body.apple-dark .wc-send, body.apple-dark .wc-filter.on { background: #fffdfb; color: #080808; }
body.apple-dark .wc-av.me { background: #fffdfb !important; color: #080808; }
body.apple-dark .wc-av.lg { box-shadow: 0 0 0 4px #111111, 0 8px 24px rgba(0, 0, 0, 0.4); }
body.apple-dark .wc-av-dot { border-color: #111111; }
body.apple-dark .wc-text { color: rgba(255, 253, 251, 0.75); }

/* ── Hard to miss (Luis, 2026-10-06: "these chats are very important for us") ──
   While anything is unread the bell turns red and its ring pulses — the bells'
   own hover ring, in red and always on — and a banner drops in under the bar. */
.wc-bell { position: relative; }
/* By id: the theme paints these buttons through a selector list that holds an
   id (#topbarSearch), which outranks any class-only rule. */
#webChatWrap #webChatBtn.wc-alert { background: #e5484d !important; border-color: #e5484d !important; }
#webChatWrap #webChatBtn.wc-alert:hover { background: #c93a3f !important; }
#webChatWrap #webChatBtn.wc-alert .lq-ico { color: #ffffff !important; }
.topbar-bells .topbar-icon-btn.wc-bell.wc-alert::after {
  border: 2px solid rgba(229, 72, 77, 0.9);
  animation: tb-ring 1.4s ease-out infinite;
}

.wc-banner {
  position: fixed; top: 76px; right: 16px; z-index: 1600;
  width: 390px; max-width: calc(100vw - 32px); box-sizing: border-box;
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 14px 14px 14px; border-radius: 20px; cursor: pointer;
  background: #ffffff; color: #1d1d1f;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.24), 0 0 0 1px rgba(0, 0, 0, 0.06), inset 0 3px 0 #e5484d;
  font-family: var(--ap-font, var(--font-ui, inherit));
  opacity: 0; transform: translateY(-16px) scale(.96); pointer-events: none;
  transition: opacity .18s cubic-bezier(.4, 0, 1, 1), transform .18s cubic-bezier(.4, 0, 1, 1);
}
.wc-banner.show {
  opacity: 1; transform: none; pointer-events: auto;
  transition: opacity .2s ease, transform .42s var(--ease-liquid, ease);
}
.wc-banner-ico {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #e5484d; color: #ffffff;
  animation: wcGlow 1.8s ease-out infinite;
}
@keyframes wcGlow { 0% { box-shadow: 0 0 0 0 rgba(229, 72, 77, 0.55); } 100% { box-shadow: 0 0 0 14px rgba(229, 72, 77, 0); } }
.wc-banner-txt { flex: 1; min-width: 0; }
.wc-banner-top { display: flex; align-items: center; gap: 6px; }
.wc-banner-name { display: block; margin-top: 2px; font-size: 15.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wc-banner-src { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #e5484d; white-space: nowrap; }
.wc-banner-top time { font-size: 11px; color: #86868b; white-space: nowrap; }
.wc-banner-top time::before { content: "\00b7"; margin-right: 6px; }
.wc-banner p {
  margin: 4px 0 0; font-size: 13.5px; line-height: 1.4; color: #3a3a3c;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word;
}
.wc-banner small { display: block; margin-top: 5px; font-size: 11.5px; font-weight: 600; color: #e5484d; }
.wc-banner-act { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: 0 0 auto; }
.wc-banner-go { border: 0; background: #1d1d1f; color: #ffffff; border-radius: 999px; padding: 8px 16px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.wc-banner-go:hover { background: #000000; }
.wc-banner-x { border: 0; background: rgba(0, 0, 0, 0.06); color: #6e6e73; width: 26px; height: 26px; border-radius: 50%; font-size: 16px; line-height: 1; cursor: pointer; }
.wc-banner-x:hover { background: rgba(0, 0, 0, 0.1); color: #1d1d1f; }
/* A second message while it is already up: a short shake. */
.wc-banner.show.nudge { animation: wcNudge .55s ease; }
@keyframes wcNudge { 0%, 100% { transform: none; } 20% { transform: translateX(-7px); } 45% { transform: translateX(6px); } 70% { transform: translateX(-3px); } }
@media (prefers-reduced-motion: reduce) {
  .wc-banner-ico, .wc-banner.show.nudge, .topbar-bells .topbar-icon-btn.wc-bell.wc-alert::after { animation: none; }
  .topbar-bells .topbar-icon-btn.wc-bell.wc-alert::after { opacity: 1; }
}
body.apple-dark .wc-banner { background: #1c1c1e; color: #fffdfb; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08), inset 0 3px 0 #e5484d; }
body.apple-dark .wc-banner p { color: rgba(255, 253, 251, 0.8); }
body.apple-dark .wc-banner-go { background: #fffdfb; color: #080808; }
body.apple-dark .wc-banner-x { background: rgba(255, 255, 255, 0.1); color: rgba(255, 253, 251, 0.7); }

/* ── "typing…" (Luis, 2026-10-06) ── three dots, iMessage style, at the end
   of the thread while the customer types; the list row says it too. */
.wc-typing { display: inline-flex; align-items: center; gap: 4px; padding: 12px 14px !important; }
.wc-typing span { width: 7px; height: 7px; border-radius: 50%; background: #a1a1a6; animation: wcDot 1.2s ease-in-out infinite; }
.wc-typing span:nth-child(2) { animation-delay: .18s; }
.wc-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes wcDot { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.wc-row p.wc-row-typing { color: #3f7a68; font-style: italic; font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .wc-typing span { animation: none; opacity: .7; } }
body.apple-dark .wc-typing span { background: rgba(255, 253, 251, 0.55); }
