/* ==========================================================================
   VARIABLES GLOBALES Y RESET BÁSICO
   ========================================================================== */
:root {
  --cf-primary: #e67e22;
  /* Color Ferretero (Naranja) */
  --cf-primary-hover: #d35400;
  --cf-text: #2c3e50;
  --cf-bg: #f9f9f9;
  --cf-border: #ecf0f1;
  --cf-whatsapp: #25D366;
  --cf-whatsapp-hover: #128C7E;
}

.cf-oculto {
  display: none !important;
}

/* ==========================================================================
   BUSCADOR PREDICTIVO (SHORTCODE 1) - DISEÑO OPTIMIZADO PARA HEADER
   ========================================================================== */
.cf-buscador-container {
  position: relative;
  width: 500px;
  max-width: 500px !important;
  margin: 0 auto;
  font-family: sans-serif;
}

.cf-input-wrapper {
  display: flex;
  /* Sombra sutil oscura para despegarlo del fondo */
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  border-radius: 50px;
  /* Diseño en forma de píldora (elegante y moderno) */
  overflow: hidden;
  background: rgba(255, 255, 255, 0.95);
  /* Blanco con un 5% de transparencia */
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.cf-input-wrapper input {
  flex: 1;
  padding: 12px 25px;
  /* Altura más corta (12px en lugar de 15px) */
  border: none;
  background: transparent;
  font-size: 15px;
  outline: none;
  color: #2c3e50;
}

.cf-input-wrapper input::placeholder {
  color: #95a5a6;
  /* Placeholder un poco más claro para ser sutil */
}

.cf-input-wrapper button {
  background: #2c3e50;
  /* Azul oscuro pizarra que combina con la ropa del trabajador */
  color: #fff;
  border: none;
  padding: 0 35px;
  font-weight: bold;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.cf-input-wrapper button:hover {
  background: var(--cf-primary);
  /* Cambia al tono naranja/dorado al pasar el mouse */
}

/* Caja flotante de resultados predictivos */
#cf-resultados-predictivos {
  position: absolute;
  top: calc(100% + 10px);
  /* Separado 10px de la barra principal */
  left: 0;
  width: 100%;
  background: #fff;
  border: 1px solid var(--cf-border);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
  z-index: 999;
  border-radius: 12px;
  /* Bordes redondeados independientes */
  overflow: hidden;
}

.cf-item-predictivo {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  cursor: pointer;
  border-bottom: 1px solid var(--cf-border);
  transition: 0.2s;
  font-size: 14px;
  color: var(--cf-text);
}

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

.cf-item-predictivo:hover {
  background: var(--cf-bg);
  color: var(--cf-primary);
  /* El texto resalta al pasar el mouse */
}

.cf-item-predictivo img {
  width: 35px;
  height: 35px;
  object-fit: contain;
  margin-right: 15px;
  background: #fff;
  border-radius: 4px;
}

.cf-item-vacio {
  padding: 15px 20px;
  color: #7f8c8d;
  text-align: center;
  font-size: 14px;
}

/* ==========================================================================
   ESTRUCTURA DEL CATÁLOGO (SHORTCODE 3)
   ========================================================================== */
.cf-catalogo-layout {
  display: flex;
  gap: 40px;
  /* Más espacio entre el filtro y los productos */
  max-width: 1440px;
  /* Aumentado para que sea más amplio */
  margin: 0 auto;
  font-family: sans-serif;
  align-items: flex-start;
}

/* BARRA LATERAL (FILTROS) */
.cf-filtros-sidebar {
  width: 290px;
  /* Sidebar más ancho para que los nombres largos quepan bien */
  flex-shrink: 0;
  background: #fff;
  padding: 25px 20px;
  border-radius: 8px;
  border: 1px solid var(--cf-border);
}

.cf-filtro-grupo {
  margin-bottom: 20px;
}

.cf-filtro-grupo:last-child {
  margin-bottom: 0;
}

.cf-filtro-grupo label {
  display: block;
  font-weight: bold;
  margin-bottom: 8px;
  color: var(--cf-text);
}

.cf-filtro-grupo input[type="text"],
.cf-filtro-grupo select {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  outline: none;
}

/* VISIBILIDAD DE FILTROS SEGÚN DISPOSITIVO */
.cf-filtro-desktop {
  display: block;
}

.cf-filtro-movil {
  display: none;
}

.cf-radio-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 0;
}

.cf-radio-list label {
  font-weight: normal !important;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  /* Alinea arriba por si el texto pasa a 2 líneas */
  gap: 10px;
  /* Espacio exacto entre el botón y el texto */
  font-size: 14.5px;
  color: var(--cf-text);
  transition: 0.2s;
  text-align: left;
  /* Forza el texto a la izquierda */
  line-height: 1.4;
  margin-bottom: 5px;
  /* Separación vertical entre categorías */
}

.cf-radio-list label:hover {
  color: var(--cf-primary);
}

/* Bloqueo de la interferencia del Tema Astra para Checkboxes */
.cf-radio-list input[type="checkbox"] {
  flex-shrink: 0;
  margin: 3px 0 0 0 !important;
  /* Elimina márgenes extraños */
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  appearance: checkbox !important;
}

/* BOTÓN LIMPIAR FILTROS */
.cf-btn-limpiar {
  width: 100%;
  padding: 12px;
  margin-top: 25px;
  background: #f1f2f6;
  color: #747d8c;
  border: 1px solid #dfe4ea;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
}

.cf-btn-limpiar:hover {
  background: #dfe4ea;
  color: #2f3542;
  border-color: #ced6e0;
}

/* ==========================================================================
   FILTRO DE PRECIO (BARRA DESLIZABLE DUAL)
   ========================================================================== */
.cf-precio-valores {
  display: flex;
  justify-content: space-between;
  font-weight: bold;
  color: var(--cf-primary);
  margin-bottom: 15px;
  font-size: 14px;
}

.cf-rango-container {
  position: relative;
  width: 100%;
  height: 6px;
  background: #eaedf2;
  border-radius: 5px;
  margin-bottom: 10px;
}

/* La línea de color que une ambos puntos */
.cf-rango-track {
  position: absolute;
  height: 100%;
  background: var(--cf-primary);
  border-radius: 5px;
  top: 0;
  left: 0%;
  right: 0%;
}

/* Superposición invisible de los controles nativos */
.cf-rango-container input[type="range"] {
  position: absolute;
  width: 100%;
  height: 6px;
  top: 0;
  background: none;
  pointer-events: none;
  /* Permite hacer clic a través de ellos */
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  outline: none;
}

/* El botón redondo (Thumb) */
.cf-rango-container input[type="range"]::-webkit-slider-thumb {
  pointer-events: auto;
  /* Reactivamos el clic solo para el botón */
  -webkit-appearance: none;
  height: 20px;
  width: 20px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--cf-primary);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: transform 0.1s;
}

.cf-rango-container input[type="range"]::-webkit-slider-thumb:active {
  transform: scale(1.2);
  /* Crece un poquito al arrastrar */
}

/* ==========================================================================
   FILTRO DE PRECIO (BARRA DESLIZABLE DUAL - FORZADO)
   ========================================================================== */
.cf-precio-valores {
  display: flex;
  justify-content: space-between;
  font-weight: bold;
  color: var(--cf-primary);
  margin-bottom: 15px;
  font-size: 14px;
}

.cf-rango-container {
  position: relative;
  width: 100%;
  height: 6px;
  background: #eaedf2;
  /* Pista base gris nuestra */
  border-radius: 5px;
  margin-bottom: 25px;
}

.cf-rango-track {
  position: absolute;
  height: 100%;
  background: var(--cf-primary);
  border-radius: 5px;
  top: 0;
  z-index: 1;
}

/* Forzamos la desaparición del input nativo */
.cf-rango-container input[type="range"] {
  position: absolute !important;
  width: 100% !important;
  height: 6px !important;
  top: 0 !important;
  left: 0 !important;
  background: transparent !important;
  pointer-events: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  margin: 0 !important;
  outline: none !important;
  border: none !important;
  z-index: 2 !important;
}

/* DESTRUIMOS la pista nativa de Chrome/Safari/Edge */
.cf-rango-container input[type="range"]::-webkit-slider-runnable-track {
  -webkit-appearance: none !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  height: 0 !important;
}

/* DESTRUIMOS la pista nativa de Firefox */
.cf-rango-container input[type="range"]::-moz-range-track {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  height: 0 !important;
}

/* Diseño del botón redondo (Thumb) - Chrome/Safari */
.cf-rango-container input[type="range"]::-webkit-slider-thumb {
  pointer-events: auto !important;
  -webkit-appearance: none !important;
  height: 20px !important;
  width: 20px !important;
  border-radius: 50% !important;
  background: #fff !important;
  border: 3px solid var(--cf-primary) !important;
  cursor: pointer !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
  margin-top: -7px !important;
  /* Centrado */
  transition: transform 0.1s !important;
}

/* Diseño del botón redondo (Thumb) - Firefox */
.cf-rango-container input[type="range"]::-moz-range-thumb {
  pointer-events: auto !important;
  height: 20px !important;
  width: 20px !important;
  border-radius: 50% !important;
  background: #fff !important;
  border: 3px solid var(--cf-primary) !important;
  cursor: pointer !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
  transform: translateY(-7px) !important;
  /* Centrado Firefox */
  transition: transform 0.1s !important;
}

.cf-rango-container input[type="range"]::-webkit-slider-thumb:active {
  transform: scale(1.1) !important;
}

.cf-rango-container input[type="range"]::-moz-range-thumb:active {
  transform: translateY(-7px) scale(1.1) !important;
}

/* ÁREA PRINCIPAL */
.cf-catalogo-main {
  flex-grow: 1;
  position: relative;
  min-height: 400px;
}

#cf-loader {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--cf-primary);
  color: #fff;
  padding: 10px 20px;
  border-radius: 50px;
  font-weight: bold;
  z-index: 10;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   GRILLA DE PRODUCTOS Y TARJETAS (3 COLUMNAS)
   ========================================================================== */
.cf-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  /* 3 columnas estrictas */
  gap: 25px;
  /* Espacio entre tarjetas para que respiren */
  transition: opacity 0.3s ease;
}

.cf-card {
  background: #ffffff;
  border: 1px solid #eaedf2;
  /* Borde sutil para despegarlo del fondo */
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
  /* Sombra base suave */
}

.cf-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
  border-color: #d1d9e6;
}

/* Tratamiento de la Imagen (contain para evitar recortes) */
.cf-card-img {
  width: 100%;
  height: 220px;
  /* Altura adaptada para 3 columnas */
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #fcfcfc;
  border-bottom: 1px solid #f0f2f5;
  padding: 15px;
}

.cf-card-info {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  text-align: center;
}

.cf-categoria-badge {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  font-weight: bold;
  letter-spacing: 0.5px;
  background: #f0f4f8;
  color: #64748b;
  padding: 6px 12px;
  border-radius: 20px;
  margin-bottom: 12px;
  align-self: center;
}

.cf-card-info h3 {
  font-size: 16px;
  margin: 0 0 15px 0;
  color: var(--cf-text);
  line-height: 1.3;
}

.cf-precio {
  font-size: 20px;
  font-weight: 900;
  color: var(--cf-primary);
  margin-bottom: 20px;
}

/* Botón WhatsApp */
.cf-btn-wa {
  display: inline-block;
  background: var(--cf-whatsapp);
  color: #fff;
  text-decoration: none;
  padding: 12px;
  border-radius: 4px;
  font-weight: bold;
  margin-top: auto;
  transition: 0.3s;
}

.cf-btn-wa:hover {
  background: var(--cf-whatsapp-hover);
  color: #fff;
}

/* ==========================================================================
   PAGINACIÓN
   ========================================================================== */
.cf-paginacion {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 40px;
}

.cf-page-btn {
  background: #fff;
  border: 1px solid var(--cf-border);
  color: var(--cf-text);
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  transition: 0.2s;
}

.cf-page-btn:hover {
  background: var(--cf-bg);
}

.cf-page-btn.activo {
  background: var(--cf-primary);
  color: #fff;
  border-color: var(--cf-primary);
}

.cf-no-resultados {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  background: #fff;
  border: 1px dashed #ccc;
  color: #7f8c8d;
  border-radius: 8px;
}

/* ==========================================================================
   ADAPTACIÓN PARA MÓVILES (RESPONSIVE)
   ========================================================================== */
@media (max-width: 1024px) {
  .cf-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .cf-catalogo-layout {
    flex-direction: column;
  }

  .cf-filtros-sidebar {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
  }

  .cf-filtro-grupo {
    flex: 1;
    min-width: 150px;
    margin-bottom: 0;
  }

  .cf-filtro-desktop {
    display: none;
  }

  .cf-filtro-movil {
    display: block;
  }
}

@media (max-width: 480px) {
  .cf-filtro-grupo {
    flex: 100%;
  }

  .cf-grid {
    grid-template-columns: 1fr;
  }

  .cf-card {
    max-width: 350px;
    margin: 0 auto;
    width: 100%;
  }
}

/* Tratamiento de la Imagen */
.cf-card-img {
  width: 100%;
  height: 220px;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #fcfcfc;
  border-bottom: 1px solid #f0f2f5;
  padding: 15px;
  position: relative;
  /* <-- IMPORTANTE para que la etiqueta se posicione sobre la imagen */
}

/* Diseño de la Etiqueta NUEVO */
.cf-badge-nuevo {
  position: absolute;
  top: 15px;
  right: 15px;
  color: #e74c3c;
  font-size: 11px;
  font-weight: 900;
  padding: 5px 12px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
  z-index: 2;
  animation: cf-pulse 2s infinite;
  /* Un ligero latido para llamar la atención */
}

/* Animación sutil para la etiqueta */
@keyframes cf-pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }

  100% {
    transform: scale(1);
  }
}

/* ==========================================================================
   VISIBILIDAD DE FILTROS SEGÚN DISPOSITIVO
   ========================================================================== */
.cf-filtro-desktop {
  display: block;
}

.cf-filtro-movil {
  display: none;
}

/* Lista de escritorio sin el scroll feo */
.cf-radio-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 0;
}

.cf-radio-list label {
  font-weight: normal !important;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14.5px;
  color: var(--cf-text);
  transition: 0.2s;
  text-align: left;
  line-height: 1.4;
  margin-bottom: 5px;
}

.cf-radio-list label:hover {
  color: var(--cf-primary);
}

.cf-radio-list input[type="checkbox"] {
  flex-shrink: 0;
  margin: 3px 0 0 0 !important;
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  appearance: checkbox !important;
}

/* ==========================================================================
   ADAPTACIÓN PARA MÓVILES Y TABLETS (RESPONSIVE)
   ========================================================================== */
@media (max-width: 1024px) {
  .cf-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .cf-catalogo-layout {
    flex-direction: column;
    align-items: stretch;
    /* ESTA ES LA CLAVE MÁGICA: Obliga a estirarse a los lados */
  }

  .cf-catalogo-main {
    width: 100%;
    /* Obliga al contenedor de productos a ocupar todo el espacio */
  }

  .cf-filtros-sidebar {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
  }

  .cf-filtro-grupo {
    flex: 1;
    min-width: 150px;
    margin-bottom: 0;
  }

  .cf-filtro-desktop {
    display: none;
  }

  .cf-filtro-movil {
    display: block;
  }
}

@media (max-width: 480px) {
  .cf-filtro-grupo {
    flex: 100%;
  }

  .cf-grid {
    grid-template-columns: 1fr;
    width: 100%;
    /* Forzamos la grilla al 100% */
  }

  .cf-card {
    width: 100%;
    /* La tarjeta por fin podrá usar todo ese 100% */
    max-width: 100%;
    margin: 0;
  }
}

/* ==========================================================================
   DESPLEGABLE MÚLTIPLE PREMIUM PARA MÓVIL (UN SOLO CAMPO)
   ========================================================================== */
.cf-multiselect-dropdown {
  position: relative;
  width: 100%;
  font-family: sans-serif;
}

/* El encabezado simulando ser un input select único */
.cf-multiselect-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 14.5px;
  color: var(--cf-text);
  user-select: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.cf-multiselect-header .cf-arrow {
  font-size: 10px;
  transition: transform 0.3s ease;
  color: #7f8c8d;
}

/* Rotar flecha si el desplegable está abierto */
.cf-multiselect-dropdown.open .cf-arrow {
  transform: rotate(180deg);
}

/* Contenedor flotante de las opciones */
.cf-multiselect-options {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background: #fff;
  border: 1px solid #ced6e0;
  border-top: none;
  border-radius: 0 0 6px 6px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 9999;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

/* Mostrar la lista flotante cuando tiene la clase open */
.cf-multiselect-dropdown.open .cf-multiselect-options {
  display: block;
}

/* Filas de opciones de categoría individuales */
.cf-multiselect-option {
  display: flex !important;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  cursor: pointer;
  border-bottom: 1px solid #f1f2f6;
  margin: 0 !important;
  transition: background 0.2s;
  text-align: left;
}

.cf-multiselect-option:last-child {
  border-bottom: none;
}

.cf-multiselect-option:hover {
  background: #f8f9fa;
}

/* Estilo para las casillas de verificación dentro de la lista flotante */
.cf-multiselect-option input[type="checkbox"] {
  flex-shrink: 0;
  margin: 0 !important;
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  appearance: checkbox !important;
  accent-color: var(--cf-primary);
}

.cf-multiselect-option span {
  font-size: 14px;
  font-weight: normal !important;
  color: var(--cf-text);
}