/* Sia — widget de chat comercial de AIPROCESSIA. Autónomo, tema oscuro. */
:root {
  --sia-bg: #0f172a;
  --sia-panel: #111c33;
  --sia-panel-2: #16233f;
  --sia-accent: #3b82f6;
  --sia-accent-2: #1d4ed8;
  --sia-text: #e7edf7;
  --sia-muted: #93a4bd;
  --sia-user: #1d4ed8;
  --sia-radius: 18px;
}

/* Lanzador flotante (sustituye al botón de WhatsApp) */
.sia-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--sia-accent), var(--sia-accent-2));
  color: #fff;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(29, 78, 216, 0.45);
  transition: transform .18s ease, box-shadow .18s ease;
  font-family: inherit;
}
.sia-launcher:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 14px 38px rgba(29,78,216,.55); }
.sia-launcher img { width: 42px; height: 42px; border-radius: 50%; background: #fff; object-fit: contain; }
.sia-launcher .sia-launcher-txt { padding-right: 12px; font-weight: 700; font-size: 15px; white-space: nowrap; }
.sia-launcher .sia-dot {
  position: absolute; top: 4px; right: 6px; width: 12px; height: 12px;
  background: #22c55e; border-radius: 50%; border: 2px solid var(--sia-bg);
}
.sia-hidden { display: none !important; }

@media (max-width: 520px) {
  .sia-launcher .sia-launcher-txt { display: none; }
  .sia-launcher { padding: 6px; right: 16px; bottom: 16px; }
}

/* Panel de chat */
.sia-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: var(--sia-panel);
  color: var(--sia-text);
  border: 1px solid rgba(59,130,246,.25);
  border-radius: var(--sia-radius);
  box-shadow: 0 24px 70px rgba(0,0,0,.55);
  overflow: hidden;
  font-family: inherit;
  animation: sia-in .22s ease;
}
@keyframes sia-in { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }

@media (max-width: 520px) {
  .sia-panel { right: 0; bottom: 0; width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
}

.sia-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--sia-accent-2), #0b1730);
  border-bottom: 1px solid rgba(59,130,246,.2);
}
.sia-head img { width: 40px; height: 40px; border-radius: 50%; background: #fff; object-fit: contain; }
.sia-head .sia-title { font-weight: 800; font-size: 16px; line-height: 1.1; }
.sia-head .sia-sub { font-size: 12px; color: #cfe0ff; display: flex; align-items: center; gap: 6px; }
.sia-head .sia-sub::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #22c55e; display: inline-block; }
.sia-head .sia-grow { flex: 1; }
.sia-iconbtn {
  background: rgba(255,255,255,.12); border: none; color: #fff; cursor: pointer;
  width: 32px; height: 32px; border-radius: 8px; font-size: 16px; line-height: 1;
  display: flex; align-items: center; justify-content: center; transition: background .15s;
}
.sia-iconbtn:hover { background: rgba(255,255,255,.24); }

.sia-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.sia-msgs::-webkit-scrollbar { width: 8px; }
.sia-msgs::-webkit-scrollbar-thumb { background: rgba(147,164,189,.35); border-radius: 8px; }

.sia-msg { max-width: 82%; padding: 10px 13px; border-radius: 14px; font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.sia-msg a { color: #9ec2ff; text-decoration: underline; }
.sia-bot { align-self: flex-start; background: var(--sia-panel-2); border: 1px solid rgba(59,130,246,.18); border-bottom-left-radius: 4px; }
.sia-me { align-self: flex-end; background: linear-gradient(135deg, var(--sia-accent), var(--sia-accent-2)); color: #fff; border-bottom-right-radius: 4px; }

.sia-typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 12px 14px; background: var(--sia-panel-2); border-radius: 14px; border-bottom-left-radius: 4px; }
.sia-typing span { width: 7px; height: 7px; background: var(--sia-muted); border-radius: 50%; animation: sia-blink 1.2s infinite both; }
.sia-typing span:nth-child(2) { animation-delay: .2s; }
.sia-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes sia-blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

.sia-quick { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 8px; }
.sia-chip {
  background: var(--sia-panel-2); color: var(--sia-text); border: 1px solid rgba(59,130,246,.3);
  border-radius: 999px; padding: 7px 12px; font-size: 13px; cursor: pointer; transition: background .15s, border-color .15s;
}
.sia-chip:hover { background: rgba(59,130,246,.18); border-color: var(--sia-accent); }

.sia-foot { padding: 12px; border-top: 1px solid rgba(59,130,246,.18); background: var(--sia-panel); }
.sia-inputrow { display: flex; gap: 8px; align-items: flex-end; }
.sia-input {
  flex: 1; resize: none; max-height: 120px; min-height: 44px;
  background: var(--sia-bg); color: var(--sia-text); border: 1px solid rgba(59,130,246,.28);
  border-radius: 12px; padding: 11px 12px; font-size: 14.5px; font-family: inherit; line-height: 1.4; outline: none;
}
.sia-input:focus { border-color: var(--sia-accent); }
.sia-send {
  width: 44px; height: 44px; flex: 0 0 44px; border: none; border-radius: 12px; cursor: pointer;
  background: linear-gradient(135deg, var(--sia-accent), var(--sia-accent-2)); color: #fff; font-size: 18px;
  display: flex; align-items: center; justify-content: center; transition: transform .15s, opacity .15s;
}
.sia-send:hover { transform: scale(1.05); }
.sia-send:disabled { opacity: .5; cursor: default; transform: none; }
.sia-legal { text-align: center; font-size: 11px; color: var(--sia-muted); margin-top: 8px; }
.sia-legal a { color: var(--sia-muted); }
