.cat-container {
  padding: 24px;
}

.cat-vista {
  animation: catFadeIn 0.25s ease;
}

@keyframes catFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* HEADER */
.cat-header {
  margin-bottom: 26px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.cat-title {
  font-size: 32px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 5px;
}
.cat-subtitle {
  color: #6b7280;
  margin: 0;
  font-size: 14px;
}

/* ===================== GRID DE CATEGORÍAS ===================== */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.cat-card {
  position: relative;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  padding: 26px 22px;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}

.cat-card::before {
  content: "";
  position: absolute;
  top: -40%;
  right: -30%;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(29, 53, 87, 0.07), transparent 70%);
  transition: transform 0.25s ease;
}

.cat-card:hover {
  transform: translateY(-4px);
  border-color: #1d3557;
  box-shadow: 0 10px 28px rgba(29, 53, 87, 0.12);
}

.cat-card:hover::before {
  transform: scale(1.25);
}

.cat-card-icono {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: #f0f4f8;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cat-card-icono img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.cat-card-nombre {
  font-size: 17px;
  font-weight: 700;
  color: #111827;
  margin: 0;
  line-height: 1.3;
}

.cat-card-desc {
  font-size: 13px;
  color: #6b7280;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.45;
}

.cat-card-footer {
  margin-top: auto;
  padding-top: 10px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #f1f5f9;
}

.cat-card-contador {
  font-size: 12px;
  font-weight: 600;
  color: #1d3557;
  background: #eef2f7;
  padding: 4px 10px;
  border-radius: 999px;
}

.cat-card-flecha {
  color: #9ca3af;
  transition: transform 0.18s ease, color 0.18s ease;
}
.cat-card:hover .cat-card-flecha {
  transform: translateX(3px);
  color: #1d3557;
}

/* Skeleton loading */
.cat-skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  grid-column: 1 / -1;
}
.cat-skeleton-card {
  height: 160px;
  border-radius: 18px;
  background: linear-gradient(100deg, #f3f4f6 30%, #ececee 50%, #f3f4f6 70%);
  background-size: 200% 100%;
  animation: catShimmer 1.3s ease-in-out infinite;
}
@keyframes catShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* EMPTY STATE */
.cat-empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 70px 20px;
  color: #9ca3af;
  background: #ffffff;
  border: 1px dashed #e5e7eb;
  border-radius: 18px;
}
.cat-empty-state svg {
  color: #cbd5e1;
  margin-bottom: 14px;
}
.cat-empty-state p {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
}

/* ===================== VISTA PRODUCTOS ===================== */
.btn-volver {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: #1d3557;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  margin-bottom: 18px;
  transition: gap 0.15s ease;
}
.btn-volver:hover {
  gap: 11px;
}

.cat-header-productos {
  align-items: center;
}
.cat-detalle-icono {
  width: 54px;
  height: 54px;
  object-fit: contain;
  background: #f0f4f8;
  border-radius: 14px;
  padding: 10px;
  flex-shrink: 0;
}

/* GRID PRODUCTOS */
.prod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 26px;
}

.prod-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  display: flex;
  flex-direction: column;
  /* .prod-card ahora es un <a>: se anulan estilos nativos de enlace */
  text-decoration: none;
  color: inherit;
}
.prod-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}
.prod-card:visited {
  color: inherit;
}

.prod-card-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f9fafb;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.prod-card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.prod-card-descuento {
  position: absolute;
  top: 10px;
  left: 10px;
  background: #991b1b;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
}

.prod-card-stock-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  background: #fee2e2;
  color: #991b1b;
}

.prod-card-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.prod-card-nombre {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  margin: 0;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 38px;
}

.prod-card-sku {
  font-size: 11px;
  color: #9ca3af;
  margin: 0;
}

.prod-card-precios {
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.prod-card-precio-final {
  font-size: 17px;
  font-weight: 700;
  color: #1d3557;
}
.prod-card-precio-original {
  font-size: 12px;
  color: #9ca3af;
  text-decoration: line-through;
}

/* PAGINACIÓN */
.cat-paginacion {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.pag-btn {
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #374151;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pag-btn:hover:not(:disabled):not(.pag-actual) {
  background: #eef2f7;
  border-color: #1d3557;
  color: #1d3557;
}
.pag-btn.pag-actual {
  background: #1d3557;
  color: #fff;
  border-color: #1d3557;
}
.pag-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.pag-ellipsis {
  color: #9ca3af;
  font-size: 13px;
  padding: 0 4px;
}

/* MOBILE */
@media (max-width: 768px) {
  .cat-container {
    padding: 14px;
  }
  .cat-title {
    font-size: 26px;
  }
  .cat-grid,
  .prod-grid,
  .cat-skeleton-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
  }
  .cat-card {
    padding: 18px 16px;
  }
  .cat-header-productos {
    flex-wrap: wrap;
  }
}