/* Help Centre chat: the /help/contact conversation starter and the
   /help/tickets/{n} conversation (templ HelpContact / HelpTicket,
   pages/help.js). Builds on the --hc-* tokens in pages/help.css; the help
   pages are light-locked (ThemeLightLock) so there is no dark variant. */

.hc-chat-hero.hc-hero-sm { padding-bottom: 120px; }
.hc-chat-section { padding-top: 0; }
.hc-chat-section > .container { position: relative; z-index: 2; margin-top: -96px; }
.hc-contact-page .hc-chat-section > .container { margin-top: -80px; }
.hc-contact-page .hc-chat-hero.hc-hero-sm { padding-bottom: 104px; }
.hc-contact-page .hc-contact-side { padding-top: 96px; }
@media (max-width: 991px) { .hc-contact-page .hc-contact-side { padding-top: 0; } }

.hc-chat { max-width: 860px; margin: 0 auto; background: #fff; border: 1px solid var(--hc-line); border-radius: 26px; box-shadow: 0 30px 70px rgba(13, 46, 84, .16); display: flex; flex-direction: column; overflow: hidden; }
.hc-contact-grid .hc-chat { margin: 0; max-width: none; }

/* Head */
.hc-chat-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--hc-line); background: linear-gradient(180deg, #fbfdff, #fff); }
.hc-chat-title { flex: 1; min-width: 0; line-height: 1.25; }
.hc-chat-title b { display: block; color: var(--hc-ink); font-size: 15.5px; }
.hc-chat-title small { color: var(--hc-muted); font-size: 12.5px; }
.hc-chat-head .hc-chat-av.active + .hc-chat-title small { color: #059669; font-weight: 600; }
.hc-chat-sub { padding: 14px 20px 0; }
.hc-chat-sub h1 { font-size: clamp(18px, 2.4vw, 22px); font-weight: 800; color: var(--hc-ink); letter-spacing: -.3px; margin: 0 0 2px; }
.hc-chat-sub { padding-bottom: 10px; border-bottom: 1px solid var(--hc-line); }
.hc-chat-sub small { display: block; color: var(--hc-muted); font-size: 12.5px; line-height: 1.45; }

/* Avatars */
.hc-chat-av { position: relative; width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center; }
.hc-chat-av img { width: 22px; height: 22px; }
.hc-bubble-row .hc-chat-av img, .hc-chat-av.team { background: #fff; border: 1px solid var(--hc-line); border-radius: 50%; }
.hc-bubble-row .hc-chat-av img { width: 34px; height: 34px; padding: 6px; }
.hc-bubble-row.joined .hc-chat-av { visibility: hidden; height: 0; }
.hc-chat-av.team { width: 42px; height: 42px; box-shadow: 0 6px 16px rgba(13, 46, 84, .1); }
.hc-chat-av.team img { width: 26px; height: 26px; }
.hc-chat-av.team::after { content: ""; position: absolute; right: 0; bottom: 0; width: 11px; height: 11px; border-radius: 50%; background: #cbd5e1; border: 2px solid #fff; }
.hc-chat-av.team.active::after { background: #10b981; box-shadow: 0 0 0 0 rgba(16, 185, 129, .5); animation: hcPing 2s infinite; }
@keyframes hcPing { 70% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); } 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); } }

/* Log */
.hc-chat-log { display: flex; flex-direction: column; gap: 4px; padding: 18px 20px 22px; overflow-y: auto; overscroll-behavior: contain; min-height: 280px; max-height: min(62vh, 680px); scroll-behavior: smooth; }
.hc-contact-page .hc-chat-log { max-height: min(58vh, 560px); }
.hc-chat-intro { align-self: center; text-align: center; font-size: 12px; color: var(--hc-muted); background: var(--hc-surface-2); border-radius: 999px; padding: 6px 12px; margin-bottom: 10px; }
.hc-chat-intro i { margin-right: 4px; font-size: 11px; }
.hc-chat-day, .hc-chat-sys { display: flex; justify-content: center; margin: 12px 0 6px; }
.hc-chat-day span { font-size: 11.5px; font-weight: 700; letter-spacing: .4px; color: var(--hc-muted); text-transform: uppercase; }
.hc-chat-sys span { font-size: 12.5px; color: var(--hc-muted); background: var(--hc-surface-2); border-radius: 999px; padding: 4px 12px; max-width: 90%; text-align: center; }

/* Bubbles */
.hc-bubble-row { display: flex; align-items: flex-end; gap: 8px; margin-top: 10px; max-width: 100%; animation: hcIn .28s cubic-bezier(.2, .9, .3, 1.2) both; }
.hc-bubble-row.joined { margin-top: 2px; }
.hc-bubble-row.me { justify-content: flex-end; }
.hc-bubble { position: relative; max-width: min(78%, 560px); padding: 10px 14px 8px; border-radius: 20px; font-size: 15px; line-height: 1.5; }
.hc-bubble-row.me .hc-bubble { background: #f1f5fa; color: var(--hc-ink); border-bottom-right-radius: 6px; }
.hc-bubble-row.them .hc-bubble { background: #eaf3ff; color: #1d2f45; border-bottom-left-radius: 6px; }
.hc-bubble-row.me.joined .hc-bubble { border-top-right-radius: 6px; }
.hc-bubble-row.them.joined .hc-bubble { border-top-left-radius: 6px; }
.hc-bubble-who { display: block; font-size: 12.5px; font-weight: 700; color: var(--hc-blue-deep); margin-bottom: 2px; }
.hc-bubble-text p { margin: 0; color: inherit; font-size: 15px; line-height: 1.5; word-break: break-word; white-space: pre-wrap; }
.hc-bubble-text p + p { margin-top: 4px; }
.hc-bubble-meta { display: flex; justify-content: flex-end; align-items: center; gap: 5px; font-size: 11px; color: var(--hc-muted); margin-top: 2px; }
.hc-bubble-meta .hc-tick { color: var(--hc-blue); }
.hc-bubble-row.sending .hc-bubble { opacity: .65; }
.hc-bubble-row.failed .hc-bubble { background: #fff1f2; box-shadow: inset 0 0 0 1px #fecdd3; cursor: pointer; }
.hc-bubble-row.failed .hc-bubble-meta { color: #be123c; }
.hc-bubble .hc-atts { margin-top: 6px; }
.hc-bubble .hc-atts span { background: rgba(255, 255, 255, .7); }
@keyframes hcIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .hc-bubble-row, .hc-chat-chips, .hc-typing i, .hc-dots i, .hc-chat-av.team.active::after { animation: none !important; } .hc-chat-log { scroll-behavior: auto; } }

/* Waiting + typing */
.hc-chat-wait { display: flex; align-items: center; gap: 10px; align-self: flex-end; margin-top: 8px; font-size: 12.5px; color: var(--hc-muted); max-width: 78%; text-align: right; }
.hc-chat-wait[hidden] { display: none; }
.hc-dots { display: inline-flex; gap: 3px; flex: 0 0 auto; }
.hc-dots i, .hc-typing i { width: 6px; height: 6px; border-radius: 50%; background: #9fb3c8; animation: hcDot 1.2s infinite ease-in-out; }
.hc-dots i:nth-child(2), .hc-typing i:nth-child(2) { animation-delay: .15s; }
.hc-dots i:nth-child(3), .hc-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes hcDot { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.hc-typing { display: inline-flex; gap: 4px; padding: 6px 2px; }

/* Quick-reply chips */
.hc-chat-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0 42px; animation: hcIn .3s .1s both; }
.hc-chip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid #cfe0f5; background: #fff; color: var(--hc-blue-deep); border-radius: 999px; padding: 8px 14px; font: 600 13.5px/1.2 inherit; font-family: inherit; cursor: pointer; transition: background .15s, border-color .15s, transform .1s; }
.hc-chip i { color: var(--hc-blue); font-size: 13px; }
.hc-chip:hover { background: #eff6ff; border-color: var(--hc-blue); }
.hc-chip:active { transform: scale(.97); }
.hc-chip.on { background: var(--hc-blue); border-color: var(--hc-blue); color: #fff; }
.hc-chip.on i { color: #fff; }
.hc-chat-cta { margin: 10px 0 0 42px; }

/* Composer */
.hc-composer { display: flex; align-items: flex-end; gap: 10px; margin: 0 16px; padding: 8px 8px 8px 16px; border: 1.5px solid #dbe4ef; border-radius: 26px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.hc-composer:focus-within { border-color: var(--hc-blue); box-shadow: 0 0 0 4px rgba(33, 150, 243, .14); }
.hc-composer textarea { flex: 1; border: 0; outline: 0; resize: none; font: inherit; font-size: 15px; line-height: 1.45; color: var(--hc-ink); padding: 7px 0; max-height: 180px; background: transparent; }
.hc-composer textarea:disabled { background: transparent; }
.hc-send { width: 40px; height: 40px; flex: 0 0 auto; border: 0; border-radius: 50%; background: linear-gradient(135deg, var(--hc-blue), var(--hc-blue-deep)); color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 8px 18px rgba(21, 101, 192, .35); transition: transform .12s, opacity .15s; }
.hc-send:hover { transform: scale(1.06); }
.hc-send:disabled { opacity: .4; cursor: default; transform: none; box-shadow: none; }
.hc-send i { font-size: 15px; margin-left: -2px; }
.hc-chat-error { margin: 10px 16px 0; }
.hc-chat-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 22px 16px; }
.hc-chat-foot small, .hc-chat-legal { color: var(--hc-muted); font-size: 12px; }
.hc-chat-legal { display: block; padding: 8px 22px 16px; }
.hc-chat-legal a { color: var(--hc-blue-deep); }
.hc-chat-link { border: 0; background: none; color: var(--hc-blue-deep); font: 600 13px/1 inherit; font-family: inherit; cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.hc-chat-link:hover { background: var(--hc-surface-2); }
.hc-chat-link[hidden] { display: none; }
.hc-chat-suggest { margin: 0 16px 10px; }
.hc-chat-suggest a { margin: 0 !important; padding: 4px 0; }
.hc-chat .hc-closed { margin: 0 16px 16px; max-width: none; }

/* Rating card at the end of a solved chat */
.hc-chat-rate { align-self: center; width: min(100%, 420px); margin-top: 16px; text-align: center; }
.hc-chat-rate .hc-rate-row { justify-content: center; }

/* Conversation list snippet */
.hc-ticket-last { display: block; color: var(--hc-body); font-size: 13.5px; margin: 2px 0 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hc-ticket-last em { font-style: normal; font-weight: 600; color: var(--hc-ink); margin-right: 4px; }

@media (max-width: 600px) {
	.hc-chat { border-radius: 20px; }
	.hc-chat-log { padding: 14px 12px 18px; max-height: calc(100dvh - 260px); }
	.hc-bubble { max-width: 86%; }
	.hc-composer { margin: 0 10px; }
	.hc-chat-chips, .hc-chat-cta { margin-left: 0; }
	.hc-chat-chips { gap: 6px; }
	.hc-chip { padding: 7px 12px; font-size: 13px; }
}
