
body {
  font-family: 'Poppins', sans-serif;
  color: var(--text);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: #eef8f2;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("/static/images/fondo-2.png");
  background-repeat: repeat;
  background-size: auto;
  opacity: 0.55;
  pointer-events: none;
  z-index: -1;
}

main {
  padding: 20px 0;
}

.header-seccion {
  background-color: white;
  padding: 1.25rem;
  margin: 0 1.5rem 1.5rem;
  border-radius: 16px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.header-seccion h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: #2e5d34;
  margin: 0 0 0.5rem 0;
  line-height: 1.2;
}

.header-seccion p {
  font-size: 1rem;
  color: #555;
  margin: 0;
}

.filtros-activos {
  background: #f8f9fa;
  padding: 12px;
  margin: 10px 0 20px;
  border-radius: 10px;
  border: 1px solid #e9ecef;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.filtros-activos strong {
  color: #495057;
  font-weight: 600;
  margin-right: 12px;
  white-space: nowrap;
}

.filtro-etiqueta {
  background: linear-gradient(135deg, #4A7C59, #5a8c6a);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85em;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(74, 124, 89, 0.3);
  transition: all 0.2s ease;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filtro-etiqueta:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(74, 124, 89, 0.4);
  background: linear-gradient(135deg, #345B43, #4A7C59);
}

.filtros-sin-activos {
  color: #6c757d;
  font-style: italic;
  font-size: 0.9em;
  margin: 0;
  width: 100%;
}

.filtros-sidebar {
  background: white;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  margin-bottom: 30px;
  max-height: 650px;
  overflow-y: auto;
}

.filtros-sidebar h3, .filtros-sidebar h4 {
  font-size: 1.3em;
  margin-bottom: 20px;
  color: #2c3e50;
  border-bottom: 2px solid #e0e0e0;
  padding-bottom: 8px;
}

.busqueda-wrapper {
  position: relative;
}

.form-label {
  font-weight: 600;
  margin-top: 12px;
  display: block;
}

.form-label:first-child {
  margin-top: 0;
}

.categorias-checkboxes {
  display: block;
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid #ddd;
  padding: 8px;
  border-radius: 4px;
  margin-top: 6px;
  gap: 0;
}

.categorias-checkboxes .form-check {
  margin-bottom: 6px;
  display: flex;
  align-items: center;
}

.categorias-checkboxes .form-check-input {
  margin-right: 8px;
}

.categorias-checkboxes .form-check-label {
  cursor: pointer;
  font-size: 0.95em;
}

.sugerencias-container {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1050;
  background: white;
  border: 1px solid #dee2e6;
  border-top: none;
  border-radius: 0 0 .375rem .375rem;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  display: none;
}

.sugerencia-item {
  padding: 12px;
  cursor: pointer;
  border-bottom: 1px solid #f8f9fa;
  text-decoration: none;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
}

.sugerencia-item:hover,
.sugerencia-item.active {
  background-color: #f8f9fa !important;
  color: #000;
}

.sugerencia-item:last-child {
  border-bottom: none;
}

.btn-limpiar {
  background: none;
  border: none;
  color: #dc3545;
  font-weight: bold;
  cursor: pointer;
  margin-left: 5px;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.btn-limpiar:hover {
  color: #b02a37;
  background: rgba(220, 53, 69, 0.1);
  transform: scale(1.1);
}

.input-error {
  border-color: #dc3545 !important;
  box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25) !important;
}

.error-message {
  color: #dc3545;
  font-size: 0.875em;
  margin-top: 4px;
}

.productos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 25px;
  margin-top: 10px;
}

.producto-card {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: 2px solid rgba(232, 217, 185, 0.4);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.producto-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.15);
  border-color: #e8d9b9;
}

.producto-card .card-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-title {
  font-size: 1.25em;
  font-weight: 700;
  color: #4A7C59;
  margin-bottom: 8px;
  line-height: 1.3;
  min-height: 48px;
}

.producto-card .text-muted.small {
  font-size: 0.85em;
  color: #8a6a1f;
  font-weight: 600;
  margin-bottom: 14px;
  letter-spacing: 0.5px;
}

.producto-imagen-contenedor {
  height: 180px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 18px;
  background: #f8f9f8;
  position: relative;
}

.producto-imagen {
  transition: transform 0.3s ease;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
}

.producto-card:hover .producto-imagen {
  transform: scale(1.03);
}

.producto-imagen-placeholder {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
}

.producto-imagen-placeholder i {
  font-size: 2.5rem;
}

.producto-card .card-text {
  font-size: 0.95em;
  color: #5a5a5a;
  margin: 12px 0;
  line-height: 1.5;
  min-height: 60px;
  flex-grow: 1;
}

.producto-card .valor, .card .h5 strong {
  font-weight: 700;
  color: #234a2a;
  font-size: 1.3em;
  margin: 12px 0 10px;
}

.btn-ver-producto, .producto-card .btn.btn-outline-primary {
  width: 100%;
  padding: 0.5rem 0;
  font-weight: 600;
  background-color: #4A7C59 !important;
  color: white !important;
  border: none !important;
  border-radius: 8px;
  transition: all 0.25s ease;
  margin-top: 8px;
  box-shadow: 0 2px 6px rgba(74, 124, 89, 0.2);
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn-ver-producto:hover, .producto-card .btn.btn-outline-primary:hover {
  background-color: #345B43 !important;
  color: white !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 124, 89, 0.35);
}

.stock-info {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 10px 0;
  font-size: 0.92em;
  font-weight: 600;
}

.stock-disponible { color: #28a745; }
.stock-bajo { color: #fd7e14; }
.stock-agotado { color: #dc3545; }

.badge-agotado {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  background: #e74c3c;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 30px;
  font-size: 0.85em;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
  letter-spacing: 0.5px;
}

#btnSubir {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #28a745;
  color: white;
  border: none;
  opacity: 0;
  transition: all 0.3s;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

#btnSubir.visible {
  opacity: 1;
}

#btnSubir:hover {
  background: #218838;
  transform: translateY(-2px);
}

@media (min-width: 992px) {
  .catalogo-layout {
    display: flex;
    gap: 30px;
  }
  .filtros-sidebar {
    flex: 0 0 280px;
    margin-bottom: 0;
  }
  .productos-section {
    flex: 1;
  }
}

@media (max-width: 768px) {
  #btnSubir {
    width: 45px;
    height: 45px;
    font-size: 1.1rem;
    right: 15px;
    bottom: 20px;
  }
  
  .filtro-etiqueta {
    font-size: 0.8em;
    padding: 4px 8px;
    max-width: 150px;
  }
}

.animate__animated {
  animation-duration: 0.3s;
  animation-fill-mode: both;
}

.animate__fadeInUp {
  animation-name: fadeInUp;
}

.animate__pulse {
  animation-name: pulse;
}

.animate__faster {
  animation-duration: 0.2s;
}

.animate__fast {
  animation-duration: 0.3s;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translate3d(0, 20px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

[data-producto-id] .stock-info,
[data-producto-id] .badge-agotado,
[data-producto-id] .btn-ver-producto {
  transition: all 0.3s ease;
}

[data-producto-id].fade-out-remove {
  opacity: 0;
  transform: scale(0.92);
}

[data-producto-id].opacity-low {
  opacity: 0.35 !important;
  pointer-events: none !important;
}

[data-producto-id].highlight-update {
  position: relative;
  z-index: 1;
}

[data-producto-id].highlight-update::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 16px;
  background: rgba(74, 124, 89, 0.12);
  pointer-events: none;
  animation: highlightPulse 1.2s ease-out forwards;
  z-index: 0;
}

@keyframes highlightPulse {
  0% { opacity: 0; }
  20% { opacity: 1; }
  100% { opacity: 0; }
}