/* Comparacion de productos*/

.comparativa {
  padding: 40px;
  background-color: #ab556a;
  text-align: center;
}

.comparativa table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  margin-bottom: 20px;
}

.comparativa th,
.comparativa td {
  padding: 10px;
  border: 1px solid #424B5D;
  text-align: center;
}

.comparativa th {
  background-color: #030f27;
  color: #ffffff;
}

.comparativa td {
  background-color: #424B5D;
  color: #ffffff;
}

.comparativa tbody tr:hover {
  border: #ffffff 1.5px solid;
  transition: background-color 0.3s ease;
}

.comparativa tbody td:hover {
  color: #ab556a;
  transition: background-color 0.3s ease;
}



/*-----------------------------------------------------------------*/





/* Creacion de producto */

.crearProducto {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 74vh;
  background-color: #ab556a;
  padding: 2rem;
}

#crearProducto {
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0px 4px 8px rgba(0,0,0,0.2);
  width: 80%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
}

#crearProducto h1 {
  text-align: center;
}

.form-layout {
  display: flex;
  gap: 2rem;
}


#preview-img-producto {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #ccc;
}




/*-----------------------------------------------------------------*/



/* Editar Producto */

.editar {
  display: grid;
  gap: 12px;
}

.editar-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 25px;
  margin-top: 10px;
}

.editar-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.editar-imagenes {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-content.editar {
  background: white;
  padding: 25px;
  border-radius: 10px;
  max-width: 650px;
  width: 100%;
}

.editar h2 {
  margin-bottom: 10px;
  color: #222;
}

.editar label {
  font-weight: 600;
  color: #444;
  margin-bottom: 3px;
}

.editar input,
.editar textarea,
.editar select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  transition: border 0.15s ease, box-shadow 0.15s ease;
}

.editar input:focus,
.editar textarea:focus,
.editar select:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0,123,255,0.15);
}

.editar textarea {
  resize: vertical;
  min-height: 90px;
}

.editar select {
  cursor: pointer;
}

.modal-actions {
  display: flex;
  justify-content: flex-start;
  gap: 10px;
}

#drop-zone {
  border: 2px dashed #c7c7c7;
  background: #f7f7f7;
  padding: 35px;
  text-align: center;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 10px;
  position: relative;
}

#drop-zone:hover {
  background: #f0f0f0;
  border-color: #999;
}

#drop-zone.dragover {
  border-color: #007bff;
  background: #eef5ff;
}

#drop-zone input {
  display: none;
}

.drop-content p {
  margin: 4px 0;
  color: #666;
}

.drop-content .sub {
  font-size: 13px;
  color: #999;
}

.drop-content .icon {
  font-size: 28px;
  display: block;
  margin-bottom: 6px;
}

#preview-imagenes {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.preview-item {
  position: relative;
}

.preview-item img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #ccc;
}

.preview-item button {
  position: absolute;
  top: -6px;
  right: -6px;
  background: red;
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  cursor: pointer;
  font-size: 12px;
}

.imagenes-eliminar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

#imagenes-eliminar img {
  width: 80px;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 6px;
  transition: transform 0.15s ease, border 0.15s ease, box-shadow 0.15s ease;
}

#imagenes-eliminar img:hover {
  transform: scale(1.05);
  border-color: #999;
}

#imagenes-eliminar img.seleccionada {
  border-color: #d11a2a;
  box-shadow: 0 0 0 2px rgba(209, 26, 42, 0.25);
}

.boton-limpiar {
  align-self: flex-start;
  margin-top: 5px;
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 5px;
  border: 1px solid #ccc;
  background: #f5f5f5;
  cursor: pointer;
  transition: background 0.2s ease;
}

.boton-limpiar:hover {
  background: #e6e6e6;
}

#limpiar-imagen {
    display: none;
}




/*-----------------------------------------------------------------*/




/* Filtros */


.filtros {
  position: relative;
  z-index: 600;
  background-color: #030F27;
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 15px 0;
  transition: top 0.3s ease;
}

.filtros.sticky {
  position: sticky;
  top: 80px; /* altura del header fijo */
}

/* El contenedor, este es el que DEBE ser flex */
.grupo-filtros {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap; /* permite ajustar en pantallas pequeñas */
  width: 100%;
  max-width: 1000px;
}

/* INPUT de búsqueda */
.filtro-productos {
  padding: 10px 15px;
  width: 250px;
  border: 2px solid #ccc;
  font-size: 16px;
  background-color: #fff !important;
  box-sizing: border-box;
}

/* SELECTS - estilo moderno */
.grupo-filtros select {
  padding: 10px 15px;
  width: 250px;
  border: 2px solid #ccc;
  border-radius: 9999px;
  font-size: 16px;
  background-color: #fff !important;
  color: #000;
  cursor: pointer;
  box-sizing: border-box;
}

.grupo-filtros div p {
    color: #ffffff;
    margin: 0;
}

mark.highlight {
  background-color: #ffd54f;
  color: #030f27;
  padding: 0 2px;
  border-radius: 3px;
}

@media (max-width: 800px) {
  .grupo-filtros select {
    padding: 5px 10px;
    width: 150px;
  }

  .grupo-filtros div input {
      width: 180px;
  }
}

@media (max-width: 460px) {
  .grupo-filtros select {
    padding: 5px 10px;
    width: 100px;
  }

  .grupo-filtros div input {
      width: 120px;
  }
}


/*-----------------------------------------------------------------*/


/* Favoritos y Vistos recientemente */

.favoritos,
.vistos-recientemente {
  display: none;
  padding: 2px;
  margin: 10px 0;

  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}

/* Colores más suaves */
.favoritos {
  background: linear-gradient(135deg, #d42233, #a91b28);
}

.vistos-recientemente {
  background: linear-gradient(135deg, #424B5D, #2e3542);
}

.favoritos h3,
.vistos-recientemente h3 {
  margin-bottom: 10px;
  padding-right: 15px;
  padding-left: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  align-self: center;
}

.favoritos-lista,
.vistos-lista {
  display: flex;
  gap: 12px;
  overflow-x: auto;

  scroll-behavior: smooth;
}

.producto-favorito,
.producto-visto {
  display: flex;
  align-items: center;
  gap: 10px;

  min-width: 220px;
  max-width: 260px;

  padding: 8px;
  background: #fff;
  border-radius: 10px;

  text-decoration: none;
  color: #000;

  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.producto-favorito:hover,
.producto-visto:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(0,0,0,0.15);
}

.producto-favorito img,
.producto-visto img {
  width: 35px;
  height: 35px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.producto-favorito span,
.producto-visto span {
  font-size: 0.85rem;
  line-height: 1.3;

  /* 🔥 permitir hasta 2 líneas */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;

  overflow: hidden;
}

.producto-favorito span:hover,
.producto-visto span:hover {
  overflow: visible;
  white-space: normal;
}

#limpiar-vistos {
  margin-top: 10px;
  margin-left: 10px;
  align-self: center;

  font-size: 0.75rem;
  padding: 5px 10px;

  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.4);
  background: transparent;
  color: #fff;

  cursor: pointer;
  transition: all 0.2s ease;
}

#limpiar-vistos:hover {
  background: rgba(255,255,255,0.15);
}

@media (max-width: 700px) {
  .producto-visto {
    min-width: 150px;
  }
}


/*-----------------------------------------------------------------*/




/* Estilos modal */


.modal {
  display: none;
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px); /* 🔥 IMPORTANTE */
}

.modal-content {
  background-color: #fff;
  margin: auto;
  padding: 20px;
  border-radius: 12px;
  width: 40%;
  box-shadow: 0px 4px 15px rgba(0,0,0,0.3);
  animation: slideDown 0.3s ease-out;
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close:hover {
  color: #000;
}



/* Opciones */


.opciones {
  background-color: #030f27;
  padding: 0 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.opciones a {
  display: inline-block; /* Evita que ocupe todo el ancho */
  width: auto; /* Se ajusta al texto */
  max-width: 200px; /* (Opcional) límite de ancho */
}

.botones a {
    max-height: 40%;
    font-size: 15px;
}

.category-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;

  height: 100%;
  position: relative;
}

.category-card .boton-azul {
  margin-top: auto;
}

.product-count-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: linear-gradient(135deg, #d32f2f, #b71c1c);
  color: white;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(211, 47, 47, 0.3);
  z-index: 2;
}

.product-count-badge::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 22px;
  background: linear-gradient(135deg, #ff5252, #d32f2f);
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s;
}

.category-card:hover .product-count-badge::before {
  opacity: 1;
}

/* Skeleton para el badge mientras carga */
.product-count-badge.loading {
  background: #e0e0e0;
  color: transparent;
  animation: pulse 1.5s infinite;
}


/*-----------------------------------------------------------------*/



/* Despliegue de Productos */

#div4, .productos {
  min-height: auto;
  height: auto;
  overflow: visible;
}

.productos {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  max-width: 1200px;
  margin: 0 auto;
  justify-content: center;
  gap: 20px;
  padding: 30px;
}


.productos a {
  background: #ffffff;
  text-decoration: none;
  color: inherit;
  padding: 15px;
  border-radius: 8px;
  text-align: center;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  display: none;
}

.productos a.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.productos a:hover {
  background-color: #f9f9f9;
  transform: scale(1.02);
}

.productos a img {
  width: 100%;
  max-width: 250px;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 8px;
}

.productos > a > div {
  align-self: flex-end;
}

#paginacion-productos {
  margin-top: 25px;
  padding-bottom: 20px;
  display: flex;
  justify-content: center;
  gap: 10px;
}

#paginacion-productos button {
  padding: 8px 12px;
  background: #ffffff;
  color: #030f27;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.3s;
}

#paginacion-productos button:hover {
  background: #d42233;
}

#paginacion-productos .activo {
  background: #d42233;
}


/*-----------------------------------------------------------------*/





/* Despliegue de Categorias */

.categorias {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 250px));
  justify-content: center; /* 🔥 clave */
  margin-bottom: 20px;
  gap: 25px;
  align-items: stretch; /* 🔥 MUY IMPORTANTE */
}

.search-container {
  position: relative;
  max-width: 400px;
  margin: 0;
}

.category-search-input {
  width: 70%;
  padding: 12px 45px 12px 16px;
  margin: 15px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  justify-self: center;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.category-search-input:focus {
  outline: none;
  border-color: #1a237e;
  box-shadow: 0 0 0 3px rgba(26, 35, 126, 0.1);
}

.category-card.hidden {
  display: none;
}

.search-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #757575;
}

.category-tabs {
  max-width: 87%;
  margin-top: 2rem;
}

.tab-badge {
  background: #e53935;
  color: #fff;
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: middle;
}

.tabs-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  border-bottom: 2px solid #e0e0e0;
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
}

.tab-button {
  padding: 10px 20px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  color: #666;
  border-radius: 8px 8px 0 0;
  transition: all 0.3s;
  position: relative;
}

.tab-button:hover {
  background: rgba(26, 35, 126, 0.05);
  color: #1a237e;
}

.tab-button.active {
  background: #1a237e;
  color: white;
}

.tab-button.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: #1a237e;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.subcategory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  padding: 1rem;
}

.categorias > a {
  background: #ffffff;
  color: #030f27;
  text-decoration: none;
  padding: 15px;
  border-radius: 8px;
  border: #d42233 2px solid;
  text-align: center;
  box-sizing: border-box; /* 🔥 evita overflow por padding */
  transition: background-color 0.3s ease, transform 0.3s ease;
  min-height: 270px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.categorias article:hover {
  background-color: #f9f9f9;
  transform: scale(1.02);
}

.categorias > a > img {
  width: 100%;
  max-width: 250px;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 8px;
}




/*-----------------------------------------------------------------*/





/* Despliegue de un Producto */


.producto {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 2rem;
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

.producto img {
  max-width: 450px;
  border: #030f27 2px solid;
  height: auto;
  object-fit: cover;
}

.producto > div {
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 5px;
  border: #030f27 2px solid;
  background-color: #424B5D;
}

.producto h1 {
  margin: 0 0 1rem;
}

.producto p {
  margin: 0;
  margin-top: 10px;
  line-height: 1.5;
}

#descripcion {
  white-space: pre-line;
  width: 100%;
}

.producto-despliegue {
  display: flex;
  gap: 30px;
  align-items: flex-start;
}

@media (max-width: 768px) {
  .producto {
    flex-direction: column;
    padding: 1rem;
  }

  .producto > div {
    min-width: unset;
  }

  .producto-despliegue {
    width: 100%;
    flex-direction: column;
    align-items: center;
  }

  .imagen-principal {
    width: 50%;
  }
}
.info-producto {
  flex: 1;
}

.imagen-principal {
  width: 45%;
  aspect-ratio: 1 / 1;
  height: auto;
  
  border-radius: 10px;
  overflow: hidden;
  background-color: #f5f5f5;

  display: flex;
  align-items: center;
  justify-content: center;
  
  position: relative;
  cursor: zoom-in;
}

.imagen-principal img {
  width: 100%;
  height: 100%;
  transition: transform 0.2s ease-out;
}

.imagen-principal.zoom img {
  transform: scale(2);
}

.galeria-producto {
  display: none;
}

.galeria-producto.activa {
  display: block;
}

.miniaturas {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 10px;
}

.miniaturas img {
  width: 100px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.miniaturas img:hover {
  transform: scale(1.05);
  border-color: #c62828; /* rojo shafel */
}

.miniaturas img.activa {
  opacity: 1;
  border: 2px solid #c00; /* o tu color */
}

/* 📱 Responsive */
@media (max-width: 1200px) {
  .miniaturas {
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  }
}

@media (max-width: 768px) {
  
  .miniaturas {
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  }
}

@media (max-width: 480px) {
  .miniaturas {
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  }
}

.categorias-box h2 {
  margin-bottom: 0.5rem;
}

.submenu-productos-fijo li {
  margin: 10px;
}

/* imagenes de producto */


#relacionados {
  margin: 4rem 2rem;
}

.relacionados-categoria {
  margin: 3rem 0;
}

.relacionados-categoria h2 {
  color: #030f27;
  margin-bottom: 1rem;
  font-size: 1.4rem;
  border-left: 5px solid #d42233;
  padding-left: 10px;
}

.slider-productos {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 10px;
  scroll-behavior: smooth;
}

/* ocultar scrollbar feo */
.slider-productos::-webkit-scrollbar {
  height: 6px;
}

.slider-productos::-webkit-scrollbar-thumb {
  background-color: #888;
  border-radius: 10px;
}

.producto-mini {
  flex: 0 0 150px; /* ancho fijo */
  background-color: #424B5D;
  border: 2px solid #030f27;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.3s ease;
}

.producto-mini:hover {
  transform: translateY(-5px);
}

.producto-mini a {
  color: white;
  text-decoration: none;
}

.producto-mini img {
  width: 100%;
  height: auto;
  object-fit: cover;
}

.producto-mini h3 {
  font-size: 1rem;
  text-align: center;
}





/*-----------------------------------------------------------------*/


/* --- Ajuste para pantallas pequeÃ±as --- */
@media (max-width: 1000px) {
  .categorias {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    row-gap: 5px; 
    padding: 10px;
  }

  .categorias article {
    width: 100%;
    height: auto;            /* ðŸ”¹ Ya no fuerza un alto fijo */
    padding: 10px;
  }

  .categorias article img {
    max-width: 100px;        /* ðŸ”¹ Imagen mÃ¡s pequeÃ±a */
    height: auto;
  }

  .categorias article h3 {
    font-size: 14px;         /* ðŸ”¹ Texto mÃ¡s compacto */
  }

  .categorias .boton-azul {
    font-size: 13px;
    padding: 6px 10px;
  }
  
  .productos {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .producto {
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 1rem;
  }

  .producto > div {
    max-width: 600px;
    align-items: center;
    text-align: center;
  }
  
  .slider-productos {
      height: 250px;
  }
  
  .producto-mini {
    flex: 0 0 120px; /* ancho fijo */
  }
}

@media (max-width: 600px) {
  .productos {
    grid-template-columns: 1fr;
  }
}


/* ðŸ“± Ajuste extra para pantallas muy pequeÃ±as */
@media (max-width: 480px) {
  .imagenes-grid {
    grid-template-columns: 1fr; /* una columna */
  }

  .imagenes-grid img {
    width: 90px;
    height: 90px;
  }
}


@keyframes slideDown {
  from { transform: translateY(-50px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* âœ¨ AnimaciÃ³n de apariciÃ³n suave */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}