/* Widget de chat de soporte (partials/support-chat.jsp). Todo bajo el prefijo .vsc para no
   chocar con los estilos de cada página. z-index 90: debajo del sidebar móvil (95/100), de los
   modales (200+) y de los toasts del panel (3000). */
.vsc {
  --vsc-brand: #6C47FF;
  --vsc-brand-dark: #4F32C8;
  --vsc-brand-light: #F5F3FF;
  --vsc-text: #111827;
  --vsc-muted: #6B7280;
  --vsc-border: #E5E7EB;
  --vsc-surface: #F9FAFB;
  --vsc-wa: #128C4A;
  position: fixed; right: 20px; bottom: 20px; z-index: 90;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px; line-height: 1.5; color: var(--vsc-text);
}
.vsc *, .vsc *::before, .vsc *::after { box-sizing: border-box; }
.vsc-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.vsc-launcher {
  display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 18px 0 14px;
  border: 0; border-radius: 999px; background: var(--vsc-brand); color: #fff; cursor: pointer;
  font: inherit; font-weight: 600; font-size: 15px;
  box-shadow: 0 8px 28px rgba(108, 71, 255, .35); transition: background .15s, transform .15s;
}
.vsc-launcher:hover { background: var(--vsc-brand-dark); transform: translateY(-1px); }
.vsc-launcher:focus-visible, .vsc-icon-btn:focus-visible, .vsc-send:focus-visible,
.vsc-wa-btn:focus-visible, .vsc-msg a:focus-visible {
  outline: 3px solid #A78BFA; outline-offset: 2px;
}
.vsc-launcher svg { flex-shrink: 0; }
.vsc--open .vsc-launcher { display: none; }

.vsc-panel {
  position: absolute; right: 0; bottom: 0; width: 370px; height: min(560px, calc(100vh - 40px));
  display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border: 1px solid var(--vsc-border); border-radius: 18px;
  box-shadow: 0 18px 60px rgba(17, 24, 39, .22);
}
.vsc-panel[hidden] { display: none; }

.vsc-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 16px;
  background: var(--vsc-brand); color: #fff; }
.vsc-avatar { width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, .18);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-weight: 800; }
.vsc-head__text { flex: 1; min-width: 0; }
.vsc-title { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.25; color: #fff; }
.vsc-sub { margin: 0; font-size: 12px; opacity: .85; }
.vsc-icon-btn { width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent;
  color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.vsc-icon-btn:hover { background: rgba(255, 255, 255, .16); }

.vsc-messages { flex: 1; overflow-y: auto; padding: 16px; background: var(--vsc-surface);
  display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.vsc-msg { max-width: 86%; padding: 9px 13px; border-radius: 14px; word-wrap: break-word;
  overflow-wrap: anywhere; white-space: normal; font-size: 14.5px; }
.vsc-msg--bot { align-self: flex-start; background: #fff; border: 1px solid var(--vsc-border);
  border-bottom-left-radius: 4px; }
.vsc-msg--user { align-self: flex-end; background: var(--vsc-brand); color: #fff;
  border-bottom-right-radius: 4px; }
.vsc-msg--notice { align-self: stretch; max-width: 100%; background: #FFFBEB; border: 1px solid #FDE68A;
  color: #92400E; font-size: 13.5px; }
.vsc-msg a { color: var(--vsc-brand); font-weight: 600; text-decoration: underline; }
.vsc-msg--user a { color: #fff; }

.vsc-wa-btn { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; padding: 9px 14px;
  border-radius: 10px; background: var(--vsc-wa); color: #fff !important; font-weight: 700;
  font-size: 14px; text-decoration: none !important; }
.vsc-wa-btn:hover { background: #0E7A40; }

.vsc-typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 12px 14px;
  background: #fff; border: 1px solid var(--vsc-border); border-radius: 14px; border-bottom-left-radius: 4px; }
.vsc-typing[hidden] { display: none; }
.vsc-typing span { width: 7px; height: 7px; border-radius: 50%; background: #A1A1AA;
  animation: vsc-blink 1.2s infinite ease-in-out; }
.vsc-typing span:nth-child(2) { animation-delay: .2s; }
.vsc-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes vsc-blink { 0%, 80%, 100% { opacity: .3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); } }

.vsc-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px;
  border-top: 1px solid var(--vsc-border); background: #fff; }
.vsc-input { flex: 1; min-height: 40px; max-height: 120px; resize: none; padding: 9px 12px;
  border: 1px solid var(--vsc-border); border-radius: 12px; font: inherit; font-size: 15px;
  color: var(--vsc-text); background: #fff; line-height: 1.4; }
.vsc-input:focus { outline: none; border-color: var(--vsc-brand); box-shadow: 0 0 0 3px rgba(108, 71, 255, .15); }
.vsc-send { width: 40px; height: 40px; flex-shrink: 0; border: 0; border-radius: 12px;
  background: var(--vsc-brand); color: #fff; cursor: pointer; display: flex; align-items: center;
  justify-content: center; }
.vsc-send:hover { background: var(--vsc-brand-dark); }
.vsc-send:disabled { background: #C4B5FD; cursor: not-allowed; }
.vsc-foot { margin: 0; padding: 0 12px 10px; background: #fff; font-size: 11.5px; color: var(--vsc-muted);
  text-align: center; }

@media (max-width: 480px) {
  .vsc { right: 12px; bottom: 12px; }
  .vsc-launcher { width: 52px; height: 52px; padding: 0; justify-content: center; }
  .vsc-launcher__label { position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .vsc--open { left: 0; right: 0; bottom: 0; }
  .vsc-panel { position: fixed; left: 0; right: 0; bottom: 0; width: 100%;
    height: 88vh; height: 88dvh; border-radius: 18px 18px 0 0; border-bottom: 0; }
  .vsc-input { font-size: 16px; } /* evita el zoom automático de iOS */
}

@media (prefers-reduced-motion: reduce) {
  .vsc-launcher, .vsc-launcher:hover { transition: none; transform: none; }
  .vsc-typing span { animation: none; opacity: .7; }
}
