/**
 * Doofinder Classic v7 — Nutritienda
 * Panel a ancho completo bajo el header, sin backdrop oscuro.
 */

/* Sin overlay / backdrop (Doofinder usa html.df-fix-layout) */
html.df-fix-layout::before,
html.df-fix-layout::after,
html.nt-doofinder-open::before {
  display: none !important;
  content: none !important;
}

html.nt-doofinder-open,
html.nt-doofinder-open body {
  overflow: hidden !important;
}

/* Layer móvil nativo de Doofinder: sin overrides (fullscreen por defecto). */

/* ── Panel clásico custom (desktop) ─────────────────────────────────────── */
body .df-classic.nt-doofinder-layer[visible],
body .nt-doofinder-layer.df-classic[visible] {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  top: var(--nt-df-panel-top, var(--nt-df-header-bottom, 64px)) !important;
  bottom: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  max-height: none !important;
  min-height: 0 !important;
  z-index: 20150 !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  display: flex !important;
  flex-direction: column !important;
  margin: 0 !important;
  border: 1px solid var(--ui-border-muted) !important;
  border-radius: 0 !important;
  box-shadow: 0 -1px 0 var(--ui-border-muted) !important;
  overflow: hidden !important;
  background: var(--ui-bg) !important;
  background-color: var(--ui-bg) !important;
  color: var(--ui-text) !important;
  font-family: 'Public Sans', ui-sans-serif, system-ui, sans-serif !important;
  font-size: 0.875rem !important;
  box-sizing: border-box !important;
}

html.dark body .df-classic.nt-doofinder-layer[visible],
html.dark body .nt-doofinder-layer.df-classic[visible] {
  background: var(--ui-bg) !important;
  background-color: var(--ui-bg) !important;
  border-color: var(--ui-border-muted) !important;
  color: var(--ui-text) !important;
}

@media (max-width: 1023px) {
  /* Un solo input: el del menú/header, sin searchbox duplicado dentro del layer */
  body .nt-doofinder-layer .df-header .df-searchbox {
    display: none !important;
  }

  body .nt-doofinder-layer .df-header {
    min-height: 2.75rem !important;
    padding-right: 3rem !important;
  }

  /* Móvil: sin filtros laterales, solo sugerencias + resultados (ver reglas al final del archivo) */

  body .nt-doofinder-layer .df-main {
    flex: 1 1 auto !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}

@media (max-width: 767px) {
  body .df-classic.nt-doofinder-layer[visible],
  body .nt-doofinder-layer.df-classic[visible] {
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
  }
}

/* Panel cerrado / oculto — evita cajas blancas fantasma */
body .df-classic.nt-doofinder-layer[hidden],
body .nt-doofinder-layer.df-classic[hidden],
body .df-classic.nt-doofinder-layer:not([visible]),
body .nt-doofinder-layer.df-classic:not([visible]) {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
}

/* ── Layout principal (aside izquierda en desktop) ───────────────────────── */
body .nt-doofinder-layer .df-layer__content {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
  background: transparent !important;
}

@media (max-width: 767px) {
  body .nt-doofinder-layer .df-layer__content {
    flex-direction: column !important;
  }
}

@media (min-width: 768px) {
  body .nt-doofinder-layer .df-layer__content {
    flex-direction: row !important;
  }
}

body .nt-doofinder-layer .df-main {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  background: var(--ui-bg) !important;
  background-color: var(--ui-bg) !important;
}

@media (min-width: 1024px) {
  body .nt-doofinder-layer .df-aside {
    flex: 0 0 auto !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    width: 15rem !important;
    max-width: 15rem !important;
    max-height: none !important;
    height: 100% !important;
    background: var(--ui-bg-muted) !important;
    background-color: var(--ui-bg-muted) !important;
    border-top: none !important;
    border-right: 1px solid var(--ui-border-muted) !important;
    overflow: hidden !important;
  }

  body .nt-doofinder-layer .df-aside__content {
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    padding: 0.75rem 0.75rem 1rem !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
}

@media (min-width: 1280px) {
  body .nt-doofinder-layer .df-aside {
    width: 16.5rem !important;
    max-width: 16.5rem !important;
  }
}

/* ── Header: searchbox + contador (sin iconos rotos) ─────────────────────── */
body .nt-doofinder-layer .df-header {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 0.625rem !important;
  flex-shrink: 0 !important;
  width: 100% !important;
  height: auto !important;
  min-height: 3.25rem !important;
  padding: 0.625rem 3rem 0.625rem 0.875rem !important;
  border-bottom: 1px solid var(--ui-border-muted) !important;
  background: var(--ui-bg) !important;
  background-color: var(--ui-bg) !important;
}

/* Toggle grid/lista: oculto (iconos sprite rotos en esta integración) */
body .nt-doofinder-layer .df-header .df-icon-list {
  display: none !important;
}

body .nt-doofinder-layer .df-searchbox {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 0.875rem !important;
  border: 1px solid var(--ui-border) !important;
  border-radius: 9999px !important;
  background: var(--ui-bg-elevated) !important;
  background-color: var(--ui-bg-elevated) !important;
}

body .nt-doofinder-layer .df-searchbox input {
  display: block !important;
  width: 100% !important;
  height: 2.5rem !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  outline: none !important;
  background: transparent !important;
  border-radius: 0 !important;
  font-family: inherit !important;
  font-size: 1rem !important;
  font-weight: 500 !important;
  line-height: 2.5rem !important;
  color: var(--ui-text-highlighted) !important;
  box-shadow: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}

body .nt-doofinder-layer .df-searchbox input::placeholder {
  color: var(--ui-text-dimmed) !important;
  opacity: 1 !important;
}

body .nt-doofinder-layer .df-searchbox input:focus {
  outline: none !important;
  box-shadow: none !important;
}

body .nt-doofinder-layer .df-header-title {
  flex: 0 0 auto !important;
  margin: 0 !important;
  padding: 0 !important;
  text-align: right !important;
  font-size: 0.75rem !important;
  font-weight: 400 !important;
  line-height: 1.3 !important;
  color: var(--ui-text-dimmed) !important;
  white-space: nowrap !important;
  font-variant-numeric: tabular-nums !important;
}

body .nt-doofinder-layer .df-header-title span[data-role='total'] {
  font-weight: 700 !important;
  color: var(--ui-text-highlighted) !important;
}

body .nt-doofinder-layer .df-header-sort {
  flex: 0 0 auto !important;
  display: none !important;
}

/* ── Sugerencias ─────────────────────────────────────────────────────────── */
body .nt-doofinder-layer .df-suggestions-list {
  flex-shrink: 0 !important;
  padding: 0.5rem 0.875rem !important;
  border-bottom: 1px solid var(--ui-border-muted) !important;
  background: var(--ui-bg-muted) !important;
  background-color: var(--ui-bg-muted) !important;
  line-height: 1.6 !important;
}

body .nt-doofinder-layer .df-suggestion-label {
  display: inline !important;
  font-size: 0.6875rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
  color: var(--ui-text-dimmed) !important;
  margin-right: 0.5rem !important;
}

body .nt-doofinder-layer .df-suggestion {
  display: inline-block !important;
  padding: 0.25rem 0.625rem !important;
  margin: 0.125rem 0.25rem 0.125rem 0 !important;
  font-size: 0.8125rem !important;
  font-weight: 500 !important;
  color: var(--ui-text-toned) !important;
  background: var(--ui-bg) !important;
  background-color: var(--ui-bg) !important;
  border: 1px solid var(--ui-border-muted) !important;
  border-radius: 9999px !important;
  cursor: pointer !important;
  transition: background 0.15s ease, border-color 0.15s ease !important;
}

body .nt-doofinder-layer .df-suggestion:hover,
body .nt-doofinder-layer .df-suggestion[data-selected] {
  color: var(--ui-primary) !important;
  border-color: var(--ui-primary) !important;
  background: var(--ui-bg) !important;
}

/* ── Resultados ─────────────────────────────────────────────────────────── */
body .nt-doofinder-layer .df-results {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  padding: 0.75rem !important;
  background: var(--ui-bg) !important;
  background-color: var(--ui-bg) !important;
}

@media (min-width: 640px) {
  body .nt-doofinder-layer .df-results {
    padding: 0.875rem 1rem !important;
  }
}

body .nt-doofinder-layer .df-banner {
  margin-bottom: 0.75rem !important;
  border-radius: 0.75rem !important;
  overflow: hidden !important;
  grid-column: 1 / -1 !important;
}

body .nt-doofinder-layer[data-layout='grid'] .df-results {
  display: grid !important;
  align-items: stretch !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 0.625rem !important;
}

@media (min-width: 640px) {
  body .nt-doofinder-layer[data-layout='grid'] .df-results {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0.75rem !important;
  }
}

@media (min-width: 1024px) {
  body .nt-doofinder-layer[data-layout='grid'] .df-results {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 1280px) {
  body .nt-doofinder-layer[data-layout='grid'] .df-results {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 0.75rem !important;
  }
}

body .nt-doofinder-layer[data-layout='grid'] .df-card {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  margin: 0 !important;
}

body .nt-doofinder-layer[data-layout='grid'] .df-card__main {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
}

body .nt-doofinder-layer[data-layout='grid'] .df-card__content {
  text-align: left !important;
  flex: 1 1 auto !important;
}

body .nt-doofinder-layer[data-layout='grid'] .df-card__description {
  display: none !important;
}

/* ── Cards (estilo ProductCard) ──────────────────────────────────────────── */
body .nt-doofinder-layer .df-card {
  border: 1px solid var(--ui-border-muted) !important;
  border-radius: 1rem !important;
  background: var(--ui-bg) !important;
  background-color: var(--ui-bg) !important;
  overflow: hidden !important;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease !important;
}

body .nt-doofinder-layer .df-card:hover {
  border-color: var(--ui-border-accented) !important;
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1) !important;
  transform: translateY(-4px) !important;
}

body .nt-doofinder-layer .df-card__main {
  color: inherit !important;
  text-decoration: none !important;
  position: relative !important;
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
}

body .nt-doofinder-layer .df-card__image {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  aspect-ratio: 1 / 1 !important;
  width: 100% !important;
  height: auto !important;
  padding: 1rem 1.25rem !important;
  margin: 0 !important;
  background: var(--ui-bg-muted) !important;
  background-color: var(--ui-bg-muted) !important;
  border-bottom: 1px solid var(--ui-border-muted) !important;
}

html.dark body .nt-doofinder-layer .df-card__image {
  background: #fff !important;
  background-color: #fff !important;
}

body .nt-doofinder-layer .df-card__image img {
  display: block !important;
  max-width: 100% !important;
  max-height: 100% !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  mix-blend-mode: multiply !important;
  filter: none !important;
  transition: transform 0.5s ease !important;
}

body .nt-doofinder-layer .df-card:hover .df-card__image img {
  transform: scale(1.05) !important;
}

body .nt-doofinder-layer .df-card__content {
  padding: 1rem !important;
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  gap: 0 !important;
  min-height: 0 !important;
}

body .nt-doofinder-layer .df-card__title {
  margin: 0 !important;
  font-size: 0.875rem !important;
  font-weight: 600 !important;
  line-height: 1.375 !important;
  color: var(--ui-text-highlighted) !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  flex: 0 0 2.75rem !important;
  height: 2.75rem !important;
  min-height: 2.75rem !important;
  max-height: 2.75rem !important;
}

body .nt-doofinder-layer .nt-df-card-footer {
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-end !important;
  gap: 0.375rem !important;
  flex: 0 0 3.125rem !important;
  min-height: 3.125rem !important;
  margin-top: auto !important;
  padding-top: 0.375rem !important;
}

body .nt-doofinder-layer .nt-df-card-footer .nt-df-rating-wrap,
body .nt-doofinder-layer .nt-df-card-footer .df-rating {
  flex: 0 0 0.875rem !important;
  min-height: 0.875rem !important;
  max-height: 0.875rem !important;
  margin: 0 !important;
}

body .nt-doofinder-layer .nt-df-card-footer .df-card__pricing {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: baseline !important;
  gap: 0.25rem 0.5rem !important;
  flex: 0 0 1.375rem !important;
  min-height: 1.375rem !important;
  margin: 0 !important;
  padding: 0 !important;
}

body .nt-doofinder-layer .df-card__pricing {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: baseline !important;
  gap: 0.25rem 0.5rem !important;
  margin: 0 !important;
  padding: 0 !important;
}

body .nt-doofinder-layer .df-card__price {
  margin: 0 !important;
  font-size: 1.125rem !important;
  font-weight: 700 !important;
  font-variant-numeric: tabular-nums !important;
  color: var(--ui-text-highlighted) !important;
}

body .nt-doofinder-layer .df-card__price.df-card__price--old {
  font-size: 0.75rem !important;
  font-weight: 400 !important;
  color: var(--ui-text-muted) !important;
  text-decoration: line-through !important;
}

body .nt-doofinder-layer .df-card__price.df-card__price--new {
  color: var(--ui-text-highlighted) !important;
}

body .nt-doofinder-layer .df-card__availability.in_stock {
  display: none !important;
}

body .nt-doofinder-layer .df-card__availability.out_of_stock {
  margin-top: 0.25rem !important;
  font-size: 0.6875rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  color: var(--ui-color-error-500, #ef4444) !important;
}

/* ── Valoraciones ────────────────────────────────────────────────────────── */
body .nt-doofinder-layer .nt-df-rating-wrap,
body .nt-doofinder-layer .df-rating {
  margin-top: 0.25rem !important;
  min-height: 0.875rem !important;
}

body .nt-doofinder-layer .df-rating {
  position: relative !important;
  display: inline-block !important;
  height: 0.875rem !important;
  font-size: 0.875rem !important;
  line-height: 1 !important;
  vertical-align: middle !important;
}

body .nt-doofinder-layer .df-rating__value,
body .nt-doofinder-layer .df-rating__placeholder {
  white-space: nowrap !important;
  top: 0 !important;
  left: 0 !important;
}

body .nt-doofinder-layer .df-rating__value {
  position: absolute !important;
  overflow: hidden !important;
  color: #fbbf24 !important;
  z-index: 1 !important;
}

body .nt-doofinder-layer .df-rating__placeholder {
  position: relative !important;
  color: var(--ui-text-dimmed) !important;
  opacity: 0.35 !important;
}

body .nt-doofinder-layer .df-rating__value i,
body .nt-doofinder-layer .df-rating__placeholder i {
  font-style: normal !important;
  letter-spacing: 0.02em !important;
}

body .nt-doofinder-layer .df-rating.nt-df-rating--empty .df-rating__value {
  width: 0 !important;
  overflow: hidden !important;
}

body .nt-doofinder-layer .df-rating.nt-df-rating--empty .df-rating__placeholder {
  color: var(--ui-text-dimmed) !important;
  opacity: 0.35 !important;
}

/* ── Facetas ─────────────────────────────────────────────────────────────── */
body .nt-doofinder-layer .df-panel {
  margin-bottom: 0.75rem !important;
  background: transparent !important;
  border: none !important;
}

body .nt-doofinder-layer .df-panel__title {
  display: block !important;
  padding: 0.375rem 0.5rem !important;
  margin-bottom: 0.25rem !important;
  font-size: 0.6875rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.05em !important;
  text-transform: uppercase !important;
  color: var(--ui-text-dimmed) !important;
  text-decoration: none !important;
  background: transparent !important;
  cursor: default !important;
}

body .nt-doofinder-layer .df-panel__content {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
}

body .nt-doofinder-layer .df-term {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 0.5rem !important;
  width: 100% !important;
  padding: 0.35rem 0.5rem !important;
  margin: 0 0 0.125rem !important;
  font-size: 0.8125rem !important;
  line-height: 1.3 !important;
  color: var(--ui-text) !important;
  background: transparent !important;
  border: 1px solid transparent !important;
  border-radius: 0.375rem !important;
  cursor: pointer !important;
  text-align: left !important;
}

body .nt-doofinder-layer .df-term:hover {
  background: var(--ui-bg-accented) !important;
  color: var(--ui-text-highlighted) !important;
}

body .nt-doofinder-layer .df-term__count {
  flex-shrink: 0 !important;
  font-size: 0.6875rem !important;
  color: var(--ui-text-dimmed) !important;
}

body .nt-doofinder-layer .df-term[data-selected] {
  background: var(--ui-primary) !important;
  border-color: var(--ui-primary) !important;
  color: #fff !important;
}

body .nt-doofinder-layer .df-term[data-selected] .df-term__count {
  color: rgb(255 255 255 / 0.85) !important;
}

body .nt-doofinder-layer button[data-toggle-extra-content] {
  display: inline-block !important;
  margin: 0.25rem 0.5rem 0.5rem !important;
  padding: 0 !important;
  font-size: 0.75rem !important;
  color: var(--ui-text-dimmed) !important;
  background: none !important;
  border: none !important;
  cursor: pointer !important;
  text-decoration: underline !important;
}

body .nt-doofinder-layer .df-slider .noUi-connect {
  background: var(--ui-primary) !important;
}

body .nt-doofinder-layer .df-slider .noUi-handle {
  border-color: var(--ui-primary) !important;
  background: var(--ui-bg) !important;
}

/* ── Cerrar: X simple (CSS ::after — Doofinder puede restaurar el SVG) ─── */
body .nt-doofinder-layer {
  position: fixed !important;
}

body .nt-doofinder-layer .nt-df-close,
body .nt-doofinder-layer [data-role="close"] {
  position: absolute !important;
  top: 0.625rem !important;
  right: 0.875rem !important;
  z-index: 5 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 2rem !important;
  height: 2rem !important;
  min-width: 2rem !important;
  min-height: 2rem !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: none !important;
  background-color: transparent !important;
  box-shadow: none !important;
  color: var(--ui-text-muted, #6b7280) !important;
  text-decoration: none !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  cursor: pointer !important;
  line-height: 1 !important;
  overflow: visible !important;
  font-size: 0 !important;
}

body .nt-doofinder-layer .nt-df-close::after,
body .nt-doofinder-layer [data-role="close"]::after {
  content: '×' !important;
  display: block !important;
  font-size: 1.75rem !important;
  font-weight: 300 !important;
  line-height: 1 !important;
  color: inherit !important;
  font-family: ui-sans-serif, system-ui, sans-serif !important;
  pointer-events: none !important;
}

body .nt-doofinder-layer .nt-df-close:hover,
body .nt-doofinder-layer [data-role="close"]:hover {
  color: var(--ui-text-highlighted, #111827) !important;
  background: none !important;
  box-shadow: none !important;
}

body .nt-doofinder-layer .nt-df-close svg,
body .nt-doofinder-layer [data-role="close"] svg,
body .nt-doofinder-layer .nt-df-close .nt-df-close__mark,
body .nt-doofinder-layer [data-role="close"] .nt-df-close__mark {
  display: none !important;
}

/* ── Móvil: sin panel de filtros (solo sugerencias + resultados) ─────────── */
@media (max-width: 1023px) {
  body .nt-doofinder-layer .df-aside,
  body .nt-doofinder-layer .df-aside__content,
  body .nt-doofinder-layer [data-role='aside'] {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    max-height: 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
  }
}
