/* WooAI Sales Assistant – build/styles.css
   Estilos base del launcher, ventana, burbujas y nudge.
   Usa la variable --wooai-primary (inyectada inline desde PHP) para acentos.
*/

/* Reset mínimo para componentes */
.wooai-chat-launcher, .wooai-chat-root, .wooai-nudge {
  position: fixed;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  line-height: 1.4;
  color: #111;
}

/* -------------------- Launcher (FAB) -------------------- */
.wooai-chat-launcher {
  inset-inline-start: auto; /* se ajusta con style inline (left/right) */
  bottom: 20px;
  z-index: 9999;
}
.wooai-chat-launcher .wooai-fab {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: var(--wooai-primary, #111111);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,.18), 0 2px 8px rgba(0,0,0,.12);
  transition: transform .12s ease, box-shadow .12s ease, opacity .2s ease;
  will-change: transform;
}
.wooai-chat-launcher .wooai-fab:hover { transform: translateY(-1px); box-shadow: 0 10px 28px rgba(0,0,0,.2), 0 3px 10px rgba(0,0,0,.14); }
.wooai-chat-launcher .wooai-fab:active { transform: translateY(0); }
.wooai-chat-launcher .wooai-fab-icon img { width: 24px; height: 24px; display: block; border-radius: 6px; }
.wooai-chat-launcher .wooai-fab-label { font-weight: 600; font-size: 14px; letter-spacing: .2px; }
.wooai-chat-launcher .wooai-fab-badge {
  background: #ff4757;
  color: #fff;
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 12px;
  font-weight: 700;
  margin-inline-start: 2px;
}
.wooai-chat-launcher .wooai-fab-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  background: #000;
  color: #fff;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}

/* Modo "Mostrar sólo imagen": el círculo existe pero es invisible y deja sobresalir la imagen */
.wooai-chat-launcher .wooai-fab-avatar.is-circle.image-only {
  overflow: visible !important;
  background: transparent !important;
  border-color: transparent !important;
}

/* Avatar dentro del FAB (nombre/imagen) */
.wooai-chat-launcher .wooai-fab-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--wooai-icon-bg, var(--wooai-primary, #111111));
  border: 2px solid var(--wooai-icon-border, transparent);
  overflow: hidden;
}
.wooai-chat-launcher .wooai-fab-avatar.is-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* -------------------- Ventana del chat -------------------- */
.wooai-chat-root {
  inset-inline-end: 20px; /* o left si bottom-left */
  bottom: 100px;
  width: 360px;
  max-width: calc(100vw - 24px);
  z-index: 9999;
}
.wooai-chat-root .wooai-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.wooai-chat-root.open .wooai-overlay {
  opacity: 1;
  pointer-events: auto;
}

.wooai-chat-window {
  position: absolute;
  inset-inline-end: 0;
  bottom: 0;
  width: 100%;
  max-height: min(640px, calc(100vh - 120px));
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0,0,0,.22), 0 4px 16px rgba(0,0,0,.12);
  overflow: hidden;
  transform: translateY(20px);
  opacity: 0;
  transition: transform .2s ease, opacity .2s ease;
}
.wooai-chat-root.open .wooai-chat-window {
  transform: translateY(0);
  opacity: 1;
}

/* Header */
.wooai-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  background: linear-gradient(0deg, rgba(0,0,0,0) 0%, rgba(0,0,0,.02) 100%);
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.wooai-brand { display: inline-flex; align-items: center; gap: 10px; }
.wooai-brand-icon img, .wooai-brand-icon svg { width: 22px; height: 22px; display: block; }
.wooai-title { font-weight: 700; font-size: 15px; color: #111; }
.wooai-header-badge {
  margin-inline-start: 6px; background: var(--wooai-primary, #111111); color: #fff;
  border-radius: 999px; padding: 2px 6px; font-size: 12px; font-weight: 700;
}
.wooai-actions { display: inline-flex; gap: 8px; }
.wooai-btn { background: transparent; border: 0; width: 28px; height: auto; border-radius: 6px; cursor: pointer; color: #333; line-height: 0.5; }
.wooai-btn:hover { background: rgba(0,0,0,.06); }
.wooai-actions .wooai-btn.wooai-close { height: 20px; }

/* Error bar */
/* Error bar */
.wooai-error {
  background: #fee;
  color: #a40000;
  padding: 8px 12px;
  font-size: 13px;
  border-bottom: 1px solid #f7caca;
}

/* Solo visible cuando NO tiene [hidden] */
.wooai-error:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Si lleva hidden, se oculta de verdad */
.wooai-error[hidden] {
  display: none;
}

.wooai-error-dismiss {
  background: transparent; border: 0; color: #a40000; font-size: 16px; cursor: pointer;
}

/* Thread */
.wooai-thread {
  padding: 12px;
  overflow: auto;
  background: #fafafa;
}
.wooai-msg { display: flex; margin: 6px 0; }
.wooai-msg.user { justify-content: flex-end; }
.wooai-msg.assistant { justify-content: flex-start; }
.wooai-msg.system .wooai-bubble { background: #eef6ff; color: #0c2e66; border: 1px solid #d6e9ff; }
.wooai-msg.error .wooai-bubble { background: #fff1f2; color: #8a0010; border: 1px solid #ffd1d6; }
.wooai-bubble {
  max-width: 80%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
  background: #fff;
  border: 1px solid rgba(0,0,0,.06);
  box-shadow: 0 1px 0 rgba(0,0,0,.02);
}
.wooai-msg.user .wooai-bubble {
  background: var(--wooai-primary, #111111);
  color: #fff;
  border: 1px solid rgba(0,0,0,.0);
}
.wooai-msg.assistant .wooai-bubble a {
  text-decoration: underline;
}

/* Typing */
.wooai-typing {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 12px 10px 12px; background: #fafafa00;
}
.wooai-typing .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #bbb; display: inline-block;
  animation: wooai-bounce 1.2s infinite ease-in-out;
}
.wooai-typing .dot:nth-child(1){ animation-delay: 0s; }
.wooai-typing .dot:nth-child(2){ animation-delay: .2s; }
.wooai-typing .dot:nth-child(3){ animation-delay: .4s; }
@keyframes wooai-bounce {
  0%, 80%, 100% { transform: scale(0.66); opacity: .6; }
  40% { transform: scale(1); opacity: 1; }
}

/* Sugerencias (chips) */
/* Contenedor de sugerencias */
.wooai-suggestions {
  padding: 8px 12px;
  border-top: 1px solid rgba(0,0,0,.06);
  background: #fff;
}

/* Solo visible cuando NO tiene [hidden] */
.wooai-suggestions:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Oculta de verdad cuando tiene [hidden] */
.wooai-suggestions[hidden] {
  display: none;
}

.wooai-chip {
  border: 1px solid rgba(0,0,0,.12);
  background: #fff;
  color: #222;
  border-radius: 999px;
  font-size: 13px;
  padding: 6px 10px;
  cursor: pointer;
}
.wooai-chip:hover { border-color: rgba(0,0,0,.2); }

/* Composer */
.wooai-composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px 12px 12px 12px;
  border-top: 1px solid rgba(0,0,0,.06);
  background: #fff;
}
.wooai-input {
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 20px !important;
  max-height: 180px;
  resize: none;
  outline: none;
  font-size: 14px;
  line-height: 1.4;
}
.wooai-input:focus { border-color: var(--wooai-primary, #111111); box-shadow: 0 0 0 3px rgba(17, 17, 17, .08); }
.wooai-send {
  border: 0;
  background: var(--wooai-primary, #111111);
  color: #fff;
  width: 42px; height: auto;
  padding: 5px !important;
  margin: 1px !important;
  border-radius: 10px !important;
  cursor: pointer;
  display: inline-flex !important; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.16);
}
.wooai-send:hover { filter: brightness(1.05); }

/* Nudge (teaser) */
.wooai-nudge {
  inset-inline-end: 20px; bottom: 80px;
  max-width: 320px;
  background: #fff;
  border: 1px solid rgba(0,0,0,.08);
  box-shadow: 0 16px 36px rgba(0,0,0,.18), 0 4px 12px rgba(0,0,0,.10);
  border-radius: 14px;
  padding: 12px 14px;
  transform: translateY(10px);
  opacity: 0;
  transition: transform .2s ease, opacity .2s ease;
}
.wooai-nudge.show { transform: translateY(0); opacity: 1; }
.wooai-nudge .wooai-nudge-content a { color: var(--wooai-primary, #111111); text-decoration: underline; }

/* Utilidades */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* -------------------- Responsivo -------------------- */
@media (max-width: 480px) {
  .wooai-chat-root { inset-inline: 12px; bottom: 88px; width: auto; }
  .wooai-chat-window { max-height: calc(100vh - 120px); }
  .wooai-nudge { inset-inline: 12px; bottom: 72px; max-width: none; }
}

/* -------------------- Modo oscuro (auto) -------------------- */
@media (prefers-color-scheme: dark) {
  .wooai-chat-launcher, .wooai-chat-root, .wooai-nudge { color: #eaeaea; }
  .wooai-chat-launcher .wooai-fab { box-shadow: 0 8px 24px rgba(0,0,0,.5), 0 2px 8px rgba(0,0,0,.3); }
  .wooai-chat-window { background: #121213; border: 1px solid rgba(255,255,255,.06); }
  .wooai-header { background: rgba(255,255,255,.02); border-bottom-color: rgba(255,255,255,.06); }
  .wooai-title { color: #f6f6f7; }
  .wooai-thread { background: #0d0d0e; }
  .wooai-bubble { background: #161619; border-color: rgba(255,255,255,.06); color: #e9e9ea; }
  .wooai-msg.system .wooai-bubble { background: #0f2336; color: #d1e7ff; border-color: #17446c; }
  .wooai-msg.error .wooai-bubble { background: #3a1116; color: #ffd2d9; border-color: #5f1720; }
  .wooai-suggestions, .wooai-composer { background: #121213; border-top-color: rgba(255,255,255,.06); }
  .wooai-input { background: #0d0d0e; color: #eee; border-color: rgba(255,255,255,.12); }
  .wooai-nudge { background: #151517; border-color: rgba(255,255,255,.08); box-shadow: 0 16px 36px rgba(0,0,0,.6), 0 4px 12px rgba(0,0,0,.5); }
}
