@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

* {
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

body {
  margin: 0;
  padding: 0;
  background-color: #fbfbfb;
  color: #111;
  overflow-x: hidden;
}

.container-productos{
  margin-top: 25px;
  padding: 20px 5%;
  background-color: #fbfbfb;
}

.encabezado {
  width: 100%; 
  height: 110px; 
  background-image: url('../recursos/varios/encabezado.png'); 
  background-size: cover; 
  background-position: center;  
  background-repeat: no-repeat; 
  display: flex;
  flex-direction: column;
  justify-content: center; 
  align-items: center; 
  color: white; 
  text-align: center;
  padding: 0 20px; 
}

h1 {
  margin: 10px 0 25px;
}

.layout {
  display: flex;
  gap: 30px;
}

/* Sidebar */
.sidebar {
  width: 300px;
  min-width: 300px;
  border-right: 1px solid #eee;
  padding-right: 20px;
  position: sticky;
  top: 20px;
  align-self: flex-start;
  height: fit-content;
}

.sidebar section {
  margin-bottom: 25px;
}

.sidebar h3 {
  font-size: 16px;
  margin-bottom: 10px;
}

.sidebar h2{
  margin-bottom: 5px;
  font-size: 20px;
}

.sidebar label {
  display: block;
  font-size: 14px;
  margin-bottom: 6px;
}

.filtro{
  max-width: 275px;
    background: #fff;
    padding: 20px 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

input[type="range"]::-moz-range-thumb:hover {
    box-shadow: 0 0 8px rgba(255,122,0,0.5);
}

.sidebar .check-item {
  display: flex;
  align-items: center;
}

/* Links de categorías (como filtro) */
.filter-link {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;

    color: #333;
    font-size: 13px;
    text-decoration: none;   /* ❌ sin subrayado */
    cursor: pointer;
}

.filter-link:hover {
    color: #000;
}

/* para que el número quede a la derecha */
.filter-link .count {
    margin-left: auto;
    font-size: 12px;
    color: #999;
}


.filtro h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #111;
}

.check-item {
    display: flex;
    align-items: center;   /* 🔥 ESTO arregla todo */
    gap: 10px;
    padding: 6px 0;
    font-size: 13px;
    color: #333;
    cursor: pointer;
}

.check-item:hover {
    color: #000000;
}

/* ocultamos el checkbox real */
.check-item input {
    display: none;
}


/* checkbox visual */
.check-custom {
    width: 18px;
    height: 18px;
    border: 2px solid #ccc;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0; 
}


/* check */
.check-custom::after {
    content: "✓";
    font-size: 12px;
    color: white;
    transform: scale(0);
    transition: transform .2s ease;
}

/* cuando está marcado */
.check-item input:checked + .check-custom {
    background: #ff7a00;
    border-color: #ff7a00;
}

.check-item input:checked + .check-custom::after {
    transform: scale(1);
}

.text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.count {
    font-size: 12px;
    color: #999;
}


/*FILTRO DE PRECIO*/
.price-inputs {
    display: flex;
    justify-content: space-between;
    margin-bottom: 25px;
}

.input-group {
    display: flex;
    flex-direction: column;
    width: 48%;
}

.input-group label {
    font-size: 14px;
    margin-bottom: 5px;
    color: #555;
}

.input-group input {
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 14px;
    text-align: right;
    transition: all 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: #ff7a00;
    box-shadow: 0 0 5px rgba(255,122,0,0.3);
}

.slider-container {
    position: relative;
    height: 8px;
    background: #ddd;
    border-radius: 4px;
}

.slider-track, .slider-range {
    position: absolute;
    height: 8px;
    border-radius: 4px;
}

.slider-track {
    width: 100%;
    background: #ddd;
}

.slider-range {
    background: #ff7a00;
    z-index: 1;
}

input[type="range"] {
    position: absolute;
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    background: transparent;
    pointer-events: none;
    z-index: 2;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #fff;
    border: 2px solid #ff7a00;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: all;
    transition: box-shadow 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    box-shadow: 0 0 8px rgba(255,122,0,0.5);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #fff;
    border: 2px solid #ff7a00;
    border-radius: 50%;
    cursor: pointer;
    transition: box-shadow 0.2s;
}

input[type="range"]::-moz-range-thumb:hover {
    box-shadow: 0 0 8px rgba(255,122,0,0.5);
}

.filtro-header {
    display: flex;
    align-items: center;
    justify-content: space-between; /* título a la izquierda, botón a la derecha */
    margin-bottom: 12px;
}

.filtro-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: #111;
    margin: 0;
}

.clear-filters.section {
    background: #f0f0f0;      /* gris claro tipo card */
    border: none;
    border-radius: 12px;       /* redondeado */
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    color: #555;               /* gris oscuro */
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.clear-filters.section:hover {
    background: #e0e0e0;       /* un gris más oscuro al hover */
    color: #111;
}

.clear-all-filters.section {
    background: #f0f0f0;      /* gris claro tipo card */
    border: none;
    border-radius: 12px;       /* redondeado */
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    color: #555;               /* gris oscuro */
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    margin: 10px 0;
}

.clear-all-filters.section:hover {
    background: #e0e0e0;       /* un gris más oscuro al hover */
    color: #111;
}

/* Content */
.content {
  flex: 1;
}

.content-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

.content-header select {
  padding: 10px 40px 10px 14px;
  border-radius: 10px;
  border: 1px solid #ddd;
  font-size: 14px;
}

/* Products */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 22px;
  width: 100%;
}

.product-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.product-card-link .product-card {
    transition: transform 0.2s;
}

.product-card-link:hover .product-card {
    transform: translateY(-5px);
}


.product-card {
  width: 100%;
  min-height: unset;     
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
  position: relative;
  background-color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: transform .2s ease, box-shadow .2s ease;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 30px rgba(0,0,0,.08);
  cursor: pointer;
}

.product-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}


.product-category {
  font-size: 13px;
  color: #777;
  margin-bottom: 6px;
}

.product-name {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 2px;
  color: black;
  white-space: normal;      /* permite saltos de línea */
  word-wrap: break-word;    /* corta palabras largas */
  overflow-wrap: break-word;
  text-align: center;       /* opcional */
}
.product-rating {
  position: relative;
  display: inline-block;
  font-size: 16px;
  line-height: 1;
  margin-bottom: 2px;
}

.product-stars-bg {
  color: #ddd;
}

.product-stars-fill {
  color: #f5a623;
  position: absolute;
  top: 0;
  left: 0;
  white-space: nowrap;
  overflow: hidden;
}

.product-price-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.product-price {
  font-size: 20px;
  font-weight: 700;
  color: #000;
}

.product-old-price-antes{
  font-size: 13px;
  color: #888;
}

.product-old-price {
  font-size: 13px;
  color: #888;
  text-decoration: line-through;
}

.product-discount {
  position: absolute;
  top: 15px;      
  right: 15px;    
  background: #ff0000;
  color: #fff;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 600;
  z-index: 2;     
}

.mobile-actions {
  display: none;
  margin-bottom: 15px;
}

.mobile-actions button {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid #ddd;
  background: #fff;
  font-size: 14px;
  cursor: pointer;
}

/* ===== Skeleton ===== */
.skeleton-card{
  height:260px;
  border-radius:16px;
  background:linear-gradient(90deg,#eee,#f5f5f5,#eee);
  background-size:200%;
  animation:skeleton 1.3s infinite;
}

@keyframes skeleton{
  to{background-position:-200%}
}

/* Fade cards */
.product-card{
  animation:fade .3s ease;
}

@keyframes fade{
  from{opacity:0;transform:translateY(8px)}
}

/* Load more */
#loadMoreBtn{
  background:#ff6a00;
  border:none;
  color:#fff;
  padding:14px 28px;
  border-radius:999px;
  font-weight:600;
  cursor:pointer;
}

.load-more-container{
  display:flex;
  justify-content:center;
  margin:40px 0;
}

.products-loading {
  display: flex;
  justify-content: center;
  padding: 40px 0;
}

.products-spinner {
  width: 38px;
  height: 38px;
  border: 3px solid #eee;
  border-top: 3px solid #ff6a00;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}


@media (max-width: 1024px) {

  /* ====== LAYOUT GENERAL ====== */
  .layout {
    gap: 0;
  }

  .content {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  /* ====== SIDEBAR MÓVIL ====== */
  .sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 90%;
    max-width: 360px;
    height: 100vh;
    background: #fbfbfb;
    padding: 20px;
    z-index: 10001;
    overflow-y: auto;
    transition: left .25s ease;
    border-right: none;
  }

  .sidebar.active {
    left: 0;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 10000;
    display: none;
  }

  .sidebar-backdrop.active {
    display: block;
  }

  /* ====== TOOLBAR (FILTROS + ORDENAR) ====== */

  .mobile-actions {
    display: flex;
    flex-shrink: 0;
  }

  .content-header {
    display: flex;
    flex: 1;
    min-width: 0;              /* 🔥 CLAVE Samsung */
  }

  .content > .mobile-actions,
  .content > .content-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;         /* 🔥 NUNCA baja */
    background: #fff;
    padding: 10px;
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(0,0,0,.05);
  }

  /* botón filtros */
  .mobile-actions button {
    height: 44px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid #ddd;
    background: #fff;
    font-size: 14px;
    white-space: nowrap;
  }

  /* select ordenar */
  .content-header select {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid #ddd;
    font-size: 14px;
    background: #fff;
    min-width: 0;              /* 🔥 CLAVE Samsung */
  }

  /* ====== GRID ====== */
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}


@media (max-width: 600px) {

  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }

  .content h2 {
    font-size: 18px;
    margin-bottom: 20px;
  }
}

