/* ================================
   SUBNIVEL DE CATEGORÍAS
=================================*/
#subnivel-categorias.subnivel-categorias {
  width: 100vw;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  background-color: var(--Neutro-400, #E1DAD9);
  height: 78px;
  align-items: center;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  white-space: nowrap;
}

.subnivel-categorias .categoria-item {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  height: 78px;
  flex-shrink: 0;
  padding: 0 20px;
  cursor: pointer;
  margin: 0;
}

.subnivel-categorias .categoria-item.principal {
  background: rgba(248, 220, 61, 0.78);
}

/* ================================
   BUSQUEDA Y PAGINACIÓN
=================================*/
.busqueda-paginacion-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  margin: 70px 0;
  box-sizing: border-box;
}

.busqueda-paginacion {
  width: 100%;
  max-width: 1360px; /* mismo ancho óptico que el contenedor principal */
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  box-sizing: border-box;
}

.buscador {
  display: flex;
  align-items: center;
  gap: 8px;
  width: clamp(280px, 60vw, 720px);
  height: 56px;
  background: var(--Neutro-100, #ECE8E7);
  border-radius: 28px;
  padding: 0 16px;
  box-sizing: border-box;
  flex-shrink: 0;
}

.buscador input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  padding: 0;
}

.buscador .icono-buscar {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.busqueda-paginacion .paginador {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 45px;
  gap: 8px;
}

.pagina_previa,
.pagina_siguiente {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 45px;
  height: 45px;
  border-radius: var(--sds-size-radius-200);
  background-color: var(--sds-color-background-default);
  cursor: pointer;
  border: none;
  padding: 0;
}

.pagina_previa[disabled],
.pagina_siguiente[disabled] {
  opacity: 0.5;
  cursor: default;
}

.pagina_previa svg,
.pagina_siguiente svg { width: 16px; height: 16px; }

.pagina_numero {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 25px; height: 25px;
  border-radius: 5px;
  background-color: transparent;
  color: #000;
  font-family: var(--sds-typography-body-font-family);
  font-size: var(--sds-typography-body-size-medium);
  font-weight: var(--sds-typography-body-font-weight-regular);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.pagina_numero.seleccionada { background-color: #000; color: #fff; }

/* ================================
   CORRECCIÓN DE LAYOUT Y CENTRADO
   (sobrescribe global.css)
=================================*/
.layout > .contenido {
  /* en global.css es grid; aquí lo cambiamos para centrar todo */
  display: flex;
  flex-direction: column;
  align-items: center;    /* centra horizontalmente los hijos */
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 130px;
}

/* Contenedor principal centrado y con 2 columnas:
   - Col 1: Filtrador (350px)
   - Col 2: Productos (1fr) */
.contenedor-principal {
  width: 100%;
  max-width: 1360px;           /* 350 + 32 gap + grid productos (3x304 + 2x20) ≈ 1334 */
  margin-inline: auto;         /* centra el bloque */
  display: grid;
  grid-template-columns: 350px 1fr;
  column-gap: 32px;
  align-items: start;
  box-sizing: border-box;
  padding: 0 20px;
}

/* Importante: tienes un .contenedor-principal anidado.
   Lo “aplanamos” para que sus hijos (filtrador + productos) se posicionen en la grilla padre. */
.contenedor-principal > .contenedor-principal { display: contents; }

/* El filtrador queda fijo en la columna 1, y se extiende verticalmente
   para acompañar listas de productos múltiples si existen. */
.contenedor-principal .filtrador {
  grid-column: 1;
  grid-row: 1 / span 100;  /* ocupa varias filas si hay más de un .productos */
}

/* Cualquier .productos que sea hijo directo de .contenedor-principal
   cae a la columna 2 (ya tengas uno o dos). */
.contenedor-principal > .productos,
.contenedor-principal > .contenedor-principal > .productos {
  grid-column: 2;
}

/* ================================
   FILTRADOR (estilos visuales)
=================================*/
.filtrador {
  width: 350px;
  background: #fff;
  padding: 20px;
  box-sizing: border-box;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  font-family: Inter, sans-serif;
  color: var(--Neutro-600, #B3A29F);
}

.titulo-filtrador {
  font-size: 25px;
  font-weight: 700;
  margin-bottom: 10px;
}

.divisor {
  border: none;
  border-top: 1px solid #ddd;
  margin: 10px 0 20px 0;
}

.filtro-section { margin-bottom: 20px; }

.filtro-label {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--Neutro-600, #B3A29F);
}

/* Slider Precio */
.slider-precio { width: 100%; }

.linea-slider {
  width: 100%;
  max-width: 209px;
  height: 1px;
  background: #9A837F;
  margin-bottom: 8px;
}

.montos {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: var(--Neutro-600, #B3A29F);
}

/* Círculos de color */
.colores { display: flex; gap: 10px; }
.color-circle { width: 19px; height: 19px; border-radius: 50%; cursor: pointer; }

/* Checkboxes */
.checkbox-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  margin: 5px 0;
  color: var(--Neutro-600, #B3A29F);
}
.checkbox-label input { transform: scale(1.2); accent-color: #000; }

/* ================================
   PRODUCTOS (grid de tarjetas)
=================================*/
.productos {
  /* quitamos cualquier width fijo anterior */
  width: 100%;
  max-width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 304px); /* 3 columnas para tus tarjetas de ~304px */
  gap: 20px;
  align-content: start;
  justify-content: start;  /* alinea el grid al inicio dentro de su columna */
  box-sizing: border-box;
}

.active {
    font-weight: bold;
    color: var(--Primario-400, #A42D1D);
}


/* Botón filtros */
.boton-filtros {
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 12px;
    z-index: 1000;
}

/* Overlay para el filtrador */
.filtro-overlay {
    position: fixed;
    top: 0;
    right: -100%; /* inicialmente oculto a la derecha */
    width: 80%; /* ocupa parte de la pantalla */
    height: 100%;
    background-color: #fff;
    box-shadow: -2px 0 10px rgba(0,0,0,0.2);
    transition: right 0.3s ease;
    z-index: 999;
    overflow-y: auto; /* permite scroll dentro del panel */
}

/* Overlay abierto */
.filtro-overlay.show {
    right: 0;
}

/* Botón cerrar dentro del panel */
.filtro-overlay .cerrar-filtros {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    text-align: right;
    padding: 10px 20px;
}

/* Mostrar botón solo en Mobile */
@media (max-width: 900px) {
  /* Layout principal: filtrador oculto, productos debajo */
  .contenedor-principal {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    padding: 0 12px; /* márgenes a los lados */
    box-sizing: border-box;
  }

  /* Botón filtros */
  .boton-filtros {
    display: flex;
    border-radius: 5px;
    background: var(--Neutro-400, #E1DAD9);
    padding: 6px 12px;
    cursor: pointer;
    text-align: center;
    font-weight: 600;
    color: #000;
    width: fit-content;
    margin-bottom: 12px;
    justify-content: center;
    align-items: center;
    font-family: Inter, sans-serif;
    letter-spacing: -0.13px;
    font-size: 13px;
  }

  /* Buscador */
  .busqueda-paginacion {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    width: 100%;
    margin-bottom: 16px;
  }

  .buscador {
    width: 100%;
    max-width: 100%;
    height: 36px;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0 12px;
    box-sizing: border-box;
    background: var(--Neutro-100, #ECE8E7);
    border-radius: 28px;
  }

  .buscador input {
    flex: 1;
    font-size: 14px;
  }

  /* Paginador */
  .busqueda-paginacion .paginador {
    width: 100%;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    box-sizing: border-box;
  }

  /* Productos: grid 2x3 */
  .productos {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 productos por fila */
    gap: 12px; /* espacio entre tarjetas */
    justify-content: center;
  }

  /* Ajuste de cada tarjeta */
  .producto-tarjeta {
    width: 100%;          /* ocupa todo el espacio disponible del grid */
    max-width: calc((100% - 12px) / 2); /* dos por fila con gap */
    height: auto;         /* altura automática para que no se descuadre */
    margin: 0 auto;
  }

  .producto-tarjeta .img-wrapper img {
    max-height: 250px;    /* ajusta la altura de la imagen */
  }

  .producto-tarjeta .contenido-tarjeta {
    padding: 0.5rem;
  }

  .filtrador {
    display: none; /* oculto, se abre en overlay si se quiere */
  }
  
  .filtro-overlay {
      position: fixed;
      top: 0; left: 0;
      width: 100vw;
      height: 100vh;
      background: rgba(0,0,0,0.5);
      display: none;
      justify-content: flex-end;
      z-index: 1000;
  }
  
  .filtro-overlay.show {
      display: flex;
  }
  
  .filtrador-mobile {
      background: #fff;
      width: 80%;
      max-width: 350px;
      height: 100%;
      padding: 20px;
      box-sizing: border-box;
      overflow-y: auto;
      position: relative;
  }
  
  .filtrador-mobile .cerrar-filtros {
      position: absolute;
      top: 10px;
      right: 10px;
      font-size: 24px;
      cursor: pointer;
  }
}

