/* Botón Flotante */
.wbp-floating-button {
  position: fixed !important;
  z-index: 2147483647 !important; /* Máximo z-index posible */
  transition: all 0.3s ease;
  display: block !important; /* Asegurar visibilidad */
}

.wbp-floating-button.wbp-bottom-right {
  bottom: 20px;
  right: 20px;
}

.wbp-floating-button.wbp-bottom-left {
  bottom: 20px;
  left: 20px;
}

.wbp-floating-button.wbp-top-right {
  top: 20px;
  right: 20px;
}

.wbp-floating-button.wbp-top-left {
  top: 20px;
  left: 20px;
}

.wbp-button {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #25d366;
  color: white;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  border: none;
  outline: none;
}

.wbp-button:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6);
  color: white;
}

.wbp-button:active {
  transform: scale(0.95);
}

.wbp-button-small {
  width: 50px;
  height: 50px;
}

.wbp-button-medium {
  width: 60px;
  height: 60px;
}

.wbp-button-large {
  width: 70px;
  height: 70px;
}

.wbp-button svg {
  width: 60%;
  height: 60%;
  fill: white;
}

/* Mensaje de Bienvenida */
.wbp-greeting {
  position: fixed !important;
  z-index: 2147483646 !important; /* Justo debajo del botón/chat */
  background: white;
  padding: 15px 20px;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  max-width: 250px;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  pointer-events: none;
}

.wbp-greeting.wbp-show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.wbp-greeting.wbp-bottom-right {
  bottom: 90px;
  right: 20px;
}

.wbp-greeting.wbp-bottom-left {
  bottom: 90px;
  left: 20px;
}

.wbp-greeting.wbp-top-right {
  top: 90px;
  right: 20px;
}

.wbp-greeting.wbp-top-left {
  top: 90px;
  left: 20px;
}

.wbp-greeting-close {
  position: absolute;
  top: 5px;
  right: 5px;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #999;
  padding: 5px;
  line-height: 1;
}

.wbp-greeting-close:hover {
  color: #333;
}

.wbp-greeting-text {
  margin: 0;
  font-size: 14px;
  color: #333;
  line-height: 1.5;
}

/* Botón en Productos */
.wbp-product-button {
  margin: 20px 0;
}

.wbp-product-button .wbp-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 16px;
  font-weight: 600;
  width: auto;
  height: auto;
}

.wbp-product-button .wbp-button svg {
  width: 20px;
  height: 20px;
}

/* Shortcode Button */
.wbp-shortcode-button {
  display: inline-block;
  margin: 10px 0;
}

.wbp-shortcode-button .wbp-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 600;
  width: auto;
  height: auto;
}

.wbp-shortcode-button .wbp-button svg {
  width: 18px;
  height: 18px;
}

/* Responsive */
@media screen and (max-width: 768px) {
  .wbp-hide-mobile {
    display: none !important;
  }

  .wbp-floating-button.wbp-bottom-right,
  .wbp-floating-button.wbp-bottom-left {
    bottom: 15px;
  }

  .wbp-floating-button.wbp-bottom-right {
    right: 15px;
  }

  .wbp-floating-button.wbp-bottom-left {
    left: 15px;
  }

  .wbp-greeting {
    max-width: 200px;
    font-size: 13px;
  }
}

@media screen and (min-width: 769px) {
  .wbp-hide-desktop {
    display: none !important;
  }
}

/* Animaciones */
@keyframes wbp-pulse {
  0% {
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
  }
  50% {
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.7);
  }
  100% {
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
  }
}

.wbp-button.wbp-pulse {
  animation: wbp-pulse 2s infinite;
}

/* Accesibilidad */
.wbp-button:focus {
  outline: 2px solid #25d366;
  outline-offset: 2px;
}

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

/* Agregando estilos para modal de sucursales */
.wbp-branches-modal {
  display: none;
  position: fixed !important;
  z-index: 2147483647 !important;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.7);
  animation: wbp-fadeIn 0.3s ease;
}

.wbp-branches-modal.wbp-show {
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes wbp-fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.wbp-branches-modal-content {
  background-color: #fff;
  padding: 0;
  border-radius: 16px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: wbp-slideUp 0.3s ease;
  display: flex;
  flex-direction: column;
}

@keyframes wbp-slideUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.wbp-modal-header {
  padding: 24px;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
  color: white;
  position: relative;
}

.wbp-modal-header h2 {
  margin: 0 0 5px 0;
  font-size: 22px;
  font-weight: 700;
}

.wbp-modal-header p {
  margin: 0;
  font-size: 14px;
  color:white;
  font-weight: 600;
}

.wbp-modal-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 24px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  line-height: 1;
  padding: 0;
}

.wbp-modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

.wbp-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.wbp-branch-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wbp-branch-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 16px;
  background: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  color: inherit;
}

.wbp-branch-item:hover {
  background: #f0fdf4;
  border-color: #25d366;
  transform: translateX(5px);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.15);
}

.wbp-branch-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wbp-branch-icon svg {
  width: 28px;
  height: 28px;
  fill: white;
}

.wbp-branch-info {
  flex: 1;
}

.wbp-branch-name {
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 4px 0;
}

.wbp-branch-description {
  font-size: 13px;
  color: #6b7280;
  margin: 0;
}

.wbp-branch-phone {
  font-size: 12px;
  color: #25d366;
  font-weight: 500;
  margin: 4px 0 0 0;
}

.wbp-branch-arrow {
  color: #9ca3af;
  font-size: 20px;
  transition: transform 0.2s ease;
}

.wbp-branch-item:hover .wbp-branch-arrow {
  transform: translateX(5px);
  color: #25d366;
}

/* Responsive para modal */
@media screen and (max-width: 768px) {
  .wbp-branches-modal-content {
    width: 95%;
    max-height: 90vh;
  }

  .wbp-modal-header {
    padding: 20px;
  }

  .wbp-modal-header h2 {
    font-size: 18px;
  }

  .wbp-modal-body {
    padding: 16px;
  }

  .wbp-branch-item {
    padding: 12px;
  }

  .wbp-branch-icon {
    width: 40px;
    height: 40px;
  }

  .wbp-branch-icon svg {
    width: 24px;
    height: 24px;
  }

  .wbp-branch-name {
    font-size: 14px;
  }

  .wbp-branch-description {
    font-size: 12px;
  }
}

/* Loading state */
.wbp-loading {
  text-align: center;
  padding: 40px 20px;
  color: #6b7280;
}

.wbp-loading-spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid #e5e7eb;
  border-top-color: #25d366;
  border-radius: 50%;
  animation: wbp-spin 1s linear infinite;
}

@keyframes wbp-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Empty state */
.wbp-empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #6b7280;
}

.wbp-empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* Agregando estilos completos para el widget de chat */

/* Widget de Chat */
.wbp-chat-widget {
  position: fixed !important;
  bottom: 90px;
  right: 20px;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 600px;
  max-height: calc(100vh - 120px);
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  display: none;
  flex-direction: column;
  z-index: 2147483647 !important; /* Máximo z-index */
  overflow: hidden;
  animation: wbp-slideUp 0.3s ease;
}

.wbp-chat-widget.wbp-show {
  display: flex;
}

/* Header del Chat */
.wbp-chat-header {
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wbp-chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.wbp-chat-avatar {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wbp-chat-avatar svg {
  width: 28px;
  height: 28px;
  fill: white;
}

.wbp-chat-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.wbp-chat-status {
  margin: 4px 0 0 0;
  font-size: 12px;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 6px;
}

.wbp-status-dot {
  width: 8px;
  height: 8px;
  background: #4ade80;
  border-radius: 50%;
  animation: wbp-pulse-dot 2s infinite;
}

@keyframes wbp-pulse-dot {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.wbp-chat-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
}

.wbp-chat-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.wbp-chat-close svg {
  width: 20px;
  height: 20px;
}

/* Mensajes del Chat */
.wbp-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f0f2f5;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wbp-chat-message {
  display: flex;
  gap: 8px;
  animation: wbp-messageIn 0.3s ease;
}

@keyframes wbp-messageIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.wbp-chat-message.wbp-user {
  flex-direction: row-reverse;
}

.wbp-message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #25d366;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wbp-message-avatar svg {
  width: 18px;
  height: 18px;
  fill: white;
}

.wbp-user .wbp-message-avatar {
  background: #0084ff;
}

.wbp-message-bubble {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 12px;
  background: white;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.wbp-user .wbp-message-bubble {
  background: #0084ff;
  color: white;
}

.wbp-message-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.wbp-message-time {
  font-size: 11px;
  color: #65676b;
  margin-top: 4px;
  display: block;
}

.wbp-user .wbp-message-time {
  color: rgba(255, 255, 255, 0.8);
}

/* Typing Indicator */
.wbp-typing-indicator {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
}

.wbp-typing-dot {
  width: 8px;
  height: 8px;
  background: #90949c;
  border-radius: 50%;
  animation: wbp-typing 1.4s infinite;
}

.wbp-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.wbp-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes wbp-typing {
  0%,
  60%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-10px);
  }
}

/* Botones de acción en mensajes */
.wbp-message-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.wbp-action-button {
  padding: 8px 16px;
  background: #25d366;
  color: white;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.wbp-action-button:hover {
  background: #128c7e;
  transform: translateY(-1px);
}

.wbp-action-button.wbp-secondary {
  background: #e4e6eb;
  color: #050505;
}

.wbp-action-button.wbp-secondary:hover {
  background: #d8dadf;
}

/* Input del Chat */
.wbp-chat-input-container {
  border-top: 1px solid #e4e6eb;
  background: white;
}

.wbp-quick-replies {
  padding: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border-bottom: 1px solid #e4e6eb;
}

.wbp-quick-reply {
  padding: 6px 12px;
  background: #f0f2f5;
  border: 1px solid #e4e6eb;
  border-radius: 16px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.wbp-quick-reply:hover {
  background: #e4e6eb;
  border-color: #25d366;
}

.wbp-chat-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
}

.wbp-chat-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  padding: 10px 14px;
  background: #f0f2f5;
  border-radius: 20px;
  font-family: inherit;
}

.wbp-chat-input:focus {
  background: #e4e6eb;
}

.wbp-chat-send {
  width: 36px;
  height: 36px;
  background: #25d366;
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
}

.wbp-chat-send:hover {
  background: #128c7e;
  transform: scale(1.1);
}

.wbp-chat-send:disabled {
  background: #e4e6eb;
  cursor: not-allowed;
  transform: scale(1);
}

.wbp-chat-send svg {
  width: 20px;
  height: 20px;
}

/* Badge de notificación */
.wbp-notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ff3b30;
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* Responsive para chat */
@media screen and (max-width: 768px) {
  .wbp-chat-widget {
    bottom: 80px;
    right: 10px;
    left: 10px;
    width: auto;
    max-width: none;
    height: 500px;
  }

  .wbp-message-bubble {
    max-width: 80%;
  }
}

/* Agregando estilos faltantes para opciones de chat y sucursales en chat */

/* Opciones de chat */
.wbp-chat-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  animation: wbp-messageIn 0.3s ease;
}

.wbp-option-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.wbp-option-primary {
  background: #25d366;
  color: white;
}

.wbp-option-primary:hover {
  background: #128c7e;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.wbp-option-primary svg {
  width: 18px;
  height: 18px;
}

.wbp-option-secondary {
  background: #f0f2f5;
  color: #050505;
}

.wbp-option-secondary:hover {
  background: #e4e6eb;
}

/* Sucursales en el chat */
.wbp-chat-branches {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  animation: wbp-messageIn 0.3s ease;
}

.wbp-chat-branch-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: white;
  border: 2px solid #e4e6eb;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
}

.wbp-chat-branch-item:hover {
  background: #f0fdf4;
  border-color: #25d366;
  transform: translateX(4px);
}

.wbp-chat-branch-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wbp-chat-branch-icon svg {
  width: 22px;
  height: 22px;
  fill: white;
}

.wbp-chat-branch-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wbp-chat-branch-info strong {
  font-size: 14px;
  color: #1f2937;
}

.wbp-chat-branch-info span {
  font-size: 12px;
  color: #6b7280;
}

.wbp-chat-branch-arrow {
  width: 20px;
  height: 20px;
  color: #9ca3af;
  transition: transform 0.2s ease;
}

.wbp-chat-branch-item:hover .wbp-chat-branch-arrow {
  transform: translateX(4px);
  color: #25d366;
}

/* Ajustes para mensajes del bot con contenido */
.wbp-message-bot .wbp-message-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wbp-message-user .wbp-message-content {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

/* Responsive adicional para chat */
@media screen and (max-width: 768px) {
  .wbp-chat-branch-item {
    padding: 10px;
  }

  .wbp-chat-branch-icon {
    width: 36px;
    height: 36px;
  }

  .wbp-chat-branch-icon svg {
    width: 20px;
    height: 20px;
  }

  .wbp-option-btn {
    padding: 10px 16px;
    font-size: 13px;
  }
}
