/*
 * Estilos públicos de la grilla de locales.
 * Selectores acotados a .grilla-locales-wrapper para no afectar widgets de Elementor.
 */

.grilla-locales-wrapper {
  box-sizing: border-box;
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 8px;
  padding-right: 8px;
}

.grilla-locales-wrapper *,
.grilla-locales-wrapper *::before,
.grilla-locales-wrapper *::after {
  box-sizing: border-box;
}

/* Buscador: fuera del área con scroll */
.grilla-locales-wrapper .grilla-locales-buscador {
  margin: 0 0 14px;
  width: 100%;
}

.grilla-locales-wrapper .grilla-locales-busqueda {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 44px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid #888;
  background: #363636;
  color: #fff;
  font-size: 1em;
  line-height: 1.3;
  outline: none;
}

.grilla-locales-wrapper .grilla-locales-busqueda::placeholder {
  color: #c8c8c8;
}

.grilla-locales-wrapper .grilla-locales-busqueda:focus {
  border-color: #ffdfd2;
}

@media (min-width: 769px) {
  .grilla-locales-wrapper .grilla-locales-busqueda {
    max-width: 420px;
  }
}

/* Filtros: una sola fila en desktop/tablet; ocultos en mobile */
.grilla-locales-wrapper .grilla-locales-filtros {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  margin: 0 0 16px;
  padding: 0;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.grilla-locales-wrapper .grilla-locales-filtro-chip,
.grilla-locales-wrapper .filtro-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 6px 8px;
  border: none;
  border-radius: 8px;
  background: #656565;
  color: #ffffff;
  font-size: clamp(0.68em, 0.95vw, 0.84em);
  line-height: 1.2;
  white-space: nowrap;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.grilla-locales-wrapper .grilla-locales-filtro-chip:hover,
.grilla-locales-wrapper .grilla-locales-filtro-chip:focus,
.grilla-locales-wrapper .filtro-chip:hover,
.grilla-locales-wrapper .filtro-chip:focus {
  background: #757575;
  color: #ffffff;
}

.grilla-locales-wrapper .grilla-locales-filtro-chip.filtro-activo,
.grilla-locales-wrapper .filtro-chip.filtro-activo {
  background: #ffdfd2;
  color: #ffffff;
}

@media (max-width: 768px) {
  .grilla-locales-wrapper .grilla-locales-filtros {
    display: none;
  }
}

/*
 * Contenedor con scroll interno (desktop, tablet y mobile).
 * La altura exacta de 2 filas la calcula el JS midiendo tarjetas + gap.
 */
.grilla-locales-wrapper .grilla-locales-scroll {
  width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

.grilla-locales-wrapper .grilla-locales-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
  width: 100%;
}

@media (max-width: 1024px) and (min-width: 769px) {
  .grilla-locales-wrapper .grilla-locales-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }
}

@media (max-width: 768px) {
  .grilla-locales-wrapper {
    padding-left: 4px;
    padding-right: 4px;
  }

  .grilla-locales-wrapper .grilla-locales-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
}

/*
 * Tarjeta: el fondo negro permanente venía de background: #222
 * en .grilla-locales-card. Estado normal = transparente.
 */
.grilla-locales-wrapper .grilla-locales-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 8px;
  overflow: hidden;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #fff;
  text-align: center;
  box-shadow: none;
  cursor: pointer;
}

.grilla-locales-wrapper .grilla-locales-card:hover,
.grilla-locales-wrapper .grilla-locales-card:focus-within {
  box-shadow: none;
  background: transparent;
}

/*
 * .logo es el contexto de posicionamiento del overlay (.info).
 * Debe envolver la imagen para que inset:0 coincida con el área visual.
 */
.grilla-locales-wrapper .grilla-locales-card .logo {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 78%;
  margin: 0;
  background: transparent;
}

.grilla-locales-wrapper .grilla-locales-card .logo img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  margin: 0 auto;
  object-fit: contain;
  aspect-ratio: auto;
  border-radius: 8px;
  transition: filter 0.25s ease;
}

.grilla-locales-wrapper .grilla-locales-card .info {
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  margin: 0;
  padding: 8px;
  color: #fff;
  font-size: 0.82em;
  line-height: 1.25;
  text-align: center;
  transform: none;
}

.grilla-locales-wrapper .grilla-locales-card .info strong,
.grilla-locales-wrapper .grilla-locales-card .info span,
.grilla-locales-wrapper .grilla-locales-card .info a {
  display: block;
  max-width: 100%;
  margin: 0;
  word-break: break-word;
}

.grilla-locales-wrapper .grilla-locales-card .info strong {
  font-size: 1.02em;
  line-height: 1.2;
}

.grilla-locales-wrapper .grilla-locales-card .info span,
.grilla-locales-wrapper .grilla-locales-card .info a {
  font-size: 0.9em;
  line-height: 1.2;
  color: #fff;
}

/* Desktop con puntero fino: overlay anclado al área del logo/imagen */
@media (hover: hover) and (pointer: fine) {
  .grilla-locales-wrapper .grilla-locales-card {
    justify-content: center;
    align-items: center;
    aspect-ratio: 1 / 1;
    padding: 12px;
  }

  .grilla-locales-wrapper .grilla-locales-card .logo {
    flex: 0 1 auto;
    width: auto;
    max-width: 78%;
    max-height: 78%;
    height: auto;
  }

  .grilla-locales-wrapper .grilla-locales-card .logo img {
    max-width: 100%;
    max-height: 100%;
  }

  .grilla-locales-wrapper .grilla-locales-card .info {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    box-sizing: border-box;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(34, 34, 34, 0.96);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .grilla-locales-wrapper .grilla-locales-card:hover .info,
  .grilla-locales-wrapper .grilla-locales-card:focus-within .info {
    opacity: 1;
    pointer-events: auto;
  }

  .grilla-locales-wrapper .grilla-locales-card:hover .logo img,
  .grilla-locales-wrapper .grilla-locales-card:focus-within .logo img {
    filter: blur(1.5px) grayscale(70%);
  }
}

/* Táctil: info visible bajo la imagen (sin overlay sticky) */
@media (hover: none), (pointer: coarse) {
  .grilla-locales-wrapper .grilla-locales-card .logo {
    width: 100%;
    max-width: 78%;
  }

  .grilla-locales-wrapper .grilla-locales-card .info {
    position: static;
    width: 100%;
    padding: 8px 2px 2px;
    background: transparent;
    opacity: 1;
    pointer-events: auto;
  }

  .grilla-locales-wrapper .grilla-locales-card .logo img {
    filter: none;
  }
}

@media (max-width: 768px) {
  .grilla-locales-wrapper .grilla-locales-card {
    padding: 8px;
    border-radius: 8px;
  }

  .grilla-locales-wrapper .grilla-locales-card .info {
    font-size: 0.78em;
  }
}
