/* assets/agente/widget.css
   Widget de chat del agente — hereda --brand / --brand-dark de core/brand.php,
   así que si cambias el color de marca en site_settings, el widget lo sigue
   automáticamente sin tocar este archivo. */

#agente-bubble {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9998;
  box-shadow: 0 6px 24px rgba(var(--brand-rgb), .35);
  border: none;
  padding: 0;
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease;
}
#agente-bubble:hover { transform: scale(1.06); box-shadow: 0 8px 30px rgba(var(--brand-rgb), .5); }

#agente-pulse-ring {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--brand);
  z-index: 9997;
  pointer-events: none;
  animation: agentePulse 2.6s ease-out infinite;
}
#agente-pulse-ring.agente-pulse-stop { animation: none; display: none; }
@keyframes agentePulse {
  0%   { transform: scale(1);   opacity: .55; }
  70%  { transform: scale(1.9); opacity: 0; }
  100% { transform: scale(1.9); opacity: 0; }
}
#agente-bubble-avatar {
  width: 100% !important; height: 100% !important;
  max-width: 100%; max-height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
#agente-bubble .agente-dot {
  position: absolute;
  top: -2px; right: -2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #ff4757;
  border: 2px solid #0a0a0a;
  display: none;
}
#agente-bubble .agente-dot.show { display: block; }

#agente-panel {
  position: fixed;
  bottom: 96px;
  right: 22px;
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 120px);
  background: var(--agente-bg, #0f0f0f);
  border: 1px solid #2a2520;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.55);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  font-family: var(--agente-font, 'Jost'), system-ui, sans-serif;
}
#agente-panel.open { display: flex; animation: agenteSlideUp .22s ease; }
@keyframes agenteSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

#agente-header {
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.agente-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
#agente-header-avatar {
  width: 52px !important;
  height: 52px !important;
  max-width: 52px; max-height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(10,10,10,.15);
  flex-shrink: 0;
}
#agente-header .agente-title {
  font-family: var(--agente-font, 'Space Grotesk'), sans-serif;
  font-weight: var(--agente-w-titulos, 700);
  font-size: 16px;
  color: var(--agente-txt-header-titulo, var(--agente-header-color, #0a0a0a));
}
#agente-header .agente-subtitle {
  font-size: 11px;
  color: var(--agente-txt-header-sub, var(--agente-header-color, rgba(10,10,10,.72)));
  opacity: .75;
  margin-top: 1px;
  line-height: 1.2;
}
.agente-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 600;
  color: rgba(10,10,10,.75);
  margin-top: 3px;
}
.agente-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #17c964;
  box-shadow: 0 0 0 2px rgba(23,201,100,.25);
  flex-shrink: 0;
}
#agente-close {
  background: none; border: none; cursor: pointer;
  color: var(--agente-header-color, #0a0a0a); opacity: .75; font-size: 20px; line-height: 1;
  padding: 4px;
  flex-shrink: 0;
}
#agente-close:hover { opacity: 1; }

#agente-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--agente-bg, #0a0a0a);
}
.agente-msg {
  max-width: 84%;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-weight: var(--agente-w-mensajes, 400);
}
.agente-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: var(--agente-txt-msg-usuario, #0a0a0a);
  border-bottom-right-radius: 3px;
}
.agente-msg.assistant {
  align-self: flex-start;
  background: #1a1712;
  color: var(--agente-txt-msg-agente, #eee);
  border: 1px solid #2a2520;
  border-bottom-left-radius: 3px;
}
.agente-msg.assistant.thinking { color: #888; font-style: italic; }

.agente-img-wrap {
  align-self: flex-start;
  max-width: 84%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #2a2520;
  background: #1a1712;
}
.agente-img-wrap img {
  display: block;
  width: 100%;
  max-height: 160px;
  object-fit: cover;
}
.agente-img-caption {
  padding: 7px 10px;
  font-size: 11.5px;
  color: #bbb;
  font-family: var(--agente-font, 'Space Grotesk'), sans-serif;
}

.agente-video-wrap {
  align-self: flex-start;
  max-width: 84%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #2a2520;
  background: #1a1712;
}
.agente-video-wrap video,
.agente-video-wrap iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
}

.agente-horarios-wrap {
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 84%;
  margin: 2px 0 4px;
}
.agente-horario-btn {
  background: var(--agente-card-bg, #161310);
  border: 1px solid #2a2520;
  color: #fff;
  font-family: var(--agente-font, 'Jost'), sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  padding: 9px 12px;
  border-radius: 9px;
  cursor: pointer;
  transition: border-color .15s, transform .15s, opacity .15s;
}
.agente-horario-btn:hover:not(:disabled) { border-color: var(--brand); transform: translateY(-1px); }
.agente-horario-btn:disabled { opacity: .4; cursor: not-allowed; }
.agente-horarios-elegido .agente-horario-btn:disabled { opacity: .25; }

.agente-btn-link {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #0a0a0a !important;
  font-weight: 700;
  font-size: 13px;
  font-family: var(--agente-font, 'Jost'), sans-serif;
  padding: 10px 16px;
  border-radius: 10px;
  text-decoration: none !important;
  max-width: 84%;
  transition: opacity .15s, transform .15s;
}
.agente-btn-link:hover { opacity: .9; transform: translateY(-1px); }

#agente-inputbar {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #2a2520;
  background: var(--agente-input-bg, #0f0f0f);
  flex-shrink: 0;
}
#agente-input {
  flex: 1;
  background: var(--agente-input-bg, #0f0f0f);
  border: 1px solid #2a2520;
  border-radius: 9px;
  padding: 10px 12px;
  color: #fff;
  font-size: 13.5px;
  font-family: var(--agente-font, 'Jost'), sans-serif;
  outline: none;
  resize: none;
  max-height: 90px;
}
#agente-input:focus { border-color: var(--brand); }
#agente-send {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .15s, transform .15s;
}
#agente-send:hover { opacity: .9; transform: scale(1.05); }
#agente-send:disabled { opacity: .5; cursor: not-allowed; transform: none; }
#agente-send svg { width: 17px; height: 17px; }

#agente-disclaimer {
  text-align: center;
  font-size: 10px;
  color: var(--agente-txt-disclaimer, #666);
  padding: 0 12px 10px;
  flex-shrink: 0;
}

/* ── Bienvenida: avatar grande + tarjetas de acceso rápido ─────────────── */
.agente-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8px 4px 18px;
  border-bottom: 1px solid #1c1a16;
  margin-bottom: 14px;
}
.agente-welcome-avatar-wrap {
  position: relative;
  width: 96px;
  height: 96px;
  margin-bottom: 12px;
}
.agente-welcome-avatar-wrap::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--brand-rgb),.25), transparent 70%);
}
.agente-welcome-avatar {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(var(--brand-rgb),.35);
  display: block;
}
.agente-welcome-title {
  font-family: var(--agente-font, 'Space Grotesk'), sans-serif;
  font-size: 16px;
  font-weight: var(--agente-w-titulos, 700);
  color: var(--agente-txt-bienvenida-titulo, #fff);
  margin-bottom: 4px;
}
.agente-welcome-desc {
  font-size: 12.5px;
  color: var(--agente-txt-bienvenida-desc, #aaa);
  line-height: 1.5;
  max-width: 280px;
  margin-bottom: 16px;
}
.agente-quick-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 10px;
  align-self: flex-start;
  padding-left: 2px;
}
.agente-quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}
.agente-quick-card {
  background: var(--agente-card-bg, #161310);
  border: 1px solid #2a2520;
  border-radius: 10px;
  padding: 10px 11px;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, transform .15s;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.agente-quick-card:hover { border-color: var(--brand); transform: translateY(-1px); }
.agente-quick-icon { font-size: 16px; line-height: 1; flex-shrink: 0; margin-top: 1px; }
.agente-quick-title { font-size: 12px; font-weight: var(--agente-w-titulos, 600); color: var(--agente-txt-tarjetas-titulo, #fff); }
.agente-quick-sub { font-size: 10.5px; color: var(--agente-txt-tarjetas-sub, #888); margin-top: 1px; line-height: 1.3; }

@media (max-width: 480px) {
  #agente-panel { right: 12px; left: 12px; width: auto; bottom: 88px; }
  #agente-bubble { right: 16px; bottom: 16px; }
  #agente-pulse-ring { right: 16px; bottom: 16px; }
}
/* ── Lightbox: clic en una imagen del chat → verla en grande (portado de
   la instalación de Kovia) ─────────────────────────────────────────── */
#agente-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  background: rgba(0, 0, 0, .88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
  cursor: zoom-out;
  box-sizing: border-box;
  max-width: 100vw;
}
#agente-lightbox.open { opacity: 1; pointer-events: all; }
#agente-lightbox img {
  max-width: 94vw;
  max-height: 84vh;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.2);
  box-shadow: 0 10px 60px rgba(0,0,0,.7);
  object-fit: contain;
}
#agente-lightbox-caption {
  color: #ddd;
  font-family: var(--agente-font, system-ui, sans-serif);
  font-size: 14px;
  text-align: center;
  max-width: 90vw;
}
#agente-lightbox-close {
  position: absolute;
  top: 18px;
  right: 22px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.08);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  transition: background .15s;
}
#agente-lightbox-close:hover { background: rgba(255,255,255,.18); }
