/*
 * IHK Studio — WhatsApp Chatbot Widget
 * assets/css/chatbot.css
 * ─────────────────────────────────────────────────
 * Integración como burbuja flotante WhatsApp.
 * No afecta ninguna clase existente del sitio.
 * Todas las clases llevan prefijo .ihk-
 */

/* ── VARIABLES DEL CHATBOT ──────────────────────── */
:root {
  --wa-green:       #25D366;
  --wa-green-dark:  #1da851;
  --wa-green-glow:  rgba(37, 211, 102, 0.35);
  --chat-bg:        rgba(10, 9, 7, 0.97);
  --chat-surface:   rgba(22, 19, 14, 0.95);
  --chat-bubble-bot: rgba(28, 24, 16, 0.98);
  --chat-bubble-user: linear-gradient(135deg, #25D366, #1da851);
  --chat-border:    rgba(201, 162, 78, 0.15);
  --chat-text:      #e8e0d0;
  --chat-muted:     #7a6e5e;
  --chat-gold:      #c9a24e;
  --chat-z:         9990;
}

/* ────────────────────────────────────────────────
   BURBUJA FLOTANTE
───────────────────────────────────────────────── */
.ihk-wa-bubble {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 62px;
  height: 62px;
  background: var(--wa-green);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: calc(var(--chat-z) + 5);
  box-shadow:
    0 4px 18px rgba(37, 211, 102, 0.45),
    0 1px 4px rgba(0,0,0,0.4);
  transition: transform 0.22s cubic-bezier(.34,1.56,.64,1), box-shadow 0.22s;
  outline: none;
  border: none;
  -webkit-tap-highlight-color: transparent;
}

.ihk-wa-bubble:hover {
  transform: scale(1.1);
  box-shadow:
    0 6px 26px rgba(37, 211, 102, 0.6),
    0 2px 8px rgba(0,0,0,0.5);
}

.ihk-wa-bubble:active {
  transform: scale(0.95);
}

/* Ícono WA SVG */
.ihk-wa-bubble svg {
  width: 38px;
  height: 38px;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(.34,1.56,.64,1);
}

/* Estado abierto — rota a X */
.ihk-wa-bubble.ihk-is-open svg.ihk-icon-wa { display: none; }
.ihk-wa-bubble:not(.ihk-is-open) svg.ihk-icon-close { display: none; }

/* ── LUZ PULSANTE (led verde) ── */
.ihk-wa-bubble::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(37, 211, 102, 0.28);
  animation: ihk-pulse-ring 2.4s ease-out infinite;
  pointer-events: none;
}

/* Segundo anillo más grande */
.ihk-wa-bubble::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(37, 211, 102, 0.12);
  animation: ihk-pulse-ring 2.4s ease-out infinite 0.7s;
  pointer-events: none;
}

@keyframes ihk-pulse-ring {
  0%   { transform: scale(1); opacity: 1; }
  70%  { transform: scale(1.75); opacity: 0; }
  100% { transform: scale(1.75); opacity: 0; }
}

/* LED puntito encendido — esquina superior derecha */
.ihk-wa-led {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  border: 2px solid var(--wa-green);
  z-index: 2;
  animation: ihk-led-glow 1.8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes ihk-led-glow {
  0%, 100% {
    background: #4dffa0;
    box-shadow: 0 0 0 0 rgba(77,255,160,0.7), 0 0 5px rgba(77,255,160,0.9);
  }
  50% {
    background: #25D366;
    box-shadow: 0 0 0 4px rgba(37,211,102,0), 0 0 10px rgba(37,211,102,0.8);
  }
}

/* ── TOOLTIP ── */
.ihk-tooltip {
  position: fixed;
  bottom: 40px;
  right: 102px;
  background: rgba(14, 12, 8, 0.96);
  color: var(--chat-text);
  font-family: 'Cormorant Garamond', serif;
  font-size: 13px;
  font-style: italic;
  padding: 9px 15px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateX(8px);
  transition: opacity 0.35s, transform 0.35s;
  border: 1px solid var(--chat-border);
  border-left: 2px solid var(--chat-gold);
  z-index: calc(var(--chat-z) + 4);
  backdrop-filter: blur(8px);
}

.ihk-tooltip::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 0; height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 6px solid rgba(14,12,8,0.96);
}

.ihk-tooltip.ihk-visible {
  opacity: 1;
  transform: translateX(0);
}

/* ────────────────────────────────────────────────
   VENTANA DEL CHAT
───────────────────────────────────────────────── */
.ihk-chat-window {
  position: fixed;
  bottom: 104px;
  right: 28px;
  width: 358px;
  max-height: 590px;
  min-height: 200px;
  background: var(--chat-bg);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow:
    0 24px 64px rgba(0,0,0,0.75),
    0 0 0 1px rgba(201,162,78,0.1),
    inset 0 1px 0 rgba(255,255,255,0.04);
  z-index: var(--chat-z);
  transform-origin: bottom right;
  transform: scale(0.82) translateY(24px);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.28s ease;
}

.ihk-chat-window.ihk-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ── HEADER ── */
.ihk-chat-header {
  background: linear-gradient(135deg, rgba(20,17,12,0.98) 0%, rgba(14,12,8,0.98) 100%);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid var(--chat-border);
  position: relative;
  flex-shrink: 0;
}

.ihk-chat-header::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(to bottom, var(--wa-green), transparent);
  border-radius: 0 0 0 16px;
}

.ihk-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1.5px solid rgba(201,162,78,0.3);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(20,17,12,1);
  position: relative;
}

.ihk-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: drop-shadow(0 0 4px rgba(192,57,43,0.4));
}

/* Punto verde de online sobre el avatar */
.ihk-avatar::after {
  content: '';
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 10px;
  height: 10px;
  background: var(--wa-green);
  border-radius: 50%;
  border: 1.5px solid rgba(10,9,7,0.97);
  animation: ihk-led-glow 2s infinite;
}

.ihk-header-info { flex: 1; overflow: hidden; }

.ihk-header-name {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 17px;
  letter-spacing: 1.8px;
  color: #f4efe6;
  line-height: 1;
}

.ihk-header-sub {
  font-family: 'Cormorant Garamond', serif;
  font-size: 11px;
  font-style: italic;
  color: var(--wa-green);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 5px;
  opacity: 0.9;
}

.ihk-close-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  color: var(--chat-muted);
  cursor: pointer;
  font-size: 14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}

.ihk-close-btn:hover {
  background: rgba(255,255,255,0.09);
  color: var(--chat-text);
}

/* ── CHAT BODY ── */
.ihk-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 13px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background:
    radial-gradient(ellipse at 15% 80%, rgba(37,211,102,0.02) 0%, transparent 55%),
    rgba(10, 9, 7, 0.97);
  scroll-behavior: smooth;
}

.ihk-chat-body::-webkit-scrollbar {
  width: 3px;
}
.ihk-chat-body::-webkit-scrollbar-thumb {
  background: rgba(201,162,78,0.15);
  border-radius: 3px;
}
.ihk-chat-body::-webkit-scrollbar-track {
  background: transparent;
}

/* ── BURBUJAS ── */
.ihk-bubble {
  max-width: 84%;
  padding: 9px 13px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 14.5px;
  line-height: 1.55;
  margin-bottom: 2px;
  animation: ihk-bubble-in 0.32s cubic-bezier(0.34, 1.4, 0.64, 1) both;
  word-break: break-word;
}

@keyframes ihk-bubble-in {
  from { opacity: 0; transform: scale(0.75) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.ihk-bubble.ihk-bot {
  background: var(--chat-bubble-bot);
  color: var(--chat-text);
  border-radius: 4px 14px 14px 14px;
  border: 1px solid rgba(201,162,78,0.1);
  border-left: 2px solid rgba(37,211,102,0.4);
  align-self: flex-start;
}

.ihk-bubble.ihk-user {
  background: var(--chat-bubble-user);
  color: #fff;
  border-radius: 14px 4px 14px 14px;
  align-self: flex-end;
  font-weight: 500;
  box-shadow: 0 2px 10px rgba(37,211,102,0.25);
}

.ihk-bubble strong {
  color: var(--chat-gold);
  font-weight: 600;
}

.ihk-bubble.ihk-user strong {
  color: rgba(255,255,255,0.95);
}

/* Timestamp */
.ihk-ts {
  font-family: 'Cormorant Garamond', serif;
  font-size: 9.5px;
  letter-spacing: 0.02em;
  color: var(--chat-muted);
  margin-bottom: 6px;
}

.ihk-ts.ihk-ts-right {
  align-self: flex-end;
  color: rgba(255,255,255,0.4);
}

/* ── TYPING INDICATOR ── */
.ihk-typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 11px 14px;
  background: var(--chat-bubble-bot);
  border-radius: 4px 14px 14px 14px;
  border: 1px solid rgba(201,162,78,0.1);
  border-left: 2px solid rgba(37,211,102,0.3);
  align-self: flex-start;
  animation: ihk-bubble-in 0.28s both;
  margin-bottom: 2px;
}

.ihk-typing span {
  width: 6px;
  height: 6px;
  background: var(--chat-muted);
  border-radius: 50%;
  animation: ihk-dot 1.3s ease-in-out infinite;
}
.ihk-typing span:nth-child(2) { animation-delay: 0.18s; }
.ihk-typing span:nth-child(3) { animation-delay: 0.36s; }

@keyframes ihk-dot {
  0%, 60%, 100% { transform: translateY(0); background: var(--chat-muted); }
  30% { transform: translateY(-5px); background: var(--wa-green); }
}

/* ── OPCIONES ── */
.ihk-options {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-self: stretch;
  animation: ihk-bubble-in 0.36s both;
  margin-bottom: 6px;
}

.ihk-opt {
  background: transparent;
  border: 1px solid rgba(201,162,78,0.2);
  color: var(--chat-gold);
  padding: 8px 13px;
  border-radius: 8px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 13.5px;
  cursor: pointer;
  text-align: left;
  transition: background 0.18s, border-color 0.18s, transform 0.15s, color 0.18s;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.3;
}

.ihk-opt:hover {
  background: rgba(201,162,78,0.07);
  border-color: rgba(201,162,78,0.45);
  color: #f0d99a;
  transform: translateX(3px);
}

.ihk-opt:active {
  transform: translateX(1px) scale(0.98);
}

.ihk-opt .ihk-opt-icon {
  font-size: 14px;
  flex-shrink: 0;
}

/* ── FOOTER ── */
.ihk-chat-footer {
  padding: 10px 13px;
  background: rgba(14,12,8,0.98);
  border-top: 1px solid var(--chat-border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ihk-footer-note {
  font-family: 'Cormorant Garamond', serif;
  font-size: 10.5px;
  font-style: italic;
  color: rgba(122,110,94,0.7);
  flex: 1;
  text-align: center;
}

.ihk-wa-cta {
  background: var(--wa-green);
  color: #fff;
  border: none;
  padding: 8px 15px;
  border-radius: 6px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 12px;
  letter-spacing: 1.2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background 0.2s, transform 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.ihk-wa-cta:hover { background: var(--wa-green-dark); transform: scale(1.04); }
.ihk-wa-cta svg { width: 13px; height: 13px; flex-shrink: 0; }

.ihk-restart-btn {
  background: none;
  border: none;
  color: rgba(122,110,94,0.5);
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s, transform 0.2s;
  flex-shrink: 0;
}
.ihk-restart-btn:hover { color: var(--chat-muted); transform: rotate(-180deg); }

/* ── SEPARADOR DE SECCIÓN ── */
.ihk-section-label {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 9px;
  letter-spacing: 2.5px;
  color: rgba(201,162,78,0.35);
  text-align: center;
  align-self: center;
  margin: 4px 0;
}

/* ── BADGE DE NOTIFICACIÓN ── */
.ihk-badge {
  position: absolute;
  top: -3px;
  right: -2px;
  width: 18px;
  height: 18px;
  background: #e74c3c;
  border-radius: 50%;
  border: 2px solid rgba(10,9,7,0.97);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 9px;
  color: white;
  pointer-events: none;
  animation: ihk-badge-pop 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
  z-index: 3;
}

@keyframes ihk-badge-pop {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* ── ESTADO DESHABILITADO DE OPCIONES ── */
.ihk-options.ihk-done .ihk-opt {
  pointer-events: none;
  opacity: 0.3;
  transform: none;
}

/* ── RESPONSIVE MOBILE ── */
@media (max-width: 480px) {
  .ihk-chat-window {
    width: calc(100vw - 20px);
    right: 10px;
    bottom: 92px;
    max-height: calc(100dvh - 120px);
    border-radius: 14px;
  }

  .ihk-wa-bubble {
    bottom: 20px;
    right: 16px;
    width: 56px;
    height: 56px;
  }

  .ihk-tooltip { display: none; }
}
