/* ========== BUQUENQUE - SISTEMA DINÁMICO DE FRESCURA VISUAL ========== */

/* ========== ANIMACIONES SUTILES ========== */

/* Fade-in suave para nuevos productos */
@keyframes fadeInSoft {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Borde ligero que parpadea para nuevos productos - EXTRA SUTIL y moderno */
@keyframes newProductPulse {
  0% {
    box-shadow:
      inset 0 0 0 0.5px rgba(255, 182, 182, 0.15),
      0 2px 8px rgba(0, 0, 0, 0.04);
  }
  50% {
    box-shadow:
      inset 0 0 0 0.5px rgba(255, 182, 182, 0.4),
      0 3px 10px rgba(255, 182, 182, 0.06);
  }
  100% {
    box-shadow:
      inset 0 0 0 0.5px rgba(255, 182, 182, 0.15),
      0 2px 8px rgba(0, 0, 0, 0.04);
  }
}

/* Brillo sutil para elementos dinámicos */
@keyframes subtleGlimmer {
  0% {
    text-shadow: 0 0 0 transparent;
  }
  50% {
    text-shadow: 0 0 8px rgba(255, 182, 182, 0.3);
  }
  100% {
    text-shadow: 0 0 0 transparent;
  }
}

/* Escala suave (sin ser invasivo) */
@keyframes scaleInLight {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ========== CLASES DE ANIMACIÓN REUTILIZABLES ========== */

.animate-fade-in {
  animation: fadeInSoft 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-fade-in-left {
  animation: fadeInLeft 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-fade-in-right {
  animation: fadeInRight 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-scale-in {
  animation: scaleInLight 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ========== SECCIÓN "RECIÉN AÑADIDOS" - ELEGANTE Y MODERNA ========== */

.recent-products-section {
  margin: 0 1.5rem 2.5rem 1.5rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
  border-radius: var(--borde-radius);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  animation: fadeInSoft 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

/* Efecto gradiente sutil al fondo - MÁS ELEGANTE */
.recent-products-section::before {
  content: "";
  position: absolute;
  top: -30%;
  right: -30%;
  width: 350px;
  height: 350px;
  background: radial-gradient(
    circle,
    rgba(255, 182, 182, 0.02) 0%,
    transparent 75%
  );
  border-radius: 50%;
  pointer-events: none;
}

.recent-products-header {
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  position: relative;
  z-index: 1;
}

.recent-products-title-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.recent-products-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--negro);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: -0.4px;
}

.recent-products-title i {
  color: #f3a847;
  animation: subtleGlimmer 4s ease-in-out infinite;
  font-size: 1.1rem;
}

.recent-products-subtitle {
  font-size: 0.8rem;
  color: var(--gris-medio);
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* Grid responsive para productos recientes - MÁS REFINADO */
.recent-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.9rem;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.recent-product-card {
  background: var(--blanco);
  border: 1px solid #e8e8e8;
  border-radius: var(--borde-radius);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: flex;
  flex-direction: column;
  height: 100%;
  animation: fadeInSoft 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
  box-shadow: var(--sombra);
  position: relative;
}

.recent-product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-color: rgba(255, 182, 182, 0.4);
}

/* Indicador visual de reciente - línea superior EXTRA SUTIL */
.recent-product-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 0.5px;
  background: linear-gradient(
    90deg,
    rgba(255, 182, 182, 0.4) 0%,
    rgba(212, 168, 232, 0.3) 100%
  );
  opacity: 0.6;
  z-index: 3;
}

.recent-product-image {
  position: relative;
  width: 100%;
  height: 110px;
  overflow: hidden;
  background: linear-gradient(to bottom, #f9f9f9, #fff);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.recent-product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.recent-product-card:hover .recent-product-image img {
  transform: scale(1.08);
}

.recent-product-badge-sale {
  position: absolute;
  top: 6px;
  right: 6px;
  background: linear-gradient(
    135deg,
    rgba(255, 107, 107, 0.7) 0%,
    rgba(220, 50, 50, 0.7) 100%
  );
  color: var(--blanco);
  font-size: 0.55rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  text-transform: uppercase;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  z-index: 2;
  letter-spacing: 0.2px;
}

.recent-product-info {
  padding: 0.75rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--blanco);
}

.recent-product-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--negro);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-bottom: 0.35rem;
}

.recent-product-price {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--precio);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: auto;
}

.currency-icon.price-xs {
  width: 12px;
  height: 12px;
}

/* ========== BADGES DINÁMICOS - SÚPER SUTILES E INTEGRADOS ========== */

/* Badge temporales - MÁS SUTILES */
.badge-new-today {
  background: linear-gradient(
    135deg,
    rgba(255, 182, 182, 0.75) 0%,
    rgba(218, 142, 136, 0.75) 100%
  ) !important;
  color: #ffffff !important;
  border: 0.5px solid rgba(255, 150, 150, 0.3) !important;
  animation: fadeInSoft 0.4s ease-out !important;
  font-size: 8px !important;
  padding: 1px 5px !important;
  letter-spacing: 0.2px !important;
  font-weight: 600 !important;
}

.badge-new-week {
  display: flex;
  align-items: center;
  gap: 0.3rem;;
  background: var(--botonA) !important;
  color: var(--negro) !important;
  border: 0.5px solid rgba(150, 190, 205, 0.2) !important;
  animation: fadeInSoft 0.4s ease-out !important;
  font-size: 10px !important;
  padding: 1px 5px !important;
  letter-spacing: 0.2px !important;
  font-weight: 600 !important;
}

.badge-updated {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: #ff126d9a !important;
  color: #ffffff !important;
  border: 0.5px solid rgba(200, 168, 232, 0.2) !important;
  animation: fadeInSoft 0.4s ease-out !important;
  font-size: 8px !important;
  padding: 1px 5px !important;
  letter-spacing: 0.2px !important;
  font-weight: 600 !important;
}

/* ========== PRODUCTO CON ANIMACIÓN DE BORDE (NUEVO) ========== */

.new-product-pulse {
  animation: newProductPulse 1s ease-in-out;
}

/* ========== VARIACIONES DE LAYOUT SEGÚN EL DÍA ========== */

/* Layout normal (default) */
.products-grid.layout-normal {
  gap: 1.5rem;
}

/* Layout compact (Jueves-Viernes): gap más pequeño */
.products-grid.layout-compact {
  gap: 1rem;
}

/* Layout spread (Fin de semana): gap más grande */
.products-grid.layout-spread {
  gap: 2rem;
}

/* ========== MICRO-ANIMACIÓN EN PRODUCT CARDS (RECIENTES) ========== */

.product-card.is-recent {
  animation: fadeInSoft 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Pequeño brillo al pasar mouse en cards recientes */
.product-card.is-recent::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.product-card.is-recent:hover::before {
  opacity: 1;
  animation: shine 0.6s ease-in-out;
}

@keyframes shine {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* ========== TRANSICIONES SUTILES DE FADE PARA CATEGORÍAS ========== */

.category-panel {
  animation: fadeInSoft 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.category-header {
  animation: fadeInLeft 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.1s both;
}

.category-products-grid {
  animation: fadeInSoft 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.2s both;
}

/* ========== RESPONSIVE: RECIENTES EN MOBILE - OPTIMIZADO ========== */

@media (max-width: 1024px) {
  .recent-products-section {
    margin: 0 1rem 2rem 1rem;
  }

  .recent-products-grid {
    grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
    gap: 0.85rem;
  }

  .recent-product-image {
    height: 105px;
  }
}

@media (max-width: 768px) {
  .recent-products-section {
    margin: 0 1rem 2rem 1rem;
    padding: 1.2rem;
  }

  .recent-products-title {
    font-size: 1.05rem;
    gap: 0.4rem;
  }

  .recent-products-subtitle {
    font-size: 0.75rem;
  }

  .recent-products-grid {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.8rem;
  }

  .recent-product-image {
    height: 95px;
  }

  .recent-product-info {
    padding: 0.6rem;
  }

  .recent-product-title {
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
  }

  .recent-product-price {
    font-size: 0.85rem;
  }

  .recent-product-badge-sale {
    top: 5px;
    right: 5px;
    font-size: 0.5rem;
    padding: 0.5px 3px;
  }
}

@media (max-width: 480px) {
  .recent-products-section {
    margin: 0 0.75rem 0.5rem 0.75rem;
    padding: 0.9rem;
  }

  .recent-products-title {
    font-size: 0.95rem;
    gap: 0.3rem;
  }

  .recent-products-toolbar {
    gap: 0.5rem;
  }

  .recent-products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
  }

  .recent-product-image {
    height: 80px;
  }

  .recent-product-info {
    padding: 0.5rem;
  }

  .recent-product-title {
    font-size: 0.7rem;
    -webkit-line-clamp: 1;
    line-clamp: 1;
  }

  .recent-product-price {
    font-size: 0.8rem;
  }

  .recent-product-badge-sale {
    font-size: 0.48rem;
    padding: 0.5px 3px;
  }
}

/* ========== TRANSICIÓN SUAVE AL CAMBIAR DE CATEGORÍA ========== */

.products-grid {
  transition: gap 0.3s ease;
}

/* ========== MEJORAS EN PRODUCT-CARDS PARA DINÁMICO ========== */

.product-card {
  perspective: 1000px;
}

/* Suave hover en cards nuevas */
.product-card.new-product {
  position: relative;
}

.product-card.new-product::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: var(--borde-radius);
  background: linear-gradient(
    45deg,
    transparent,
    rgba(255, 182, 182, 0.1),
    transparent
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.product-card.new-product:hover::after {
  opacity: 1;
}

/* ========== ANIMACIÓN DE ENTRADA PARA BADGES ========== */

.product-badges {
  animation: fadeInSoft 0.4s cubic-bezier(0.4, 0, 0.2, 1) 0.1s both;
}

.badge {
  animation: scaleInLight 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ========== PULSO ATRACCIÓN PARA SECCIONES DINÁMICAS ========== */

@keyframes sectionSlideIn {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.recent-products-section {
  animation: sectionSlideIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== ANIMACIÓN AL DESCARTAR CATEGORÍAS (SUAVE FADE OUT) ========== */

@keyframes fadeOutSoft {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(8px);
  }
}

.products-grid.hiding {
  animation: fadeOutSoft 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ========== ESTILOS REFINADOS PARA NOTIFICACIONES TEMPORALES (POD) ========== */

/* Toast/Notificación de cambio dinámico (simplemente cambia, sin popup) */
.dynamic-change-indicator {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--blanco);
  border: 1px solid #e8e8e8;
  border-left: 4px solid var(--rojo-oferta);
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--negro);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  animation: slideInUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dynamic-change-indicator.hide {
  animation: slideOutDown 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideOutDown {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(20px);
  }
}

/* ========== REFINAMIENTO DE COLORES Y TRANSICIONES ========== */

/* Asegurar que badges nuevos sean sutiles pero visibles */
.recent-products-section .product-card {
  border-color: rgba(212, 175, 55, 0.1);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.recent-products-section .product-card:hover {
  border-color: var(--color-principal-pastel);
  box-shadow: 0 8px 20px rgba(255, 182, 182, 0.15);
}

/* ========== CONSISTENCIA CON DISEÑO EXISTENTE ========== */

/* Mantener coherencia con variables del proyecto */
.recent-products-section {
  background: var(--blanco);
  border: 1px solid #e8e8e8;
}

.recent-product-card {
  background: var(--blanco);
  border: 1px solid #e8e8e8;
}

.recent-product-card:hover {
  box-shadow: var(--sombra-hover);
  border-color: var(--color-principal-pastel);
}
