/* ============================================================
   EveryChat — Embedded WebChat Widget (Advanced)
   Standalone CSS — loaded inside a full-viewport iframe.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --accent: #2563EB;
  --accent-ink: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 10%, #ffffff);
  --accent-dim: color-mix(in srgb, var(--accent) 14%, #ffffff);

  --wc-ink: #16191F;
  --wc-ink-2: #5A6473;
  --wc-ink-3: #98A0AD;
  --wc-line: #ECEEF1;
  --wc-line-2: #E2E5EA;
  --wc-surface: #FFFFFF;
  --wc-surface-2: #F6F7F9;
  --wc-surface-3: #EEF0F3;

  --wc-font: 'Inter', system-ui, -apple-system, sans-serif;

  --wc-radius: 20px;
  --wc-radius-sm: 12px;

  --wc-shadow: 0 12px 40px -8px rgba(20, 28, 48, .22), 0 2px 8px rgba(20, 28, 48, .08);
  --wc-shadow-bar: 0 10px 30px -6px rgba(20, 28, 48, .28), 0 2px 6px rgba(20, 28, 48, .10);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: transparent;
  overflow: hidden;
  font-family: var(--wc-font);
  -webkit-font-smoothing: antialiased;
}


/* ============================================================
   Widget root — anchored bottom-right
   ============================================================ */
.wc {
  position: fixed;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
  font-family: var(--wc-font);
  color: var(--wc-ink);
  pointer-events: auto;
}

/* Simple variant — floating bubble, offset from the corner */
.wc--simple {
  right: 24px;
  bottom: 24px;
}
.wc-bubble {
  width: 60px;
  height: 60px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: var(--wc-shadow-bar);
  transition: transform .18s cubic-bezier(.2,.9,.25,1), filter .15s;
  align-self: flex-end;
}
.wc-bubble:hover { filter: brightness(1.06); transform: translateY(-2px); }
.wc-bubble:active { transform: translateY(0); }
.wc-bubble svg { width: 27px; height: 27px; }
.wc-bubble__ico { display: grid; place-items: center; transition: transform .2s ease, opacity .15s ease; }
.wc-bubble.is-open .wc-bubble__ico--chat { display: none; }
.wc-bubble:not(.is-open) .wc-bubble__ico--close { display: none; }

/* ----- Panel stack (above the bar) ----- */
.wc-panel {
  width: 360px;
  max-width: calc(100vw - 32px);
  background: var(--wc-surface);
  border-radius: var(--wc-radius);
  box-shadow: var(--wc-shadow);
  overflow: hidden;
  transform-origin: bottom right;
  animation: wc-rise .34s cubic-bezier(.2,.9,.25,1) forwards;
  display: flex;
  flex-direction: column;
  max-height: min(560px, calc(100vh - 130px));
}
@keyframes wc-rise {
  from { transform: translateY(16px) scale(.98); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.wc-panel__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--wc-line);
}
.wc-panel__avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  flex: none;
}
.wc-panel__avatar svg { width: 20px; height: 20px; }
.wc-panel__titles { flex: 1; min-width: 0; }
.wc-panel__title {
  font-size: 15px; font-weight: 600; letter-spacing: -.01em;
  color: var(--wc-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wc-panel__sub {
  font-size: 12.5px; color: var(--wc-ink-2); margin-top: 1px;
  display: flex; align-items: center; gap: 6px;
}
.wc-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #22C55E; flex: none;
  box-shadow: 0 0 0 3px rgba(34,197,94,.16);
}
.wc-x {
  width: 30px; height: 30px; flex: none;
  border: none; background: var(--wc-surface-2);
  border-radius: 9px; cursor: pointer;
  display: grid; place-items: center;
  color: var(--wc-ink-2);
  transition: background .15s, color .15s;
}
.wc-x:hover { background: var(--wc-surface-3); color: var(--wc-ink); }
.wc-x svg { width: 16px; height: 16px; }

.wc-panel__body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

/* ============================================================
   Action bar — accent pill, up to 4 segments
   ============================================================ */
.wc-bar {
  display: flex;
  align-items: stretch;
  background: var(--accent);
  border-radius: 18px 0 0 0;
  box-shadow: var(--wc-shadow-bar);
  overflow: hidden;
  position: relative;
}
.wc-seg {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--accent-ink);
  cursor: pointer;
  padding: 13px 18px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 74px;
  position: relative;
  font-family: inherit;
  transition: background .16s ease;
}
.wc-seg + .wc-seg::before {
  content: "";
  position: absolute;
  left: 0; top: 22%; bottom: 22%;
  width: 1px;
  background: rgba(255,255,255,.20);
}
.wc-seg:hover { background: rgba(255,255,255,.12); }
.wc-seg:active { background: rgba(0,0,0,.06); }
.wc-seg.is-active { background: rgba(0,0,0,.10); }
.wc-seg__icon { width: 24px; height: 24px; display: grid; place-items: center; }
.wc-seg__icon svg { width: 22px; height: 22px; }
.wc-seg__label {
  font-size: 12px; font-weight: 600; letter-spacing: .005em;
}

/* ============================================================
   Forms (Text Us, contact form)
   ============================================================ */
.wc-field { margin-bottom: 12px; }
.wc-field__label {
  display: block;
  font-size: 12px; font-weight: 600; color: var(--wc-ink-2);
  margin-bottom: 6px;
}
.wc-input, .wc-textarea {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  color: var(--wc-ink);
  background: var(--wc-surface);
  border: 1.5px solid var(--wc-line-2);
  border-radius: 11px;
  padding: 11px 12px;
  transition: border-color .15s, box-shadow .15s;
}
.wc-input::placeholder, .wc-textarea::placeholder { color: var(--wc-ink-3); }
.wc-input:focus, .wc-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
.wc-textarea { resize: none; min-height: 92px; line-height: 1.45; }

.wc-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.wc-btn {
  width: 100%;
  font-family: inherit;
  font-size: 14.5px; font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent);
  border: none;
  border-radius: 12px;
  padding: 13px 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: filter .15s, transform .05s;
}
.wc-btn:hover { filter: brightness(1.06); }
.wc-btn:active { transform: translateY(1px); }
.wc-btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.wc-btn svg { width: 17px; height: 17px; }
.wc-btn--ghost {
  background: var(--wc-surface-2);
  color: var(--wc-ink);
}
.wc-btn--ghost:hover { background: var(--wc-surface-3); filter: none; }

.wc-intro {
  font-size: 13.5px; line-height: 1.5; color: var(--wc-ink-2);
  margin: 0 0 16px;
}

/* ----- Success / thank-you state ----- */
.wc-done {
  text-align: center;
  padding: 26px 18px 30px;
}
.wc-done__check {
  width: 56px; height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 12%, #fff);
  color: var(--accent);
  display: grid; place-items: center;
  animation: wc-pop .4s cubic-bezier(.2,1.3,.4,1) forwards;
}
.wc-done__check svg { width: 28px; height: 28px; }
@keyframes wc-pop { from { transform: scale(.5); } to { transform: scale(1); } }
.wc-done__title { font-size: 17px; font-weight: 700; letter-spacing: -.01em; margin: 0 0 6px; }
.wc-done__text { font-size: 13.5px; line-height: 1.5; color: var(--wc-ink-2); margin: 0 auto; max-width: 260px; }

/* ============================================================
   Request — subject list
   ============================================================ */
.wc-subjects { display: flex; flex-direction: column; gap: 8px; }
.wc-subject {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  text-align: left;
  font-family: inherit;
  background: var(--wc-surface);
  border: 1.5px solid var(--wc-line);
  border-radius: 13px;
  padding: 13px 14px;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .05s;
}
.wc-subject:hover { border-color: var(--accent); background: var(--accent-soft); }
.wc-subject:active { transform: translateY(1px); }
.wc-subject__icon {
  width: 36px; height: 36px; flex: none;
  border-radius: 10px;
  background: var(--accent-dim);
  color: var(--accent);
  display: grid; place-items: center;
}
.wc-subject__icon svg { width: 19px; height: 19px; }
.wc-subject__main { flex: 1; min-width: 0; }
.wc-subject__name { display: block; font-size: 14px; font-weight: 600; color: var(--wc-ink); }
.wc-subject__desc { display: block; font-size: 12px; color: var(--wc-ink-2); margin-top: 2px; line-height: 1.35; }
.wc-subject__chev { color: var(--wc-ink-3); flex: none; }
.wc-subject__chev svg { width: 18px; height: 18px; }

/* ============================================================
   Chatroom (bot Q&A)
   ============================================================ */
.wc-chat {
  display: flex; flex-direction: column;
  flex: 1; min-height: 0;
}
.wc-chat__scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.wc-msg {
  max-width: 80%;
  font-size: 13.5px; line-height: 1.45;
  padding: 10px 13px;
  border-radius: 16px;
  animation: wc-msg-in .28s ease forwards;
}
@keyframes wc-msg-in { from { transform: translateY(6px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.wc-msg--bot {
  align-self: flex-start;
  background: var(--wc-surface-3);
  color: var(--wc-ink);
  border-bottom-left-radius: 5px;
}
.wc-msg--user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--accent-ink);
  border-bottom-right-radius: 5px;
}
.wc-typing { display: flex; gap: 4px; padding: 13px 14px; }
.wc-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--wc-ink-3);
  animation: wc-blink 1.2s infinite ease-in-out both;
}
.wc-typing span:nth-child(2) { animation-delay: .16s; }
.wc-typing span:nth-child(3) { animation-delay: .32s; }
@keyframes wc-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.wc-composer {
  display: flex; gap: 8px; align-items: flex-end;
  padding: 12px;
  border-top: 1px solid var(--wc-line);
  background: var(--wc-surface);
}
.wc-composer .wc-input { border-radius: 12px; }
.wc-send {
  width: 42px; height: 42px; flex: none;
  border: none; border-radius: 12px;
  background: var(--accent); color: var(--accent-ink);
  cursor: pointer; display: grid; place-items: center;
  transition: filter .15s, transform .05s;
}
.wc-send:hover { filter: brightness(1.06); }
.wc-send:active { transform: translateY(1px); }
.wc-send:disabled { opacity: .45; cursor: not-allowed; }
.wc-send svg { width: 18px; height: 18px; }

/* Divider between chat messages and inline contact form */
.wc-chat-divider {
  height: 1px;
  background: var(--wc-line);
  margin: 6px -16px 14px;
}

/* Contact form within chat flow */
.wc-formcard__head {
  font-size: 14px; font-weight: 700; color: var(--wc-ink);
  margin: 0 0 4px;
}
.wc-formcard__sub {
  font-size: 12.5px; color: var(--wc-ink-2); line-height: 1.45; margin: 0 0 14px;
}

/* ============================================================
   Call popover
   ============================================================ */
.wc-call { text-align: center; padding: 22px 18px 24px; }
.wc-call__ring {
  width: 60px; height: 60px; margin: 0 auto 14px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 12%, #fff);
  color: var(--accent);
  display: grid; place-items: center;
}
.wc-call__ring svg { width: 28px; height: 28px; }
.wc-call__num {
  font-size: 20px; font-weight: 700; letter-spacing: -.01em;
  color: var(--wc-ink); margin: 0 0 4px;
}
.wc-call__hint { font-size: 12.5px; color: var(--wc-ink-2); margin: 0 0 18px; }

/* ============================================================
   Book modal — centered with dim backdrop
   ============================================================ */
.wc-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(16, 20, 30, .55);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  padding: 24px;
  pointer-events: auto;
}
.wc-modal {
  width: min(760px, 100%);
  height: min(660px, calc(100vh - 48px));
  background: var(--wc-surface);
  border-radius: 22px;
  box-shadow: 0 30px 80px -12px rgba(10, 15, 30, .5);
  overflow: hidden;
  display: flex; flex-direction: column;
  animation: wc-modal-in .3s cubic-bezier(.2,.9,.25,1) forwards;
}
@keyframes wc-modal-in { from { transform: translateY(16px) scale(.985); opacity: 0; } to { transform: none; opacity: 1; } }
.wc-modal__head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--wc-line);
}
.wc-modal__head .wc-panel__avatar { border-radius: 10px; }
.wc-modal__title { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.wc-modal__sub { font-size: 12.5px; color: var(--wc-ink-2); margin-top: 1px; }
.wc-modal__body {
  flex: 1;
  position: relative;
  background: var(--wc-surface-2);
}
.wc-modal__body iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ============================================================
   Powered-by footer
   ============================================================ */
.wc-powered {
  text-align: center;
  font-size: 11px; font-weight: 500;
  color: var(--wc-ink-3);
  padding: 9px 12px;
  border-top: 1px solid var(--wc-line);
  background: var(--wc-surface);
  letter-spacing: .01em;
}
.wc-powered b { font-weight: 700; color: var(--wc-ink-2); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .wc-panel, .wc-msg, .wc-done__check, .wc-overlay, .wc-modal { animation: none !important; }
}
