/* ===== CATEGORÍAS VISUALES - AHORA COMO CARRUSEL ===== */
.categorias-visuales-section {
  margin: 1.5rem auto;
  padding: 1.5rem;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s ease;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 15px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
  max-width: calc(100% - 2rem);
  width: 100%;
}

.categorias-visuales-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #e74c3c, #f39c12);
  background-size: 300% 100%;
  animation: gradient-shift 3s ease infinite;
}

.categorias-visuales-section.visible {
  opacity: 1;
  transform: translateY(0);
}

.titulo-categorias-visuales {
  font-size: 1.8rem;
  color: #2c3e50;
  text-align: center;
  margin-bottom: 2rem;
  font-weight: 700;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

/* Contenedor del carrusel */
.categorias-visuales-container {
  position: relative;
  width: 100%;
  padding: 0 1rem;
}

/* Grid convertido a carrusel */
.categorias-visuales-scroll {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  padding: 0.5rem 1rem;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-padding: 0 1rem;
}

.categorias-visuales-scroll::-webkit-scrollbar {
  display: none;
}

/* Tarjetas de categorías (ahora en carrusel) */
.categoria-visual-card {
  flex: 0 0 200px; /* Ancho fijo para el carrusel */
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  border-radius: 15px;
  padding: 2rem 1.5rem;
  text-align: center;
  border: 2px solid #38a169;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px);
  animation: slideInUp 0.6s ease forwards;
  animation-delay: calc(var(--delay, 0) * 0.15s);
}

/* Resto de estilos de las tarjetas (igual que antes) */
.categoria-visual-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #e74c3c, #f39c12);
  background-size: 300% 100%;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s ease;
  animation: gradient-shift 3s ease infinite;
}

.categoria-visual-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, transparent, rgba(231, 76, 60, 0.05));
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.categoria-visual-card:hover::before {
  transform: scaleX(1);
}

.categoria-visual-card:hover::after {
  opacity: 1;
}

.categoria-visual-card:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 15px 40px rgba(0,0,0,0.15);
  background: linear-gradient(135deg, #f1f3f5, #dee2e6);
}

.categoria-visual-card:active {
  transform: translateY(-8px) scale(0.98);
}

.categoria-icono {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
  transition: transform 0.3s ease;
  text-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.categoria-visual-card:hover .categoria-icono {
  transform: scale(1.2) rotate(5deg);
}

.categoria-nombre {
  font-size: 1.1rem;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 0.8rem;
  text-transform: capitalize;
  letter-spacing: 0.5px;
}

.categoria-contador {
  font-size: 0.9rem;
  color: #7f8c8d;
  opacity: 0.8;
  font-weight: 500;
  background: rgba(231, 76, 60, 0.1);
  padding: 0.3rem 0.8rem;
  border-radius: 15px;
  border: 1px solid rgba(231, 76, 60, 0.2);
  display: inline-block;
  transition: all 0.3s ease;
}

.categoria-visual-card:hover .categoria-contador {
  background: rgba(231, 76, 60, 0.2);
  color: #e74c3c;
  border-color: rgba(231, 76, 60, 0.4);
  transform: scale(1.05);
}

/* Botones de scroll */
.scroll-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  background: rgba(231, 76, 60, 0.9);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scroll-btn:hover {
  background: #c0392b;
  transform: translateY(-50%) scale(1.1);
}

.scroll-btn-left {
  left: 0;
}

.scroll-btn-right {
  right: 0;
}

/* Animaciones */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes gradient-shift {
  0%, 100% { background-position: 0% 0%; }
  50% { background-position: 100% 0%; }
}

/* Responsive */
@media (max-width: 1024px) {
  .categoria-visual-card {
    flex: 0 0 180px;
    padding: 1.8rem 1.2rem;
  }
  
  .categoria-icono {
    font-size: 2.8rem;
  }
}

@media (max-width: 768px) {
  .categorias-visuales-section {
    margin: 1rem auto;
    padding: 1rem;
    max-width: calc(100% - 1rem);
  }
  
  .titulo-categorias-visuales {
    font-size: 1.6rem;
    margin-bottom: 1.5rem;
  }
  
  .categoria-visual-card {
    flex: 0 0 160px;
    padding: 1.5rem 1rem;
  }
  
  .categoria-icono {
    font-size: 2.5rem;
    margin-bottom: 0.8rem;
  }
  
  .categoria-nombre {
    font-size: 1rem;
    margin-bottom: 0.6rem;
  }
  
  .categoria-contador {
    font-size: 0.85rem;
    padding: 0.25rem 0.6rem;
  }
}

@media (max-width: 640px) {
  .categoria-visual-card {
    flex: 0 0 140px;
    padding: 1.2rem 0.8rem;
  }
  
  .categoria-icono {
    font-size: 2.2rem;
  }
  
  .categoria-nombre {
    font-size: 0.95rem;
  }
}

@media (max-width: 480px) {
  .titulo-categorias-visuales {
    font-size: 1.4rem;
    flex-direction: column;
    gap: 0.3rem;
  }
  
  .categoria-visual-card {
    flex: 0 0 120px;
    padding: 1rem 0.6rem;
  }
  
  .categoria-icono {
    font-size: 2rem;
    margin-bottom: 0.6rem;
  }
  
  .categoria-nombre {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
  }
  
  .categoria-contador {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
  }
  
  .scroll-btn {
    display: none; /* Ocultar flechas en móviles muy pequeños */
  }
}

/* ===== PRODUCTOS MÁS VENDIDOS - ESTILO SIMILAR A RECOMENDADOS ===== */
.productos-mas-vendidos-section {
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.95);
  margin: 1.5rem auto; /* Cambiado de 2rem a 1.5rem para igualar recomendados */
  border-radius: 15px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s ease;
  position: relative;
  overflow: hidden;
  max-width: calc(100% - 2rem); /* Igual que recomendados */
  width: 100%;
}

.productos-mas-vendidos-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #e74c3c, #f39c12);
  background-size: 300% 100%;
  animation: gradient-shift 3s ease infinite;
}

.productos-mas-vendidos-section.visible {
  opacity: 1;
  transform: translateY(0);
}

.productos-mas-vendidos-header {
  text-align: center;
  margin-bottom: 2rem;
}

.titulo-productos-mas-vendidos {
  font-size: 1.8rem;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.productos-icon {
  font-size: 2.2rem;
  animation: pulse 2s infinite;
}

.subtitulo-productos {
  color: #7f8c8d;
  font-size: 1.1rem;
  font-weight: 400;
  opacity: 0.8;
}

.scroll-productos-container {
  position: relative;
  overflow: hidden;
}

.scroll-productos {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding: 0.5rem 1rem;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-padding: 0 1rem;
}

.scroll-productos::-webkit-scrollbar {
  display: none;
}

.producto-mas-vendido-card {
  flex: 0 0 280px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  border: 2px solid #22c55e;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer;
  position: relative;
  overflow: visible;
  opacity: 0;
  transform: translateY(20px);
  animation: slideInUp 0.6s ease forwards;
  animation-delay: calc(var(--delay, 0) * 0.15s);
}

.producto-mas-vendido-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #e74c3c, #f39c12);
  background-size: 300% 100%;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s ease;
  border-radius: 12px 12px 0 0;
}

.producto-mas-vendido-card:hover::before {
  transform: scaleX(1);
}

.producto-mas-vendido-card:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12);
  border-color: #16a34a;
}

/* ===== RANKING CON MEDALLAS ===== */
.producto-ranking {
  position: absolute;
  top: -15px;
  left: 15px;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1rem;
  color: white;
  z-index: 100;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  border: 3px solid rgba(255, 255, 255, 0.2);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Medalla de Oro - Posición 1 */
.producto-ranking.posicion-1 {
  background: radial-gradient(circle, #ffd700 0%, #ffb347 50%, #ff8c00 100%);
  box-shadow: 
    0 0 20px rgba(255, 215, 0, 0.8),
    0 6px 20px rgba(0, 0, 0, 0.4);
  animation: goldShine 2s ease-in-out infinite;
}

.producto-ranking.posicion-1::before {
  content: '🥇';
  font-size: 1.5rem;
  line-height: 1;
}

/* Medalla de Plata - Posición 2 */
.producto-ranking.posicion-2 {
  background: radial-gradient(circle, #c0c0c0 0%, #a8a8a8 50%, #808080 100%);
  box-shadow: 
    0 0 15px rgba(192, 192, 192, 0.6),
    0 6px 20px rgba(0, 0, 0, 0.4);
  animation: silverShine 2.5s ease-in-out infinite;
}

.producto-ranking.posicion-2::before {
  content: '🥈';
  font-size: 1.5rem;
  line-height: 1;
}

/* Medalla de Bronce - Posición 3 */
.producto-ranking.posicion-3 {
  background: radial-gradient(circle, #cd7f32 0%, #b8860b 50%, #8b4513 100%);
  box-shadow: 
    0 0 15px rgba(205, 127, 50, 0.6),
    0 6px 20px rgba(0, 0, 0, 0.4);
  animation: bronzeShine 3s ease-in-out infinite;
}

.producto-ranking.posicion-3::before {
  content: '🥉';
  font-size: 1.5rem;
  line-height: 1;
}

/* Posiciones 4+ */
.producto-ranking:not(.posicion-1):not(.posicion-2):not(.posicion-3) {
  background: linear-gradient(135deg, #e74c3c, #f39c12);
  animation: normalRankShine 2s ease infinite;
}

/* Contenido del producto */
.producto-imagen-container {
  position: relative;
  width: 100%;
  height: 150px;
  margin-bottom: 1rem;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid #e9ecef;
}

.producto-mas-vendido-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.producto-mas-vendido-card:hover .producto-mas-vendido-img {
  transform: scale(1.05);
}

.ventas-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  backdrop-filter: blur(5px);
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.producto-mas-vendido-info {
  text-align: center;
}

.producto-mas-vendido-nombre {
  font-size: 1.1rem;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 0.5rem;
  line-height: 1.3;
  height: 2.6rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.producto-restaurante-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
  padding: 0.5rem;
  background: rgba(231, 76, 60, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(231, 76, 60, 0.2);
  transition: all 0.3s ease;
}

.producto-mas-vendido-card:hover .producto-restaurante-info {
  background: rgba(231, 76, 60, 0.15);
  border-color: rgba(231, 76, 60, 0.3);
}

.restaurante-logo-small {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #e9ecef;
}

.restaurante-nombre-small {
  font-size: 0.85rem;
  color: #7f8c8d;
  font-weight: 500;
}

.producto-mas-vendido-precio {
  font-size: 1.3rem;
  font-weight: 700;
  color: #e74c3c;
  margin-bottom: 1rem;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.btn-agregar-producto-popular {
  width: 100%;
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
  border: none;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.btn-agregar-producto-popular:hover {
  background: linear-gradient(135deg, #c0392b, #a93226);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(231, 76, 60, 0.4);
}

.btn-agregar-producto-popular:active {
  transform: translateY(0);
}

/* Botones de scroll */
.scroll-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  background: rgba(231, 76, 60, 0.9);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scroll-btn:hover {
  background: #c0392b;
  transform: translateY(-50%) scale(1.1);
}

/* Loading States */
.productos-loading {
  text-align: center;
  padding: 3rem;
  color: #7f8c8d;
}

.productos-loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e9ecef;
  border-top: 4px solid #e74c3c;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

.productos-empty {
  text-align: center;
  padding: 3rem;
  color: #7f8c8d;
}

.productos-empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Loading al hacer click en botón */
.btn-agregar-producto-popular.loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.btn-agregar-producto-popular.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Animaciones para las medallas */
@keyframes goldShine {
  0%, 100% { 
    box-shadow: 
      0 0 20px rgba(255, 215, 0, 0.8),
      0 6px 20px rgba(0, 0, 0, 0.4);
    transform: scale(1);
  }
  50% { 
    box-shadow: 
      0 0 30px rgba(255, 215, 0, 1),
      0 8px 25px rgba(0, 0, 0, 0.5);
    transform: scale(1.05);
  }
}

@keyframes silverShine {
  0%, 100% { 
    box-shadow: 
      0 0 15px rgba(192, 192, 192, 0.6),
      0 6px 20px rgba(0, 0, 0, 0.4);
    transform: scale(1);
  }
  50% { 
    box-shadow: 
      0 0 25px rgba(192, 192, 192, 0.9),
      0 8px 25px rgba(0, 0, 0, 0.5);
    transform: scale(1.03);
  }
}

@keyframes bronzeShine {
  0%, 100% { 
    box-shadow: 
      0 0 15px rgba(205, 127, 50, 0.6),
      0 6px 20px rgba(0, 0, 0, 0.4);
    transform: scale(1);
  }
  50% { 
    box-shadow: 
      0 0 25px rgba(205, 127, 50, 0.8),
      0 8px 25px rgba(0, 0, 0, 0.5);
    transform: scale(1.03);
  }
}

@keyframes normalRankShine {
  0%, 100% { 
    background-position: 0% 0%;
  }
  50% { 
    background-position: 100% 0%;
  }
}

/* Animación del gradiente */
@keyframes gradient-shift {
  0%, 100% { background-position: 0% 0%; }
  50% { background-position: 100% 0%; }
}

/* Animación de entrada escalonada */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Responsive */
@media (max-width: 1024px) {

  
  .producto-mas-vendido-card {
    min-width: 250px;
  }
}

@media (max-width: 768px) {  
  .productos-mas-vendidos-section {
    margin: 1rem auto; /* Igualado a recomendados en móvil */
    padding: 1.5rem 0.5rem;
    max-width: calc(100% - 1rem); /* Igualado a recomendados en móvil */
  }
  
  .titulo-productos-mas-vendidos {
    font-size: 1.6rem;
  }
  
  .producto-mas-vendido-card {
    min-width: 250px;
  }
  
  .scroll-productos {
    gap: 1rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  .producto-ranking {
    width: 40px;
    height: 40px;
    font-size: 0.9rem;
    top: -12px;
    left: 12px;
  }
}



@media (max-width: 480px) {

  
  .producto-mas-vendido-card {
    min-width: 220px;
    padding: 1.2rem;
  }
  
  .producto-ranking {
    width: 35px;
    height: 35px;
    font-size: 0.8rem;
    top: -10px;
    left: 10px;
  }
}

/* Efecto especial para hover en dispositivos táctiles */
@media (hover: none) and (pointer: coarse) {

  
  .producto-mas-vendido-card:active {
    transform: scale(0.95);
  }
  
  .producto-mas-vendido-card:active::before {
    transform: scaleX(1);
  }
}

/* Animaciones adicionales */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}
/* Desktop optimizations */
@media (min-width: 1200px) {
  .categorias-visuales-section,
  .productos-mas-vendidos-section {
    max-width: 1200px;
    margin: 1.5rem auto;
    padding: 1.2rem;
  }
  
  .titulo-categorias-visuales,
  .titulo-productos-mas-vendidos {
    font-size: 1.4rem;
  }
  
  .categoria-visual-card {
    flex: 0 0 160px;
    padding: 1.2rem 1rem;
  }
  
  .categoria-icono {
    font-size: 2.2rem;
  }
  
  .categoria-nombre {
    font-size: 0.95rem;
  }
  
  .categoria-contador {
    font-size: 0.8rem;
  }
  
  .producto-mas-vendido-card {
    flex: 0 0 240px;
    padding: 1.2rem;
  }
  
  .producto-imagen-container {
    height: 130px;
  }
  
  .producto-mas-vendido-nombre {
    font-size: 1rem;
  }
  
  .producto-mas-vendido-precio {
    font-size: 1.1rem;
  }
}

@media (min-width: 1440px) {
  .categorias-visuales-section,
  .productos-mas-vendidos-section {
    max-width: 1400px;
  }
  
  .categoria-visual-card {
    flex: 0 0 140px;
  }
  
  .producto-mas-vendido-card {
    flex: 0 0 220px;
  }
  
  .titulo-categorias-visuales,
  .titulo-productos-mas-vendidos {
    font-size: 1.3rem;
  }
}