/* WooBot Widget CSS v1.2
   Los colores se inyectan vía :root desde woobot-widget.js */

:root {
  --wb-primary:  #2d5a27;
  --wb-bg:       #ffffff;
  --wb-text:     #1a1a1a;
  --wb-surface:  #f5f5f5;
  --wb-border:   #e0e0e0;
  --wb-muted:    #888888;
  --wb-radius:   16px;
  --wb-shadow:   0 24px 60px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.06);
  --wb-z:        999999;
  --wb-bottom:   90px;
  --wb-right:    24px;
}

/* ── Wrapper ── */
#woobot-wrapper {
  position: fixed;
  bottom: var(--wb-bottom);
  z-index: var(--wb-z);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  box-sizing: border-box;
}

#woobot-wrapper[data-position="right"] { right: var(--wb-right); }
#woobot-wrapper[data-position="left"]  { left: var(--wb-right); }

#woobot-wrapper *, #woobot-wrapper *::before, #woobot-wrapper *::after {
  box-sizing: border-box;
}

/* ── Botón flotante ── */
#woobot-toggle {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--wb-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  z-index: 1;
  margin-left: auto;
}

#woobot-toggle:hover {
  transform: scale(1.07);
  box-shadow: 0 10px 28px rgba(0,0,0,0.25);
}

/* ── Panel ── */
#woobot-panel {
  position: absolute;
  bottom: 66px;
  width: 360px;
  max-height: 540px;
  background: var(--wb-bg);
  border-radius: var(--wb-radius);
  box-shadow: var(--wb-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: wb-slideUp 0.3s cubic-bezier(0.16,1,0.3,1) both;
}

#woobot-wrapper[data-position="right"] #woobot-panel { right: 0; }
#woobot-wrapper[data-position="left"]  #woobot-panel { left: 0; }
#woobot-panel[hidden] { display: none; }

@keyframes wb-slideUp {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Header ── */
.wb-header {
  background: var(--wb-primary);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.wb-avatar {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  overflow: hidden;
}

.wb-avatar img { width: 100%; height: 100%; object-fit: cover; }

.wb-header-info { flex: 1; min-width: 0; }
.wb-header-info strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wb-header-info span   { font-size: 11px; opacity: 0.8; }

/* Botón cerrar */
.wb-header-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
  font-size: 16px;
  padding: 0;
}

.wb-header-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }

/* ── Mensajes ── */
.wb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
  background: var(--wb-bg);
  overscroll-behavior: contain;
}

.wb-messages::-webkit-scrollbar { width: 4px; }
.wb-messages::-webkit-scrollbar-track { background: transparent; }
.wb-messages::-webkit-scrollbar-thumb { background: var(--wb-border); border-radius: 4px; }

/* ── Burbujas ── */
.wb-msg {
  display: flex;
  flex-direction: column;
  max-width: 84%;
  animation: wb-fadeIn 0.25s ease both;
}

@keyframes wb-fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.wb-msg--bot  { align-self: flex-start; }
.wb-msg--user { align-self: flex-end; }

.wb-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
}

.wb-msg--bot .wb-bubble {
  background: var(--wb-surface);
  color: var(--wb-text);
  border: 1px solid var(--wb-border);
  border-bottom-left-radius: 4px;
}

.wb-msg--user .wb-bubble {
  background: var(--wb-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.wb-msg--bot .wb-bubble a {
  color: var(--wb-primary);
  text-decoration: underline;
}

.wb-time {
  font-size: 10px;
  color: var(--wb-muted);
  margin-top: 3px;
  padding: 0 3px;
}
.wb-msg--user .wb-time { text-align: right; }

/* Typing */
.wb-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 14px;
  width: fit-content;
}

.wb-typing span {
  width: 6px;
  height: 6px;
  background: var(--wb-muted);
  border-radius: 50%;
  animation: wb-bounce 1.2s infinite;
}
.wb-typing span:nth-child(2) { animation-delay: 0.2s; }
.wb-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes wb-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-5px); }
}

/* CTA WhatsApp */
.wb-wa-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #25D366;
  color: #fff !important;
  text-decoration: none !important;
  padding: 9px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  margin-top: 6px;
  transition: background 0.2s;
}
.wb-wa-cta:hover { background: #1da851; }

/* ── Quick replies ── */
.wb-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 12px 10px;
  flex-shrink: 0;
}

.wb-qr-btn {
  padding: 7px 12px;
  border-radius: 100px;
  border: 1px solid var(--wb-border);
  background: transparent;
  color: var(--wb-text);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
  font-family: inherit;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wb-qr-btn:hover {
  border-color: var(--wb-primary);
  color: var(--wb-primary);
  background: rgba(0,0,0,0.03);
}

/* Botón ··· para expandir opciones ocultas */
.wb-qr-more {
  letter-spacing: 0.1em;
  font-weight: 700;
  color: var(--wb-muted) !important;
  border-style: dashed !important;
  min-width: 44px;
}

.wb-qr-more:hover {
  border-color: var(--wb-primary) !important;
  color: var(--wb-primary) !important;
}

/* ── Input area ── */
.wb-input-area {
  border-top: 1px solid var(--wb-border);
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
  background: var(--wb-bg);
}

#woobot-input {
  flex: 1;
  border: 1px solid var(--wb-border);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--wb-text);
  background: var(--wb-surface);
  resize: none;
  outline: none;
  max-height: 80px;
  line-height: 1.4;
  transition: border-color 0.2s;
  /* evitar zoom en iOS al hacer focus */
  font-size: max(16px, 13.5px);
}

#woobot-input::placeholder { color: var(--wb-muted); }
#woobot-input:focus { border-color: var(--wb-primary); }

#woobot-send {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--wb-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  flex-shrink: 0;
  transition: transform 0.2s, filter 0.2s;
  -webkit-tap-highlight-color: transparent;
}

#woobot-send svg { stroke: #ffffff; flex-shrink: 0; }
#woobot-send:hover { transform: scale(1.06); filter: brightness(1.1); }

/* ── RESPONSIVE MOBILE ── */
@media (max-width: 600px) {
  #woobot-wrapper {
    bottom: 90px;
    left: 0 !important;
    right: 0 !important;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding: 0 16px;
  }

  #woobot-wrapper[data-position="left"] {
    align-items: flex-start;
  }

  #woobot-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 85vh;
    border-radius: var(--wb-radius) var(--wb-radius) 0 0;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.15);
  }

  #woobot-wrapper[data-position="right"] #woobot-panel,
  #woobot-wrapper[data-position="left"]  #woobot-panel {
    right: 0;
    left: 0;
  }

  /* Más espacio en quick replies para que sean tapeables */
  .wb-qr-btn {
    padding: 9px 14px;
    font-size: 13px;
  }

  /* Evitar que el teclado aplaste el chat */
  #woobot-panel {
    max-height: 90vh;
  }
}

@media (max-width: 380px) {
  .wb-bubble { font-size: 13px; }
  .wb-qr-btn { font-size: 12px; padding: 7px 11px; }
}
