/* Yuksell site: live chat widget. Colours come from the site tokens in site.css
   (dark by default, light via prefers-color-scheme or [data-theme]); fallbacks keep it usable alone.
   Motion is transform/opacity only and switched off under prefers-reduced-motion. */

.ykc { --k-bg: var(--surface, #0e1218); --k-bg2: var(--surface-2, #141922); --k-ink: var(--ink, #eef2f6); --k-mut: var(--muted, #a6b0bd);
  --k-line: var(--line-2, rgb(255 255 255 / 15%)); --k-acc: var(--accent, #3fdde4); --k-btn: var(--btn-bg, #3fdde4); --k-btn-ink: var(--btn-ink, #03191b);
  --k-focus: var(--focus, #8fd0ff); --k-bad: var(--bad, #ff8576); --k-ok: var(--ok, #5fd69d);
  font-family: var(--f-body, system-ui, sans-serif); font-size: 15px; line-height: 1.45; color: var(--k-ink); }
.ykc *, .ykc *::before, .ykc *::after { box-sizing: border-box; }
.ykc [hidden] { display: none !important; }
:where(.ykc button, .ykc input, .ykc textarea) { font: inherit; color: inherit; }
.ykc :focus-visible { outline: 2px solid var(--k-focus); outline-offset: 2px; }
.ykc-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* launcher */
.ykc-launcher { position: fixed; z-index: 60; right: max(20px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom));
  width: 56px; height: 56px; border: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: var(--k-btn); color: var(--k-btn-ink); box-shadow: 0 10px 30px -8px var(--btn-glow, rgb(0 173 181 / 40%)), 0 0 0 1px rgb(0 0 0 / 12%);
  transition: transform .18s ease; }
.ykc-launcher:hover { transform: translateY(-2px); }
.ykc-launcher:active { transform: scale(.96); }
.ykc-dot { position: absolute; top: 4px; right: 4px; width: 14px; height: 14px; border-radius: 50%; background: #ff5a4a; border: 2px solid var(--k-bg); }

/* panel */
.ykc-panel { position: fixed; z-index: 61; right: max(20px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom));
  width: 380px; height: min(620px, calc(100dvh - 40px)); max-height: calc(100vh - 40px);
  display: flex; flex-direction: column; overflow: hidden; border-radius: 20px; background: var(--k-bg);
  border: 1px solid var(--k-line); box-shadow: var(--shadow, 0 30px 80px -30px rgb(0 0 0 / 60%));
  animation: ykc-in .22s ease both; }
@keyframes ykc-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

.ykc-head { display: flex; align-items: center; gap: 8px; padding: 14px 8px 12px 18px; border-bottom: 1px solid var(--line, rgb(255 255 255 / 8%));
  background: var(--k-bg2); }
.ykc-headtext { flex: 1; min-width: 0; }
.ykc-title { font-family: var(--f-display, inherit); font-weight: 600; font-size: 17px; letter-spacing: -.01em; }
.ykc-sub { font-size: 12.5px; color: var(--k-mut); display: flex; align-items: center; gap: 6px; }
.ykc-sub::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--k-mut); }
.ykc-sub.ykc-on::before { background: var(--k-ok); }
.ykc-icon { width: 40px; height: 40px; border: 0; border-radius: 12px; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--k-mut); }
.ykc-icon:hover { background: var(--ghost-bg, rgb(255 255 255 / 6%)); color: var(--k-ink); }

.ykc-notice { margin: 0; padding: 8px 18px; font-size: 12.5px; color: var(--k-mut); border-bottom: 1px solid var(--line, rgb(255 255 255 / 8%)); }
.ykc-notice a { color: var(--k-acc); text-decoration: underline; text-underline-offset: 2px; }

.ykc-log { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.ykc-intro { align-self: center; text-align: center; max-width: 30ch; margin: auto; color: var(--k-mut); font-size: 14px; }

.ykc-m { max-width: 85%; display: flex; flex-direction: column; gap: 2px; animation: ykc-pop .16s ease both; }
@keyframes ykc-pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.ykc-body { padding: 9px 13px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.ykc-who { font-size: 11.5px; color: var(--k-mut); padding: 0 4px; }
.ykc-them { align-self: flex-start; }
.ykc-them .ykc-body { background: var(--k-bg2); border: 1px solid var(--line, rgb(255 255 255 / 8%)); border-bottom-left-radius: 5px; }
.ykc-prov .ykc-body { opacity: .85; }
.ykc-me { align-self: flex-end; align-items: flex-end; }
.ykc-me .ykc-body { background: var(--k-btn); color: var(--k-btn-ink); border-bottom-right-radius: 5px; }
.ykc-pending .ykc-body { opacity: .65; }
.ykc-sys { align-self: center; max-width: 92%; }
.ykc-sys .ykc-body { padding: 4px 12px; border-radius: 999px; font-size: 12.5px; color: var(--k-mut); background: transparent; border: 1px dashed var(--k-line); text-align: center; }
.ykc-fail { font-size: 12.5px; color: var(--k-bad); display: flex; gap: 8px; align-items: center; }
.ykc-failed .ykc-body { border: 1px solid var(--k-bad); }
.ykc-link { border: 0; background: none; padding: 4px 2px; cursor: pointer; color: var(--k-acc); text-decoration: underline; text-underline-offset: 2px; }

.ykc-typing { align-self: flex-start; display: flex; gap: 4px; padding: 11px 14px; border-radius: 16px; border-bottom-left-radius: 5px; background: var(--k-bg2); border: 1px solid var(--line, rgb(255 255 255 / 8%)); }
.ykc-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--k-mut); animation: ykc-blink 1.2s infinite ease-in-out; }
.ykc-typing i:nth-of-type(2) { animation-delay: .15s; }
.ykc-typing i:nth-of-type(3) { animation-delay: .3s; }
@keyframes ykc-blink { 0%, 80%, 100% { opacity: .3; transform: none; } 40% { opacity: 1; transform: translateY(-3px); } }

.ykc-banner { margin: 0 16px 8px; padding: 8px 12px; border-radius: 12px; font-size: 13px; color: var(--warn, #f1b762); border: 1px solid var(--k-line); background: var(--k-bg2); }

.ykc-offline { margin: 0 16px 10px; padding: 12px; border-radius: 14px; background: var(--k-bg2); border: 1px solid var(--k-line); display: grid; gap: 8px; }
.ykc-offline p { margin: 0; font-size: 13.5px; color: var(--k-mut); }
.ykc-offline .ykc-offmsg { min-height: 0; }
.ykc-offmsg:empty { display: none; }
.ykc-offmsg.ykc-bad { color: var(--k-bad); }
.ykc-field { width: 100%; min-height: 44px; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--k-line); background: var(--k-bg); }
.ykc-field::placeholder, .ykc-input::placeholder { color: var(--subtle, #8c97a5); }
.ykc-btn { min-height: 44px; padding: 8px 16px; border: 0; border-radius: 12px; background: var(--k-btn); color: var(--k-btn-ink); font-weight: 600; cursor: pointer; }
.ykc-btn:disabled { opacity: .6; cursor: default; }

.ykc-closed { margin: 0 16px 10px; display: grid; gap: 8px; justify-items: center; color: var(--k-mut); font-size: 14px; }

.ykc-composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px 6px; border-top: 1px solid var(--line, rgb(255 255 255 / 8%)); }
.ykc-input { flex: 1; min-width: 0; resize: none; max-height: 8.5em; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--k-line); background: var(--k-bg2);
  font-size: 16px; /* 16px keeps iOS from zooming on focus */ line-height: 1.4; }
.ykc-send { flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--k-btn); color: var(--k-btn-ink); display: grid; place-items: center; cursor: pointer; }
.ykc-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 0 14px calc(8px + env(safe-area-inset-bottom)); min-height: 34px; }
.ykc-human { border: 0; background: none; padding: 6px 4px; min-height: 32px; cursor: pointer; font-size: 13.5px; color: var(--k-acc); text-decoration: underline; text-underline-offset: 2px; }
.ykc-human:disabled { opacity: .5; }
.ykc-counter { margin-inline-start: auto; font-size: 12px; color: var(--k-mut); }
.ykc-counter.ykc-warn { color: var(--k-bad); }

/* phones: full screen */
@media (max-width: 599px) {
  .ykc-panel { inset: 0; width: auto; height: auto; max-height: none; border-radius: 0; border: 0;
    padding-top: env(safe-area-inset-top); padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .ykc-launcher { right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); }
  html.ykc-lock { overflow: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  .ykc-panel, .ykc-m { animation: none; }
  .ykc-launcher { transition: none; }
  .ykc-typing i { animation: none; opacity: .7; }
}
.ykc-isclosed .ykc-fail .ykc-link { display: none; }
