/**
 * 2026 Cristian Panayotti - Free Shipping Bar Styles
 */

.fsb-wrapper {
  background-color: var(--fsb-bg-color, #f8f1ea);
  color: var(--fsb-text-color, #0c3866);
  width: 100%;
  padding: 8px 16px;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  transition: background-color 0.3s ease;
  position: relative;
  z-index: 100;
}

/* Copia flotante fuera del header para evitar recortes del tema. */
.fsb-wrapper.fsb-floating-copy {
  display: none !important;
  position: fixed !important;
  top: var(--fsb-floating-top, 0px) !important;
  right: 0 !important;
  left: 0 !important;
  /* Bajo los modales/off-canvas del tema, pero sobre el contenido normal. */
  z-index: 900 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12) !important;
  transition: top 0.15s ease-out;
}

.fsb-wrapper.fsb-floating-copy.fsb-visible {
  display: block !important;
}

.fsb-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px 24px;
}

/* Sección izquierda: Icono, Enlace y Texto */
.fsb-content-left {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.fsb-icon-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  color: var(--fsb-text-color, #0c3866);
  transition: transform 0.2s ease;
}

.fsb-wrapper:hover .fsb-icon-tag {
  transform: rotate(-10deg) scale(1.1);
}

.fsb-link {
  color: var(--fsb-text-color, #0c3866);
  text-decoration: none;
  font-weight: 700;
  transition: opacity 0.2s ease;
}

.fsb-link:hover {
  text-decoration: underline;
  opacity: 0.85;
}

.fsb-link-static {
  cursor: default;
}

.fsb-separator {
  margin: 0 8px;
  opacity: 0.6;
  font-weight: 400;
}

.fsb-message {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.fsb-message.fsb-updating {
  opacity: 0.2;
  transform: translateY(-2px);
}

/* Sección derecha: Barra de progreso y Camión */
.fsb-progress-container {
  display: inline-flex;
  align-items: center;
  min-width: 180px;
  max-width: 260px;
  flex: 1 1 200px;
}

.fsb-progress-track {
  position: relative;
  width: 100%;
  height: 14px;
  background-color: #ffffff;
  border: 1.5px solid #333333;
  border-radius: 20px;
  overflow: visible; /* Permite que el camión sobresalga elegante */
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.08);
}

.fsb-progress-fill {
  height: 100%;
  width: 0%;
  background-color: var(--fsb-progress-color, #a6cfbb);
  border-radius: 20px;
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Camioncito animado */
.fsb-truck-indicator {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  color: var(--fsb-truck-color, #111111);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: left 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 2;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.25));
  pointer-events: none;
}

.fsb-truck-svg {
  width: 28px;
  height: 21px;
  display: block;
  transition: transform 0.25s ease;
}

/* Animación sutil de marcha cuando el camión se desplaza */
.fsb-truck-moving .fsb-truck-svg {
  animation: fsb-truck-bounce 0.3s infinite alternate ease-in-out;
}

@keyframes fsb-truck-bounce {
  0% {
    transform: translateY(0) rotate(0deg);
  }
  100% {
    transform: translateY(-2px) rotate(-2deg);
  }
}

/* Estado 100% Envío Gratis alcanzado */
.fsb-wrapper.fsb-reached .fsb-progress-fill {
  background-color: #48bb78;
  width: 100% !important;
}

.fsb-wrapper.fsb-reached .fsb-truck-indicator {
  left: 100% !important;
  transform: translate(-80%, -50%);
  color: var(--fsb-truck-color, #111111);
}

.fsb-wrapper.fsb-reached .fsb-message {
  font-weight: 700;
  color: #22543d;
}

/* Estilo específico cuando se coloca dentro de la página del carrito */
.fsb-wrapper.fsb-in-cart {
  margin: 15px 0 20px 0;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.1);
  box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}

/* Responsividad para móviles */
@media (max-width: 767px) {
  .fsb-wrapper {
    font-size: 12px;
    padding: 6px 10px;
  }
  
  .fsb-container {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 6px;
    text-align: center;
  }

  .fsb-content-left {
    width: 100%;
    justify-content: center;
    line-height: 1.3;
  }

  .fsb-progress-container {
    flex: 0 0 auto;
    min-width: 0;
    width: 90%;
    max-width: 280px;
  }

  .fsb-progress-track {
    height: 12px;
  }

  .fsb-truck-svg {
    width: 24px;
    height: 18px;
  }
}

@media print {
  .fsb-wrapper.fsb-floating-copy {
    display: none !important;
  }
}
