/**
 * FLK - store map — module styles (no Tailwind).
 * Scoped under .flksc. Most of the appearance can be overridden by the style
 * controls in Elementor; below are reasonable defaults.
 */

.flksc {
  /* Neutral by default (black-white-gray). You add colors in the Elementor panel. */
  --flksc-accent: #333333;
  --flksc-border: #d0d0d0;
  --flksc-bg-active: #f0f0f0;
  --flksc-bg-hover: #f7f7f7;
  --flksc-text: #1a1a1a;
  --flksc-muted: #6b6b6b;
  --flksc-radius: 8px;
  --flksc-list-fr: 2fr;
  --flksc-map-fr: 3fr;
  width: 100%;
}

.flksc *,
.flksc *::before,
.flksc *::after { box-sizing: border-box; }

/* Grid: list | map. 1 column by default; layout controlled by modifiers. */
.flksc__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: stretch;
}

/* Order in 1 column: the map is controlled by the --flksc-map-order variable
   ("Order in 1 column" control): 0 = list first, -1 = map first. A variable,
   not a PHP class, so the Elementor preview updates live.
   In 2 columns overridden below by explicit order (higher specificity). */

/* Always two columns: fixed-height grid -> list scrolls, map fills.
   grid-template-rows: minmax(0,1fr) pins the row to the grid height,
   otherwise a long list stretches the row and "clips" instead of scrolling. */
.flksc--cols .flksc__grid {
  grid-template-columns: var(--flksc-list-fr, 2fr) var(--flksc-map-fr, 3fr);
  grid-template-rows: minmax(0, 1fr);
  height: var(--flksc-h, 520px);
}
.flksc--cols .flksc__panel { height: 100%; min-height: 0; order: 1; }
.flksc--cols .flksc__list { flex: 1 1 auto; max-height: none; }
.flksc--cols .flksc__mapwrap { height: 100%; min-height: 0; order: 2; }
.flksc--cols.flksc--map-left .flksc__mapwrap { order: 1; }
.flksc--cols.flksc--map-left .flksc__panel { order: 2; }

/* "auto" mode: full 2-column rules added inline in render() from a breakpoint.
   Single column ("stack") = default 1fr + list max-height (below). */

/* Left column panel */
.flksc__panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 0;
  min-width: 0;
}

/* Search field / selects */
.flksc__input,
.flksc__select {
  width: 100%;
  padding: 0.8rem 1rem;
  background: transparent;
  border: 1px solid var(--flksc-border);
  border-radius: var(--flksc-radius);
  color: var(--flksc-text);
  font-size: 1rem;
  outline-offset: 2px;
}
.flksc__input:focus-visible,
.flksc__select:focus-visible { outline: 2px solid var(--flksc-accent); }

/* Top bar: search + voivodeship */
.flksc__topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}
.flksc__topbar .flksc__searchform { flex: 1 1 14rem; min-width: 0; }
.flksc__topbar .flksc__select { flex: 0 1 14rem; min-width: 10rem; }
.flksc__topbar .flksc__combo { flex: 0 1 15rem; min-width: 11rem; }

/* "Always" 2-column layout: the list column is narrow, so search
   and voivodeship stack one under another, each at 100% (like on mobile).
   For "auto" mode analogous rules live in the widget's inline media query (above the breakpoint). */
.flksc--cols .flksc__topbar { flex-direction: column; align-items: stretch; }
.flksc--cols .flksc__topbar .flksc__searchform,
.flksc--cols .flksc__topbar .flksc__combo,
.flksc--cols .flksc__topbar .flksc__select { flex: none; width: 100%; min-width: 0; }

/* Voivodeship combobox (search field + list) */
.flksc__combo { position: relative; }
.flksc__combo-input { width: 100%; padding-right: 2rem; }

/* "Down" arrow signaling a dropdown list (like in a native <select>). */
.flksc__combo::after {
  content: "";
  position: absolute;
  right: 0.9rem;
  top: 50%;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid var(--flksc-muted);
  border-bottom: 2px solid var(--flksc-muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
  transition: transform 0.15s ease;
}
/* When the list is expanded the arrow rotates "up". */
.flksc__combo:has(.flksc__combo-list:not([hidden]))::after {
  transform: translateY(-30%) rotate(-135deg);
}
/* When a voivodeship is selected, the "×" button takes the spot — we hide the arrow. */
.flksc__combo.is-selected::after { display: none; }

/* "×" button clearing the voivodeship. Resets the theme's aggressive button style
   (blue round background, border, shadow, min-width/height, padding) — otherwise "×"
   turns into a big colored button. Raised specificity + `!important`. */
.flksc .flksc__combo-clear {
  position: absolute; right: 0.5rem; top: 50%;
  transform: translateY(-50%);
  display: none;
  width: auto !important;
  min-width: 0 !important;
  height: auto !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0.15rem 0.35rem !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  text-shadow: none !important;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  color: var(--flksc-muted) !important;
}
.flksc .flksc__combo-clear:hover,
.flksc .flksc__combo-clear:focus {
  background: transparent !important;
  color: var(--flksc-text) !important;
  box-shadow: none !important;
}
.flksc__combo.is-selected .flksc__combo-clear { display: block; }
.flksc__combo-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: 100%;
  margin: 2px 0 0; padding: 0.25rem; list-style: none;
  background: #fff; border: 1px solid var(--flksc-border);
  border-radius: var(--flksc-radius);
  max-height: 260px; overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.flksc__combo-list[hidden] { display: none; }
.flksc__combo-opt { padding: 0.5rem 0.6rem; cursor: pointer; border-radius: 2px; }
.flksc__combo-opt.is-hidden { display: none; }
.flksc__combo-opt:hover,
.flksc__combo-opt.is-active { background: var(--flksc-bg-active); }

/* Category filter bar */
.flksc__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}
.flksc__filters .flksc__select { width: 100%; }

/* Responsive: on narrow screens filters full width, one under another */
@media (max-width: 600px) {
  .flksc__topbar { flex-direction: column; align-items: stretch; }
  .flksc__topbar .flksc__searchform,
  .flksc__topbar .flksc__combo,
  .flksc__topbar .flksc__select { flex: none; width: 100%; min-width: 0; }
}

.flksc__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.flksc__chip {
  padding: 0.35rem 0.85rem;
  background: transparent;
  border: 1px solid var(--flksc-border);
  border-radius: 999px;
  color: var(--flksc-text);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.flksc__chip:hover { border-color: var(--flksc-accent); }
.flksc__chip.is-active {
  background: var(--flksc-accent);
  border-color: var(--flksc-accent);
  color: #fff;
}

/* Scrollable list. In 1 column limited to --flksc-list-h (default 70vh,
   controllable via the "List height" control per device); in 2 col. height = map
   (max-height:none overridden in .flksc--cols rules and in the "auto" mode inline media). */
.flksc__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  min-height: 0;
  max-height: var(--flksc-list-h, 70vh);
  padding-right: 0.25rem;
}
.flksc__list::-webkit-scrollbar { width: 6px; }
.flksc__list::-webkit-scrollbar-thumb { background: var(--flksc-border); border-radius: 3px; }

/* Bottom fade — scroll affordance when more items are below. Toggled by JS
   (.flksc__list--more). Matters on mobile, where the scrollbar is hidden (overlay)
   and the list would otherwise look non-scrollable. Sticky pseudo-element pinned to
   the bottom of the scroll viewport; negative margin so it overlays instead of
   adding scroll height. */
.flksc__list { position: relative; }
.flksc__list::after {
  content: "";
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  flex: 0 0 auto;
  height: 28px;
  margin-top: -28px;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0), var(--flksc-list-fade, rgba(0, 0, 0, 0.08)));
  opacity: 0;
  transition: opacity 0.2s ease;
}
.flksc__list--more::after { opacity: 1; }

/* No results message */
.flksc__empty {
  margin: 0.5rem 0.25rem;
  padding: 0.75rem 1rem;
  border: 1px dashed var(--flksc-border);
  color: var(--flksc-muted);
  font-size: 0.9rem;
  text-align: center;
}
.flksc__empty[hidden] { display: none; }

/* flex:0 0 auto — items do NOT shrink in the list column; instead of squeezing
   (and clipping the address) they overflow the container and the list enables scroll. */
.flksc__item { display: flex; width: 100%; flex: 0 0 auto; }
.flksc__item.is-hidden { display: none; }
.flksc__item.active { background: var(--flksc-bg-active); }
/* Hover after the .active rule — on a specificity tie hover wins (feedback also on the active one). */
.flksc__item:hover { background: var(--flksc-bg-hover); }

.flksc__itembtn {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  width: 100%;
  padding: 0.6rem;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
  color: inherit;
}
/* Neutralize the default button appearance from the theme / Elementor kit (global
   `button` / `button:hover`), which would otherwise paint the item background (e.g. blue),
   add a border, shadow or rounding and change the text color. We raise specificity
   (`.flksc .flksc__itembtn`) and force `!important`, because aggressive themes override
   even a class rule. We keep the item background on `.flksc__item` (control-driven),
   name colors — on the `.flksc__title` controls. */
.flksc .flksc__itembtn,
.flksc .flksc__itembtn:hover,
.flksc .flksc__itembtn:focus,
.flksc .flksc__itembtn:active {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: inherit;
  text-shadow: none;
}
.flksc .flksc__itembtn:focus-visible { outline: 2px solid var(--flksc-accent); }

.flksc__pin {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  color: var(--flksc-accent);
  transition: transform 0.3s ease;
}
.flksc__itembtn:hover .flksc__pin { transform: scale(1.1); }

.flksc__itemtext { display: block; flex: 1 1 auto; min-width: 0; }

.flksc__title {
  display: block;
  font-weight: 700;
  color: var(--flksc-text);
  line-height: 1.2;
}
.flksc__itembtn:hover .flksc__title { color: var(--flksc-accent); }
/* Active item name — accent by default (like hover); overridable via control. */
.flksc__item.active .flksc__title { color: var(--flksc-accent); }

.flksc__addr {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.85rem;
  color: var(--flksc-muted);
}

/* Contact details */
.flksc__meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: var(--flksc-muted);
}
.flksc__meta a { color: var(--flksc-accent); text-decoration: none; }
.flksc__meta a:hover { text-decoration: underline; }
.flksc__hours { white-space: normal; }

/* Map */
.flksc__mapwrap {
  position: relative;
  width: 100%;
  min-height: 460px;
  order: var(--flksc-map-order, 0);
}
.flksc__map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #e9e6df;
}

/* Cluster count bubble (HTML marker) */
.flksc__cluster {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.45), 0 1px 4px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s ease;
  -webkit-user-select: none;
  user-select: none;
}
.flksc__cluster:hover {
  transform: scale(1.08);
}

/* Popup */
.flksc-popup__name {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--flksc-accent);
}
.flksc-popup__addr,
.flksc-popup__meta {
  font-size: 0.68rem;
  color: var(--flksc-muted);
}
/* Clickable contact links inside the popup — accent color instead of the browser
   default blue, mirroring the list's link styling. */
.flksc-popup__meta a {
  color: var(--flksc-accent);
  text-decoration: none;
}
.flksc-popup__meta a:hover {
  text-decoration: underline;
}

/* Pinned popup (shown when a point is selected): give the address room and a
   readable close button. Raised specificity + !important — the theme's global
   button rules otherwise override the MapLibre close button. */
.flksc .flksc-popup--pinned .maplibregl-popup-content {
  padding-right: 1.6rem;
}
.flksc .flksc-popup--pinned .maplibregl-popup-close-button {
  width: 1.4rem !important;
  height: 1.4rem !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--flksc-muted, #666) !important;
  font-size: 1rem !important;
  line-height: 1.4rem !important;
  cursor: pointer;
}
.flksc .flksc-popup--pinned .maplibregl-popup-close-button:hover {
  background: transparent !important;
  color: var(--flksc-accent, #000) !important;
}
