/* ============================================================
   MÓDULO PRODUCTOS — Devint  (Tema Oscuro — v4)
   Compatible con el fondo dark del sitio: #0a1f3f a #03050a
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300..700&display=swap');

:root {
  /* Tarjeta — misma familia que el fondo del body */
  --prod-surface:    rgba(10, 31, 63, 0.45);
  --prod-surface-h:  rgba(10, 31, 63, 0.70);

  /* Bordes y acentos cyan del sitio */
  --prod-border:     rgba(0, 212, 255, 0.10);
  --prod-border-h:   rgba(0, 212, 255, 0.30);
  --prod-accent:     #00d4ff;
  --prod-accent-h:   #7c3aed;

  /* Texto */
  --prod-text:       #ffffff;
  --prod-muted:      rgba(255, 255, 255, 0.60);
  --prod-faint:      rgba(255, 255, 255, 0.35);

  --prod-radius:     0.875rem;
  --prod-shadow:     0 2px 8px rgba(0, 0, 0, 0.25),
                     0 8px 24px rgba(0, 0, 0, 0.20);
  --prod-shadow-h:   0 4px 16px rgba(0, 212, 255, 0.08),
                     0 16px 40px rgba(0, 0, 0, 0.30);
  --transition:      220ms cubic-bezier(.16, 1, .3, 1);
}

body { font-family: 'Inter', sans-serif; }

/* ============================================================
   HEADER CATÁLOGO
   ============================================================ */
.prod-header {
  text-align: center;
  padding: 7rem 1.5rem 2.5rem;
  position: relative;
  z-index: 1;
}
.prod-header h1,
.prod-header h2 {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--prod-text);
  margin-bottom: 0.5rem;
}
.prod-header p {
  font-size: 1rem;
  color: var(--prod-muted);
}

/* ============================================================
   FILTROS
   ============================================================ */
.prod-filters {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
  position: relative; z-index: 1;
}
.filters-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  flex: 1;
}
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 160px;
}
.filter-group label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--prod-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.filter-group select,
.filter-group input[type="search"] {
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--prod-border);
  border-radius: 0.625rem;
  font-size: 0.9rem;
  background: rgba(0, 212, 255, 0.05);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--prod-text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition),
              background var(--transition);
}
.filter-group select:focus,
.filter-group input[type="search"]:focus {
  border-color: var(--prod-accent);
  background: rgba(0, 212, 255, 0.10);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.12);
}
.filter-group select option { background: #0a1f3f; color: #fff; }
.filter-search { flex: 1; min-width: 220px; }
.prod-count {
  font-size: 0.8125rem;
  color: var(--prod-muted);
  white-space: nowrap;
  align-self: flex-end;
  padding-bottom: 0.35rem;
}
.prod-count strong { color: var(--prod-accent); font-weight: 700; }

/* ============================================================
   GRID WRAPPER
   ============================================================ */
.prod-grid-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem 5rem;
  position: relative; z-index: 1;
}
.prod-grid-wrapper::before {
  content: '';
  display: block;
  height: 1px;
  margin-bottom: 1.75rem;
  background: linear-gradient(
    to right,
    transparent,
    rgba(0, 212, 255, 0.2) 30%,
    rgba(0, 212, 255, 0.2) 70%,
    transparent
  );
}

/* ============================================================
   GRID DE TARJETAS
   ============================================================ */
.prod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr));
  gap: 1.25rem;
}

/* ---- Tarjeta ---- */
.prod-card {
  background: var(--prod-surface);      /* fondo = misma tonalidad que el body */
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--prod-radius);
  border: 1px solid var(--prod-border);
  box-shadow: var(--prod-shadow);
  overflow: hidden;
  transition: transform var(--transition),
              box-shadow var(--transition),
              border-color var(--transition),
              background var(--transition);
  will-change: transform;
  animation: cardReveal 0.38s ease both;
}
.prod-card:nth-child(1)   { animation-delay: 0.04s; }
.prod-card:nth-child(2)   { animation-delay: 0.08s; }
.prod-card:nth-child(3)   { animation-delay: 0.12s; }
.prod-card:nth-child(4)   { animation-delay: 0.16s; }
.prod-card:nth-child(5)   { animation-delay: 0.20s; }
.prod-card:nth-child(6)   { animation-delay: 0.24s; }
.prod-card:nth-child(n+7) { animation-delay: 0.28s; }

.prod-card:hover {
  transform: translateY(-3px);
  background: var(--prod-surface-h);
  box-shadow: var(--prod-shadow-h);
  border-color: var(--prod-border-h);
}

@keyframes cardReveal {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .prod-card { animation: none; }
}

.prod-card-link {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  height: 100%;
}

/* ---- Imagen tarjeta ---- */
.prod-card-img {
  margin: 0;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}
.prod-card-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0.88;
  transition: transform 0.5s cubic-bezier(.16,1,.3,1), opacity 0.4s ease;
}
.prod-card:hover .prod-card-img img {
  transform: scale(1.035);
  opacity: 1;
}
.lazy { filter: blur(8px); transition: filter 0.45s ease; }
.lazy.loaded { filter: none; }

/* ---- Cuerpo tarjeta ---- */
.prod-card-body {
  padding: 1.125rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}
.prod-badge {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #c4b5fd;
  background: rgba(124, 58, 237, 0.25);
  border: 1px solid rgba(124, 58, 237, 0.4);
  padding: 0.2rem 0.65rem;
  border-radius: 99px;
  width: fit-content;
}
.prod-card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--prod-text);
  line-height: 1.35;
  margin: 0;
}
.prod-card-desc {
  font-size: 0.8125rem;
  color: var(--prod-muted);
  line-height: 1.6;
  margin: 0;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  line-clamp: 3;
  overflow: hidden;
}
.prod-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.375rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--prod-border);
}
.prod-sectors {
  font-size: 0.7rem;
  color: var(--prod-faint);
  max-width: 65%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.prod-cta {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--prod-accent);
  transition: color var(--transition);
}
.prod-card:hover .prod-cta { color: #a78bfa; }

/* ---- Estados loading / vacío ---- */
.prod-loading,
.prod-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 5rem 1rem;
  color: var(--prod-muted);
  text-align: center;
}
.prod-loading {
  position: absolute; inset: 0;
  background: rgba(3, 5, 10, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10;
  border-radius: var(--prod-radius);
}
[hidden] { display: none !important; }
.spinner {
  width: 32px; height: 32px;
  border: 2px solid rgba(0, 212, 255, 0.2);
  border-top-color: var(--prod-accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   DETALLE DE PRODUCTO
   ============================================================ */
.prod-breadcrumb {
  max-width: 1100px;
  margin: 2.5rem auto 0;
  padding: 0 1.5rem;
  position: relative; z-index: 1;
}
.prod-breadcrumb a {
  font-size: 0.8125rem;
  color: var(--prod-accent);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition);
}
.prod-breadcrumb a:hover { color: #a78bfa; }

/* Contenedor detalle — mismo fondo que las tarjetas */
.prod-detalle {
  max-width: 1100px;
  margin: 1.5rem auto 6rem;
  padding: 2rem 2rem 2.5rem;
  background: var(--prod-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--prod-border);
  border-radius: var(--prod-radius);
  box-shadow: var(--prod-shadow);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
  position: relative; z-index: 1;
}
@media (max-width: 768px) {
  .prod-detalle {
    grid-template-columns: 1fr;
    gap: 2rem;
    margin: 1.5rem 1rem 4rem;
    padding: 1.5rem;
  }
}

/* Imagen detalle */
.prod-detalle-media figure { margin: 0; }
.prod-detalle-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: calc(var(--prod-radius) - 4px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

/* ---- Bloque Manual PDF ---- */
.prod-manual-block {
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  background: rgba(0, 212, 255, 0.05);
  border: 1px solid var(--prod-border);
  border-radius: calc(var(--prod-radius) - 2px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.prod-manual-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.prod-manual-icon {
  width: 36px; height: 36px;
  background: rgba(0, 212, 255, 0.10);
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--prod-accent);
}
.prod-manual-label {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.prod-manual-label strong {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--prod-text);
}
.prod-manual-label span {
  font-size: 0.6875rem;
  color: var(--prod-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.btn-manual {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  background: rgba(0, 212, 255, 0.12);
  border: 1px solid rgba(0, 212, 255, 0.3);
  color: var(--prod-accent);
  border-radius: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background var(--transition), border-color var(--transition),
              transform var(--transition);
}
.btn-manual:hover {
  background: rgba(0, 212, 255, 0.22);
  border-color: var(--prod-accent);
  transform: translateY(-1px);
}

/* ---- Info detalle ---- */
.prod-detalle-info { display: flex; flex-direction: column; gap: 1.25rem; }
.prod-detalle-title {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--prod-text);
  line-height: 1.2;
}
.prod-detalle-desc {
  font-size: 0.9375rem;
  color: var(--prod-muted);
  line-height: 1.75;
}

/* Ficha técnica */
.prod-ficha {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.prod-ficha th,
.prod-ficha td {
  padding: 0.7rem 0.875rem;
  text-align: left;
  border-bottom: 1px solid var(--prod-border);
}
.prod-ficha th {
  width: 38%;
  font-weight: 600;
  color: var(--prod-accent);
  background: rgba(0, 212, 255, 0.04);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.prod-ficha td { color: rgba(255,255,255,0.8); }

/* ID oculto en frontend */
.prod-id-row { display: none; }

/* CTA */
.prod-detalle-cta { margin-top: 0.5rem; }
.btn-cotizar {
  display: inline-block;
  padding: 0.85rem 2rem;
  background: linear-gradient(135deg, #00d4ff, #7c3aed);
  color: #fff;
  border-radius: 0.625rem;
  font-size: 0.9375rem;
  font-weight: 700;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: transform var(--transition), box-shadow var(--transition);
}
.btn-cotizar:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 212, 255, 0.30);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
  .filters-form { flex-direction: column; }
  .filter-group { min-width: 100%; }
  .prod-filters { flex-direction: column; align-items: stretch; }
  .prod-card-body { padding: 1rem; }
  .prod-manual-block { flex-direction: column; align-items: flex-start; }
}
