/* TERA OPTIONS — support chat (customer side), used on the platform and the help centre. Requires tokens.css. The help centre page itself is css/help.css. */

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- launcher ---------- */
.sc-launcher {
  position: fixed; right: max(18px, calc(env(safe-area-inset-right, 0px) + 12px)); bottom: max(18px, calc(env(safe-area-inset-bottom, 0px) + 12px)); z-index: 120;
  display: inline-flex; align-items: center; gap: 10px; height: 52px; padding: 0 20px 0 16px; border: 0; border-radius: 999px; cursor: pointer;
  font: 600 14px/1 var(--font-sans); color: #fff; background: linear-gradient(135deg, #3b6cf0, #2448c4);
  box-shadow: 0 14px 34px rgba(36, 72, 196, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  transition: transform var(--dur-2) var(--ease-out), box-shadow var(--dur-2), opacity var(--dur-2);
}
@media (hover: hover) { .sc-launcher:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(36, 72, 196, 0.55); } }
.sc-launcher:active { transform: scale(0.95); }
/* tucked away while the page shows its own chat button, so it never sits on top of it */
.sc-root.is-tucked .sc-launcher { opacity: 0; pointer-events: none; transform: translateY(16px) scale(0.9); }
.sc-launcher svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sc-root.is-open .sc-launcher { opacity: 0; pointer-events: none; transform: scale(0.9); }
.sc-badge { position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; display: grid; place-items: center; background: #ff5a5f; color: #fff; font-size: 12px; box-shadow: 0 0 0 3px var(--c-bg); }

/* every control in the widget: custom pressed states instead of the grey flash, and no double-tap zoom delay */
.sc-root button, .sc-root label, .sc-root summary, .sc-launcher { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

/* ---------- panel ---------- */
.sc-panel {
  position: fixed; z-index: 130; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom));
  width: min(392px, calc(100vw - 36px)); height: min(640px, calc(100vh - 36px)); height: min(640px, calc(100dvh - 36px)); display: flex; flex-direction: column; overflow: hidden;
  font-family: var(--font-sans); color: var(--c-text); font-size: 14px;
  background: linear-gradient(180deg, #0f1f36 0%, #0b1728 100%); border: 1px solid rgba(148, 163, 184, 0.2); border-radius: 20px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(56, 189, 248, 0.05);
  animation: scIn .32s cubic-bezier(.22, 1, .36, 1) both;
}
.sc-panel:focus { outline: none; } /* focused as a whole on touch screens, so the keyboard doesn't jump up */
@keyframes scIn { from { opacity: 0; transform: translateY(16px) scale(0.97); } }
.sc-panel svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.sc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 14px 12px 16px; border-bottom: 1px solid rgba(148, 163, 184, 0.14); background: rgba(7, 17, 31, 0.35); }
.sc-who { display: flex; align-items: center; gap: 11px; min-width: 0; }
.sc-av { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 16px; background: linear-gradient(135deg, #315fea, #38bdf8); }
.sc-av svg { width: 21px; height: 21px; }
.sc-who-text { display: grid; gap: 2px; min-width: 0; }
.sc-who-text b { font-size: 15px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--c-text-2); white-space: nowrap; }
.sc-dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: #64748b; }
.sc-dot.on { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18); }
.sc-head-btns { display: flex; align-items: center; gap: 6px; }
.sc-end { white-space: nowrap; height: 36px; padding: 0 12px; border-radius: 9px; border: 1px solid rgba(148, 163, 184, 0.25); background: transparent; color: var(--c-text-2); font: 600 12.5px var(--font-sans); cursor: pointer; }
.sc-icon { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: var(--c-text-2); cursor: pointer; }
@media (hover: hover) {
  .sc-end:hover { color: var(--c-text); border-color: rgba(148, 163, 184, 0.45); }
  .sc-icon:hover { background: rgba(148, 163, 184, 0.12); color: var(--c-text); }
}
.sc-end:active, .sc-icon:active { background: rgba(148, 163, 184, 0.16); color: var(--c-text); }
.sc-icon svg { width: 18px; height: 18px; }
.sc-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; font-size: 13.5px; background: rgba(240, 82, 90, 0.08); border-bottom: 1px solid rgba(240, 82, 90, 0.3); }
.sc-confirm span { flex: 1 1 auto; }
.sc-confirm button { height: 40px; padding: 0 14px; border-radius: 9px; border: 1px solid rgba(148, 163, 184, 0.3); background: transparent; color: var(--c-text); font: 600 13px var(--font-sans); cursor: pointer; }
.sc-confirm button:active { transform: scale(0.97); }
.sc-confirm .sc-confirm-yes { background: #d9454d; border-color: transparent; color: #fff; }

.sc-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scroll-behavior: smooth; }

/* ---------- start form ---------- */
.sc-start { padding: 18px 18px 16px; display: grid; gap: 12px; }
.sc-hello { text-align: center; display: grid; justify-items: center; gap: 4px; padding: 6px 4px 4px; }
.sc-hello-ic { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 4px; color: #a9c0ff; background: radial-gradient(circle at 30% 30%, rgba(56, 189, 248, 0.25), rgba(49, 95, 234, 0.18)); }
.sc-hello-ic svg { width: 26px; height: 26px; }
.sc-hello h3 { margin: 0; font-family: var(--font-display); font-size: 20px; font-weight: 650; letter-spacing: -0.01em; }
.sc-hello p { margin: 0; color: var(--c-text-2); font-size: 13px; line-height: 1.55; }
.sc-online { display: inline-flex !important; align-items: center; gap: 7px; margin-top: 6px !important; padding: 5px 11px; border-radius: 999px; background: rgba(148, 163, 184, 0.08); font-size: 12px !important; }
.sc-online[hidden] { display: none !important; }
.sc-signed { margin: 0; font-size: 12.5px; color: var(--c-text-2); text-align: center; }
.sc-signed b { color: var(--c-text); font-weight: 600; }
.sc-visitor { display: grid; gap: 12px; }
.sc-field { display: grid; gap: 5px; }
.sc-field label { font-size: 12.5px; font-weight: 600; color: var(--c-text); }
.sc-field label span { font-weight: 400; color: var(--c-text-3); margin-left: 4px; }
.sc-field input, .sc-field select, .sc-field textarea {
  width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(7, 17, 31, 0.7); color: var(--c-text); font: 14px/1.45 var(--font-sans); outline: none; transition: border-color var(--dur-2);
}
.sc-field textarea { resize: vertical; min-height: 96px; }
.sc-field select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2391a0b5' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; padding-right: 36px; }
.sc-field input:focus, .sc-field select:focus, .sc-field textarea:focus { border-color: var(--c-cyan); }
.sc-err { padding: 9px 12px; border-radius: 9px; font-size: 12.5px; color: #ffb3b7; background: rgba(240, 82, 90, 0.1); border: 1px solid rgba(240, 82, 90, 0.35); }
.sc-start-btn, .sc-new {
  height: 46px; border: 0; border-radius: 12px; cursor: pointer; font: 650 14.5px var(--font-sans); color: #fff;
  background: linear-gradient(135deg, #3b6cf0, #2448c4); box-shadow: 0 10px 24px rgba(36, 72, 196, 0.35);
}
.sc-start-btn:active, .sc-new:active { transform: scale(0.98); }
.sc-start-btn:disabled { opacity: 0.6; cursor: default; transform: none; }
.sc-fine { margin: 0; font-size: 11.5px; color: var(--c-text-3); text-align: center; }
.sc-fine a { color: var(--c-text-2); }

/* ---------- thread ---------- */
.sc-thread { padding: 14px 12px 8px; }
.sc-msgs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.sc-sys { align-self: center; margin: 8px 0; font-size: 11.5px; color: var(--c-text-3); }
.sc-sys span { padding: 4px 10px; border-radius: 999px; background: rgba(148, 163, 184, 0.08); }
.sc-msg { display: flex; align-items: flex-end; gap: 7px; max-width: 86%; animation: msgIn .22s cubic-bezier(.22, 1, .36, 1) both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } }
.sc-msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.sc-msg.theirs { align-self: flex-start; }
.sc-msg + .sc-msg.mine, .sc-msg.theirs + .sc-msg.theirs { margin-top: -1px; }
.sc-mav { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; color: #fff; background: linear-gradient(135deg, #7c5cff, #38bdf8); }
.sc-mav.ghost { visibility: hidden; }
.sc-bubble { position: relative; padding: 8px 11px 6px; border-radius: 16px; line-height: 1.45; word-wrap: break-word; overflow-wrap: anywhere; min-width: 64px; }
.sc-msg.mine .sc-bubble { color: #fff; background: linear-gradient(135deg, #3864e8, #2a50cf); border-bottom-right-radius: 5px; }
.sc-msg.theirs .sc-bubble { background: #17283f; border: 1px solid rgba(148, 163, 184, 0.12); border-bottom-left-radius: 5px; }
.sc-name { display: block; font-size: 11.5px; font-weight: 650; color: #9cc6ff; margin-bottom: 2px; }
.sc-text a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.sc-meta { display: flex; justify-content: flex-end; align-items: center; gap: 4px; margin-top: 2px; font-size: 11px; color: rgba(226, 232, 240, 0.6); font-variant-numeric: tabular-nums; }
.sc-msg.theirs .sc-meta { color: var(--c-text-3); }
.sc-tick { display: inline-flex; }
.sc-tick svg { height: 11px; width: auto; stroke-width: 1.9; }
.sc-tick.sent { color: rgba(226, 232, 240, 0.7); }
.sc-tick.seen { color: #7fe3ff; }
.sc-tick.pending { opacity: 0.7; }
.sc-retry { border: 0; background: none; padding: 10px 8px; margin: -10px -8px; color: #ffb3b7; font: 600 11.5px var(--font-sans); cursor: pointer; text-decoration: underline; } /* padding grows the hit area, the negative margin keeps the layout */
.sc-msg.has-photo .sc-bubble { padding: 4px 4px 5px; }
.sc-photo { display: block; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 12px; overflow: hidden; }
.sc-photo img { display: block; max-width: 220px; max-height: 240px; width: auto; height: auto; border-radius: 12px; object-fit: cover; }
.sc-msg.has-photo .sc-meta { padding: 0 6px; }

.sc-typing { display: flex; align-items: center; gap: 7px; margin: 6px 0 4px; font-size: 12px; color: var(--c-text-2); }
.sc-typing-av { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; color: #fff; background: linear-gradient(135deg, #7c5cff, #38bdf8); }
.sc-typing-bubble { display: inline-flex; gap: 4px; padding: 10px 12px; border-radius: 16px; border-bottom-left-radius: 5px; background: #17283f; border: 1px solid rgba(148, 163, 184, 0.12); }
.sc-typing-bubble i { width: 6px; height: 6px; border-radius: 50%; background: #9fb2cc; animation: dot 1.2s infinite ease-in-out; }
.sc-typing-bubble i:nth-child(2) { animation-delay: .15s; }
.sc-typing-bubble i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-4px); opacity: 1; } }

.sc-ended { display: grid; justify-items: center; gap: 12px; margin: 14px 4px 6px; padding: 16px; border-radius: 14px; text-align: center; background: rgba(148, 163, 184, 0.06); border: 1px solid rgba(148, 163, 184, 0.14); }
.sc-ended > b { font-size: 14px; }
.sc-rate { display: grid; gap: 8px; justify-items: center; font-size: 13px; color: var(--c-text-2); }
.sc-rate-btns { display: flex; gap: 10px; }
.sc-rate-btns[hidden] { display: none; }
.sc-rate-btns button { width: 52px; height: 44px; display: grid; place-items: center; border-radius: 12px; border: 1px solid rgba(148, 163, 184, 0.25); background: rgba(7, 17, 31, 0.6); color: var(--c-text-2); cursor: pointer; transition: color var(--dur-2), border-color var(--dur-2), transform var(--dur-1); }
@media (hover: hover) { .sc-rate-btns button:hover { color: #fff; border-color: var(--c-cyan); } }
.sc-rate-btns button:active { color: #fff; border-color: var(--c-cyan); transform: scale(0.95); }
.sc-rate-btns svg { width: 20px; height: 20px; }
.sc-new { width: 100%; height: 46px; }

/* ---------- composer ---------- */
.sc-compose { border-top: 1px solid rgba(148, 163, 184, 0.14); padding: 10px 10px max(10px, env(safe-area-inset-bottom)); background: rgba(7, 17, 31, 0.4); }
.sc-compose-row { display: flex; align-items: flex-end; gap: 8px; }
.sc-attach, .sc-send { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; cursor: pointer; }
.sc-attach { color: var(--c-text-2); }
@media (hover: hover) { .sc-attach:hover { color: var(--c-text); background: rgba(148, 163, 184, 0.1); } }
.sc-attach:active { color: var(--c-text); background: rgba(148, 163, 184, 0.16); }
.sc-send:active { transform: scale(0.94); }
.sc-attach svg, .sc-send svg { width: 20px; height: 20px; }
.sc-send { border: 0; color: #fff; background: linear-gradient(135deg, #3b6cf0, #2448c4); }
.sc-compose textarea {
  flex: 1; min-width: 0; resize: none; max-height: 140px; padding: 10px 12px; border-radius: 12px; border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(7, 17, 31, 0.7); color: var(--c-text); font: 14px/1.4 var(--font-sans); outline: none;
}
.sc-compose textarea:focus { border-color: var(--c-cyan); }
.sc-preview { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; padding: 6px; border-radius: 12px; background: rgba(148, 163, 184, 0.08); font-size: 12.5px; color: var(--c-text-2); }
.sc-preview[hidden] { display: none; }
.sc-preview img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; }
.sc-preview span { flex: 1; }
.sc-preview-x { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--c-text-2); cursor: pointer; }
.sc-preview-x svg { width: 15px; height: 15px; }
.sc-compose-err { margin-top: 8px; }
.sc-drop { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; font-weight: 650; color: #fff; background: rgba(36, 72, 196, 0.55); border: 2px dashed rgba(255, 255, 255, 0.6); border-radius: 20px; pointer-events: none; }
.sc-drop[hidden] { display: none; }
.sc-lightbox { position: fixed; inset: 0; z-index: 140; display: grid; place-items: center; padding: max(24px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(24px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); background: rgba(3, 8, 20, 0.92); cursor: zoom-out; overscroll-behavior: contain; }
.sc-lightbox[hidden] { display: none; }
.sc-lightbox img { max-width: 100%; max-height: 100%; border-radius: 12px; }
.sc-lightbox .sc-icon { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 12px); right: calc(env(safe-area-inset-right, 0px) + 12px); width: 44px; height: 44px; color: #fff; background: rgba(255, 255, 255, 0.1); }
.sc-root [hidden] { display: none !important; }

/* Inputs at 16px on phones and tablets: anything smaller makes iOS Safari zoom the page on focus. */
@media (max-width: 760px), (pointer: coarse) {
  .sc-field input, .sc-field select, .sc-field textarea, .sc-compose textarea, .sc-attach input { font-size: 16px; }
  /* labels get a 40px hit area that reaches into the gaps around them, with the layout unchanged */
  .sc-field label { padding: 12px 0 8px; margin: -12px 0 -8px; }
  .sc-attach, .sc-send { width: 44px; height: 44px; }
  .sc-icon { width: 44px; height: 44px; }
  .sc-end { height: 40px; }
}

/*
 * Phones (and phones held sideways): a full-screen sheet. js/support-chat.js keeps --sc-vh / --sc-vy equal to the
 * visual viewport, so the composer stays above the on-screen keyboard. Keep this query in step with SHEET_MQ there.
 */
@media (max-width: 560px), (max-height: 500px) and (pointer: coarse) {
  .sc-panel {
    top: var(--sc-vy, 0px); right: 0; bottom: 0; left: 0; width: auto;
    height: 100vh; height: var(--sc-vh, 100dvh);
    border-radius: 0; border: 0; box-shadow: none;
    padding: 0 env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px);
    animation-name: scSheetIn;
  }
  .sc-head { padding-top: calc(12px + env(safe-area-inset-top, 0px)); touch-action: none; }
  .sc-drop { border-radius: 0; }
  .sc-root.kb-open .sc-compose { padding-bottom: 10px; }
  .sc-root.kb-open .sc-hello, .sc-root.kb-open .sc-fine { display: none; }
  .sc-launcher span { display: none; }
  .sc-launcher { width: 56px; padding: 0; justify-content: center; }
}
@keyframes scSheetIn { from { opacity: 0; transform: translateY(24px); } }
/* sideways phones: a slimmer header leaves room for the thread above the keyboard */
@media (max-height: 500px) and (pointer: coarse) {
  .sc-head { padding-top: calc(6px + env(safe-area-inset-top, 0px)); padding-bottom: 6px; }
  .sc-av { width: 34px; height: 34px; }
  .sc-start { padding-top: 12px; }
  /* the greeting shrinks to one line and name + email sit side by side */
  .sc-hello { grid-auto-flow: column; justify-content: center; align-items: center; gap: 12px; padding: 0; }
  .sc-hello-ic, .sc-hello > p:not(.sc-online) { display: none; }
  .sc-online { margin-top: 0 !important; }
  .sc-visitor { grid-template-columns: 1fr 1fr; }
  .sc-field textarea { min-height: 72px; }
}
/* the page behind an open sheet doesn't scroll */
html.sc-lock, html.sc-lock body { overflow: hidden; }

@media (prefers-reduced-motion: reduce) { .sc-panel, .sc-msg { animation: none; } .sc-typing-bubble i { animation: none; opacity: 0.8; } .sc-body { scroll-behavior: auto; } }
