/* Widget de chat EFNE - estilos aislados con prefijo .efne-chat- para evitar colisiones con el theme de Shopify */

/* Dawn y algunas apps aplican reglas globales a botones, formularios y SVG. El
   contenedor y sus controles se fuerzan a un estado visible y predecible. */
#efne-chat-root,
#efne-chat-root * {
  box-sizing: border-box;
}

#efne-chat-root {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.efne-chat-fab {
  position: fixed;
  right: 20px;
  /* Elevado para NO solaparse con el botón de WhatsApp de la tienda (esquina
     inferior derecha). Ajusta este valor si el de WhatsApp cambia de tamaño. */
  bottom: 104px;
  z-index: 2147483646;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.efne-chat-fab-label {
  background: #1a1a1a;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  white-space: nowrap;
  pointer-events: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.efne-chat-launcher {
  -webkit-appearance: none;
  appearance: none;
  width: 60px;
  min-width: 60px;
  height: 60px;
  min-height: 60px;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  background: #1a1a1a;
  color: #fff;
  border: none;
  cursor: pointer;
  font: inherit;
  line-height: 1;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.efne-chat-launcher:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.efne-chat-launcher svg {
  display: block;
  width: 26px;
  height: 26px;
  pointer-events: none;
}

.efne-chat-window {
  position: fixed;
  right: 20px;
  bottom: 180px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 200px);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 2147483646;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.efne-chat-window.efne-chat-open {
  display: flex;
}

.efne-chat-header {
  background: #1a1a1a;
  color: #fff;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.efne-chat-header-title {
  font-size: 16px;
  font-weight: 600;
}

.efne-chat-header-subtitle {
  font-size: 12px;
  opacity: 0.75;
}

.efne-chat-close {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  top: 14px;
  right: 16px;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
  padding: 0;
  margin: 0;
  min-width: 24px;
  min-height: 24px;
}

.efne-chat-close:hover {
  opacity: 1;
}

.efne-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f7f7f8;
}

.efne-chat-msg {
  max-width: 82%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.efne-chat-msg-bot {
  align-self: flex-start;
  background: #fff;
  color: #1a1a1a;
  border: 1px solid #e6e6e8;
  border-bottom-left-radius: 4px;
}

.efne-chat-msg-user {
  align-self: flex-end;
  background: #1a1a1a;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.efne-chat-typing {
  align-self: flex-start;
  font-size: 13px;
  color: #888;
  padding: 4px 13px;
}

.efne-chat-products {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.efne-chat-product-card {
  border: 1px solid #e6e6e8;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  text-decoration: none;
  color: #1a1a1a;
  display: block;
}

.efne-chat-product-card:hover {
  border-color: #1a1a1a;
}

.efne-chat-product-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}

.efne-chat-product-meta {
  font-size: 12px;
  color: #666;
}

.efne-chat-input-row {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #eee;
  background: #fff;
}

.efne-chat-input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
}

.efne-chat-input:focus {
  border-color: #1a1a1a;
}

.efne-chat-send {
  -webkit-appearance: none;
  appearance: none;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 0 18px;
  cursor: pointer;
  font-size: 14px;
}

.efne-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.efne-chat-handoff-form {
  padding: 14px 16px;
  border-top: 1px solid #eee;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.efne-chat-handoff-title {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 2px;
}

.efne-chat-handoff-form input,
.efne-chat-handoff-form textarea {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  resize: none;
}

.efne-chat-handoff-form input:focus,
.efne-chat-handoff-form textarea:focus {
  border-color: #1a1a1a;
}

.efne-chat-consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 11px;
  line-height: 1.35;
  color: #666;
}

.efne-chat-consent input {
  margin-top: 2px;
  flex-shrink: 0;
}

.efne-chat-consent a {
  color: #1a1a1a;
  text-decoration: underline;
}

.efne-chat-handoff-submit {
  -webkit-appearance: none;
  appearance: none;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 13px;
  cursor: pointer;
}

.efne-chat-handoff-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 480px) {
  .efne-chat-window {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 92px;
  }
  .efne-chat-fab {
    right: 16px;
    /* Elevado sobre el botón de WhatsApp también en móvil. */
    bottom: 96px;
  }
}
