/* ==========================================================================
   WiseShift Assistant — chatbot widget
   Spec: 60px launcher, 360x500 panel, #3D84F5 header, 24px from edges
   ========================================================================== */
.ws-chat { --c-blue: #3D84F5; --c-blue-dark: #2A5CC7; --c-bg: #F8F9FA; --c-text: #333333; font-family: "Archivo", system-ui, Arial, sans-serif; }

.ws-chat__launcher {
  position: fixed; right: 24px; bottom: 24px; z-index: 900;
  width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--c-blue); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(42, 92, 199, .4);
  transition: background-color .2s, transform .2s;
}
.ws-chat__launcher:hover { background: var(--c-blue-dark); transform: scale(1.05); }
.ws-chat__launcher svg { width: 28px; height: 28px; }
.ws-chat__launcher[aria-expanded="true"] { display: none; }

.ws-chat__teaser {
  position: fixed; right: 24px; bottom: 96px; z-index: 900;
  max-width: 260px; padding: 14px 40px 14px 16px;
  background: #fff; color: var(--c-text); font-size: .95rem; line-height: 1.45;
  border-radius: 16px 16px 4px 16px; box-shadow: 0 10px 30px rgba(16, 24, 40, .18);
  cursor: pointer; animation: ws-pop .3s ease-out;
}
.ws-chat__teaser[hidden] { display: none; }
.ws-chat__teaser-close {
  position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border: 0; background: transparent;
  color: #6B7280; font-size: 18px; line-height: 1; cursor: pointer; border-radius: 50%;
}
.ws-chat__teaser-close:hover { background: var(--c-bg); }

.ws-chat__panel {
  position: fixed; right: 24px; bottom: 24px; z-index: 901;
  width: 360px; height: 500px; max-height: calc(100vh - 48px);
  display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border-radius: 16px; box-shadow: 0 24px 60px rgba(16, 24, 40, .28);
  animation: ws-pop .25s ease-out;
}
.ws-chat__panel[hidden] { display: none; }

.ws-chat__header {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 12px 14px 18px; background: var(--c-blue); color: #fff;
}
.ws-chat__title { margin: 0; font-size: 1rem; font-weight: 700; color: #fff; }
.ws-chat__status { display: block; font-size: .78rem; font-weight: 400; opacity: .9; }
.ws-chat__close {
  width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.ws-chat__close:hover { background: rgba(255, 255, 255, .18); }
.ws-chat__close svg { width: 18px; height: 18px; }

.ws-chat__log { flex: 1 1 auto; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.ws-chat__msg { max-width: 85%; padding: 10px 14px; font-size: .94rem; line-height: 1.5; border-radius: 16px; word-wrap: break-word; margin: 0; }
.ws-chat__msg--bot { align-self: flex-start; background: var(--c-bg); color: var(--c-text); border-bottom-left-radius: 4px; }
.ws-chat__msg--user { align-self: flex-end; background: var(--c-blue); color: #fff; border-bottom-right-radius: 4px; }

.ws-chat__options { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 4px; }
.ws-chat__option {
  padding: 8px 14px; min-height: 38px; font: 600 .88rem/1.2 inherit; font-family: inherit;
  color: var(--c-blue); background: #fff; border: 1.5px solid var(--c-blue); border-radius: 999px; cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s;
}
.ws-chat__option:hover, .ws-chat__option:focus-visible { background: var(--c-blue-dark); border-color: var(--c-blue-dark); color: #fff; }
.ws-chat__option:disabled { opacity: .45; cursor: default; }
.ws-chat__option:disabled:hover { background: #fff; color: var(--c-blue); border-color: var(--c-blue); }

.ws-chat__ask { display: flex; gap: 8px; margin: 2px 0 0; }
.ws-chat__input {
  flex: 1 1 auto; min-width: 0; min-height: 40px; padding: 8px 12px;
  font: inherit; font-size: .92rem; color: var(--c-text);
  border: 1.5px solid #CBD2DC; border-radius: 999px; background: #fff;
}
.ws-chat__input:focus { outline: none; border-color: var(--c-blue); box-shadow: 0 0 0 3px rgba(61, 132, 245, .18); }
.ws-chat__send {
  flex: 0 0 auto; min-height: 40px; padding: 0 16px; border: 0; border-radius: 999px; cursor: pointer;
  font: 700 .88rem/1 inherit; font-family: inherit; background: var(--c-blue); color: #fff;
}
.ws-chat__send:hover { background: var(--c-blue-dark); }
.ws-chat__composer { flex: 0 0 auto; display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid #EEF0F3; background: #fff; }
.ws-chat__msg--agent { border-left: 3px solid #F9A602; }
.ws-chat__option--live { border-color: #F9A602; color: #1A202C; background: #FFF4DB; }
.ws-chat__option--live:hover, .ws-chat__option--live:focus-visible { background: #F9A602; border-color: #F9A602; color: #1A202C; }
.ws-chat__error { margin: 0; font-size: .8rem; color: #9B2C2C; }

.ws-chat__action {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 16px; border-radius: 999px; text-decoration: none; font-weight: 700; font-size: .92rem;
  background: #F9A602; color: #1A202C;
}
.ws-chat__action:hover { background: #D98E00; color: #1A202C; }
.ws-chat__action--ghost { background: #fff; border: 1.5px solid var(--c-blue); color: var(--c-blue); }
.ws-chat__action--ghost:hover { background: var(--c-blue-dark); color: #fff; border-color: var(--c-blue-dark); }

.ws-chat__typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 12px 14px; background: var(--c-bg); border-radius: 16px; border-bottom-left-radius: 4px; }
.ws-chat__typing span { width: 7px; height: 7px; border-radius: 50%; background: #9AA3AF; animation: ws-blink 1.2s infinite ease-in-out; }
.ws-chat__typing span:nth-child(2) { animation-delay: .15s; }
.ws-chat__typing span:nth-child(3) { animation-delay: .3s; }

.ws-chat__footer { flex: 0 0 auto; padding: 10px 16px; border-top: 1px solid #EEF0F3; font-size: .74rem; color: #6B7280; text-align: center; }
.ws-chat__footer a { color: inherit; }

@keyframes ws-pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes ws-blink { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

@media (max-width: 479px) {
  .ws-chat__panel { right: 16px; left: 16px; bottom: 16px; width: auto; height: min(500px, calc(100vh - 32px)); }
  .ws-chat__launcher { right: 16px; bottom: 16px; }
  .ws-chat__teaser { right: 16px; bottom: 88px; }
}
@media (prefers-reduced-motion: reduce) { .ws-chat__panel, .ws-chat__teaser { animation: none; } .ws-chat__typing span { animation: none; } }
