/* ===== Iesmart — Catálogo ===== */

/* Hero */
.cat-hero {
  position: relative;
  height: 400px;
  display: flex;
  align-items: center;
  overflow: hidden;
}
.cat-hero-bg {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center 40%;
  transform: scale(1.04);
  transition: transform 8s ease;
}
.cat-hero:hover .cat-hero-bg { transform: scale(1); }
.cat-hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(100deg, rgba(8,18,8,0.80) 0%, rgba(8,18,8,0.45) 60%, rgba(8,18,8,0.2) 100%);
}
.cat-hero-content { position: relative; z-index: 2; }
.cat-hero-tag {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(107,191,78,0.2); color: #a8e07a;
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em;
  padding: 6px 16px; border-radius: 50px; margin-bottom: 16px;
}
.cat-hero-content h1 {
  font-size: 2.6rem; font-weight: 900; color: #fff;
  line-height: 1.15; margin-bottom: 12px;
}
.cat-hero-content h1 .highlight { color: var(--color-green); }
.cat-hero-content p { color: rgba(255,255,255,0.8); font-size: 1rem; margin-bottom: 28px; }

.cat-hero-stats {
  display: flex; align-items: center; gap: 20px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  border-radius: 14px;
  padding: 16px 28px;
  width: fit-content;
}
.cat-stat { text-align: center; }
.cat-stat strong { display: block; font-size: 1.4rem; font-weight: 900; color: #fff; line-height: 1; }
.cat-stat span { font-size: 0.75rem; color: rgba(255,255,255,0.65); }
.cat-stat-sep { width: 1px; height: 36px; background: rgba(255,255,255,0.2); }

/* Animate */
.animate-in { opacity: 0; transform: translateY(20px); animation: catFadeUp 0.6s ease forwards; }
.delay-1 { animation-delay: 0.12s; }
.delay-2 { animation-delay: 0.22s; }
.delay-3 { animation-delay: 0.34s; }
@keyframes catFadeUp { to { opacity: 1; transform: translateY(0); } }

/* Sort select */
.toolbar-right { display: flex; align-items: center; gap: 16px; }
.sort-select {
  padding: 9px 14px;
  border: 1.5px solid rgba(0,0,0,0.12);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.87rem;
  color: var(--color-dark);
  background: var(--color-white);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.sort-select:focus { outline: none; border-color: var(--color-green); }

/* CTA banner dentro del catálogo */
.catalog-cta-banner {
  grid-column: 1 / -1;
  margin: 8px 0 16px;
}
.catalog-cta-inner {
  display: flex; align-items: center; gap: 20px;
  background: linear-gradient(135deg, #1a4d0a 0%, #2d7a14 100%);
  border-radius: 16px;
  padding: 22px 28px;
  flex-wrap: wrap;
}
.catalog-cta-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.catalog-cta-icon svg { width: 26px; height: 26px; fill: #fff; }
.catalog-cta-inner > div { flex: 1; min-width: 200px; }
.catalog-cta-inner strong { display: block; color: #fff; font-size: 1rem; font-weight: 700; margin-bottom: 3px; }
.catalog-cta-inner span { color: rgba(255,255,255,0.75); font-size: 0.87rem; }
.btn-cta-wa {
  display: inline-flex; align-items: center;
  background: #25D366; color: #fff;
  padding: 12px 22px; border-radius: 50px;
  font-weight: 700; font-size: 0.87rem;
  text-decoration: none; flex-shrink: 0;
  transition: background 0.2s, transform 0.2s;
  white-space: nowrap;
}
.btn-cta-wa:hover { background: #1da851; transform: translateY(-2px); }

/* Load more */
.load-more-wrap {
  grid-column: 1 / -1;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 32px 0 8px;
}
.load-more-wrap[hidden] { display: none; }
.load-more-btn {
  padding: 13px 40px;
  font-size: 0.95rem;
  border-radius: 50px;
}
.load-more-count { font-size: 0.82rem; color: var(--color-gray-text); }

.catalog-section { padding: 50px 0 90px; }

.catalog-layout {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 40px;
  align-items: start;
}

/* ---- Sidebar ---- */
.catalog-filters {
  background: var(--color-bg);
  border-radius: var(--radius);
  padding: 24px;
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 116px);
  overflow-y: auto;
}

.filters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.filters-header h3 { font-size: 1.1rem; }
.filters-header button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-green-dark);
  font-weight: 600;
  font-size: 0.85rem;
}

.filter-group {
  padding: 16px 0;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
.filter-group:last-child { border-bottom: none; }
.filter-group h4 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-dark);
  margin-bottom: 12px;
}

.filter-search {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.12);
  font-family: inherit;
  font-size: 0.92rem;
}
.filter-search:focus { outline: 2px solid var(--color-green); border-color: transparent; }

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--color-gray-text);
  padding: 6px 0;
  cursor: pointer;
}
.filter-checkbox input { accent-color: var(--color-green); width: 16px; height: 16px; flex-shrink: 0; }
.filter-label { flex: 1; min-width: 0; }
.filter-count { color: #999; font-size: 0.8rem; margin-left: auto; flex-shrink: 0; min-width: 32px; text-align: right; font-variant-numeric: tabular-nums; }

.filter-scroll {
  max-height: 280px;
  overflow-y: auto;
  padding-right: 6px;
}

/* ---- Toolbar / active filters ---- */
.catalog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.results-count { color: var(--color-gray-text); font-size: 0.92rem; }
.catalog-filters-toggle { display: none; }

.active-filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.filter-chip {
  background: rgba(107, 191, 78, 0.12);
  color: var(--color-green-dark);
  border: none;
  border-radius: 50px;
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

/* ---- Grid de productos ---- */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.catalog-card {
  background: var(--color-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition), box-shadow var(--transition);
}
.catalog-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 34px rgba(0,0,0,0.12);
}

.catalog-card-img {
  background: var(--color-bg);
  height: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  text-decoration: none;
  cursor: pointer;
}
.catalog-card-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
}
.product-img-placeholder {
  color: #b5b5b5;
  font-size: 0.85rem;
}

/* Hover: zoom suave siempre sobre la foto de producto */
.catalog-card-img-main {
  transition: transform 0.4s ease, opacity 0.4s ease;
}
.catalog-card:hover .catalog-card-img-main {
  transform: scale(1.08);
}

/* Si existe img/ambiente/<código>.jpg, hace crossfade a esa foto "en uso".
   Si la imagen no existe, el <img> se autoelimina (onerror) y este bloque no tiene efecto. */
.catalog-card-img-ambiente {
  position: absolute;
  inset: 0;
  object-fit: cover !important;
  mix-blend-mode: normal !important;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.catalog-card:hover .catalog-card-img-ambiente {
  opacity: 1;
}
/* Dibujo de medidas (perfiles): se ve completo, sobre fondo blanco */
.catalog-card-img-ambiente.catalog-card-img-medidas {
  object-fit: contain !important;
  background: #fff;
}
.catalog-card:hover:has(.catalog-card-img-ambiente) .catalog-card-img-main {
  opacity: 0;
}

/* Overlay de specs — aparece en hover solo si NO hay imagen de ambiente */
.card-hover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(45,45,45,0.82) 0%, rgba(30,30,30,0.92) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.35s ease;
  border-radius: 0;
}
.catalog-card:hover .card-hover-overlay { opacity: 1; }
/* Ocultar overlay cuando sí hay imagen de ambiente (ya se muestra la foto) */
.catalog-card:hover:has(.catalog-card-img-ambiente) .card-hover-overlay { opacity: 0; }

.card-hover-specs {
  list-style: none;
  padding: 0 16px;
  margin: 0;
  width: 100%;
}
.card-hover-specs li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.card-hover-specs li:last-child { border-bottom: none; }
.cho-icon { font-size: 0.85rem; flex-shrink: 0; width: 18px; text-align: center; }

.catalog-card-body { padding: 18px 20px 22px; flex-grow: 1; display: flex; flex-direction: column; }
.catalog-card-code {
  color: var(--color-green-dark);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  display: inline-block;
  cursor: text;
  user-select: text;
}
.catalog-card-body h3 {
  font-size: 1rem;
  margin-bottom: 10px;
  line-height: 1.35;
}
.catalog-card-title { cursor: text; user-select: text; }

.catalog-card-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}
.catalog-card-specs span {
  background: var(--color-bg);
  color: var(--color-gray-text);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 50px;
}

.catalog-card-body .btn-add-quote { margin-top: auto; width: 100%; padding: 11px 16px; font-size: 0.85rem; }
.catalog-card-body .btn-add-quote:disabled {
  background: var(--color-green);
  color: var(--color-white);
  border-color: var(--color-green);
  opacity: 1;
}

.no-results {
  text-align: center;
  color: var(--color-gray-text);
  padding: 60px 20px;
}
.no-results a { color: var(--color-green-dark); font-weight: 600; }

/* ---- Responsive ---- */
@media (max-width: 980px) {
  .catalog-layout { grid-template-columns: minmax(0, 1fr); }
  .catalog-results { min-width: 0; }
  .catalog-toolbar { flex-wrap: wrap; gap: 10px; }
  .catalog-filters-toggle { display: inline-flex; }
  .catalog-filters {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 85%;
    max-width: 340px;
    z-index: 1100;
    border-radius: 0;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform var(--transition);
    box-shadow: 8px 0 24px rgba(0,0,0,0.15);
  }
  .catalog-filters.open { transform: translateX(0); }
  .catalog-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .cat-hero { height: auto; min-height: 400px; padding: 48px 0 40px; }
  .cat-hero-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px; width: 100%; max-width: 100%; padding: 14px 18px; }
  .cat-stat-sep { display: none; }
  .catalog-grid { grid-template-columns: 1fr; }
  .catalog-toolbar { flex-direction: row-reverse; justify-content: space-between; }
}
