.zba-nearby { display:block; }
.zba-nearby .zba-panel{ border:1px solid rgba(127,127,127,.25); border-radius:12px; padding:12px; }
.zba-nearby .zba-btn{ padding:10px 12px; border-radius:10px; border:1px solid rgba(127,127,127,.35); background:transparent; cursor:pointer; }
.zba-nearby .zba-input{ flex:1; padding:10px 12px; border-radius:10px; border:1px solid rgba(127,127,127,.35); }
.zba-nearby .zba-results{ margin-top:12px; display:grid; gap:10px; }
.zba-nearby .zba-card{ padding:10px 12px; border:1px solid rgba(127,127,127,.25); border-radius:12px; }
.zba-nearby .zba-tag{ display:inline-block; font-size:.85em; opacity:.85; margin-bottom:6px; }
.zba-nearby .zba-title a{ font-weight:650; text-decoration:none; }
.zba-nearby .zba-title a:hover{ text-decoration:underline; }
.zba-nearby .zba-org, .zba-nearby .zba-text, .zba-nearby .zba-when, .zba-nearby .zba-where{ opacity:.85; margin-top:4px; }
.zba-nearby .zba-cta{ margin-top:10px; }
.zba-nearby .zba-cta a{ display:inline-block; padding:10px 12px; border-radius:10px; border:1px solid rgba(127,127,127,.35); text-decoration:none; }


/* Autocomplete keyboard selection */
.zba-active { outline: 2px solid currentColor; }


.zba-muni-wrap{ position: relative; }

/* Autocomplete dropdown (custom list) - UIkit 3 friendly */
.zba-muni-wrap{ position: relative; }

/* Overlay under input, styled to match UIkit cards/dropdowns */
.zba-autocomplete{
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 99999;

  /* UIkit-ish dropdown look */
  background: #fff;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 4px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.08);

  list-style: none;
  margin: 0;
  padding: 4px 0;

  max-height: 16rem;
  overflow: auto;
}

.zba-autocomplete li{
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
}

.zba-autocomplete li:hover{
  background: rgba(0,0,0,0.04);
}

.zba-autocomplete li.zba-active{
  background: rgba(30,135,240,0.12); /* UIkit primary-ish highlight */
  outline: none;
}


/* Tom Select tweaks for the municipality selector */
.zba-nearby .ts-wrapper{ width: 100%; }


/* Tom Select: keep dropdown directly under the control */
.zba-nearby .ts-wrapper{ position: relative; width: 100%; }
.zba-nearby .ts-dropdown{
  left: 0 !important;
  right: auto !important;
  width: 100% !important;
}


/* Tom Select: force dropdown under the control (even inside flex layouts) */
.zba-nearby .ts-wrapper{
  position: relative !important;
  width: 100% !important;
  display: block !important;
  flex: 1 1 auto !important;
}
.zba-nearby .ts-control{
  width: 100% !important;
  box-sizing: border-box;
}
.zba-nearby .ts-dropdown{
  position: absolute !important;
  top: 100% !important;
  left: 0 !important;
  right: auto !important;
  width: 100% !important;
  transform: none !important;
}


/* Preserve line breaks in info_text */
.zba-text{ white-space: pre-line; }


/* Autocomplete markerad rad (piltangenter) */
.zba-autocomplete li.zba-active,
.ts-dropdown .option.active{
  background: rgba(0, 0, 0, 0.08);
  border-radius: 6px;
  outline: none;
}

/* Hover-effekt */
.zba-autocomplete li:hover,
.ts-dropdown .option:hover{
  background: rgba(0, 0, 0, 0.05);
}

/* Mjukare känsla */
.zba-autocomplete li,
.ts-dropdown .option{
  transition: background 0.12s ease;
  padding: 0.5rem 0.75rem;
}


/* Tom Select: force dropdown under the control (scoped to this plugin instance) */
.zba-ts{ position: relative !important; width: 100% !important; display: block !important; }
.zba-ts .ts-control{ width: 100% !important; box-sizing: border-box; }

.zba-ts-dropdown{
  left: 0 !important;
  right: auto !important;
  width: 100% !important;
  transform: none !important;
}


/* OpenStreetMap/Leaflet container */
.zba-map{ width: 100%; border-radius: 10px; overflow: hidden; }

/* Event page: ensure Leaflet map has height */
[data-zba-event-map].zba-map{
  height: 420px;
  min-height: 320px;
}
@media (max-width: 959px){
  [data-zba-event-map].zba-map{ height: 320px; }
}



/* Layout: list left, map right (YOOtheme/UIkit) */
.zba-grid .zba-map{ height: 520px; }
@media (max-width: 959px){
  .zba-grid .zba-map{ height: 360px; }
}

/* Map: subtle pulse for user location ring */
.leaflet-interactive.zba-you-pulse{
  transform-box: fill-box;
  transform-origin: center;
  animation: zbaYouPulse 1.8s ease-in-out infinite;
}
@keyframes zbaYouPulse{
  0%{ transform: scale(1); opacity: 1; }
  50%{ transform: scale(1.35); opacity: .55; }
  100%{ transform: scale(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce){
  .leaflet-interactive.zba-you-pulse{ animation: none; }
}

/* Map popup */
.zba-map-popup{
  font-family: 'Libre Franklin', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 12px;
  line-height: 1.35;
  min-width: 220px;
}
.zba-map-popup__title{
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 8px;
}
.zba-map-popup__cover{
  margin: 0 0 8px;
  border-radius: 10px;
  overflow: hidden;
}
.zba-map-popup__cover img{
  display: block;
  width: 100%;
  height: 86px;
  object-fit: cover;
}
.zba-map-popup__when,
.zba-map-popup__where{
  margin: 0 0 4px;
}
.zba-map-popup__when:empty,
.zba-map-popup__where:empty,
.zba-map-popup__cover:empty{
  display:none;
}
.zba-map-popup__cta{
  margin-top: 8px;
}
.zba-map-popup__cta a{
  text-decoration: underline;
  font-size: 14px;
}


/* Map: halo ring should not steal clicks */
.zba-you-halo{ pointer-events: none; }


/* ------------------------------------------------------------
   ZBA (Nearby) UIkit notification styling
   ------------------------------------------------------------
   Goal: keep using UIkit.notification(), but make the message
   look like a compact card. We scope primarily via the chosen
   position (top-center) + the presence of our inner markup.
*/



/* ZBA (Nearby) local overlay notice
   We render notices INSIDE the plugin root ([data-zba-root]) so positioning stays stable
   regardless of theme containers, sticky headers, admin bars, etc.
------------------------------------------------------------ */

/* Ensure the root is a positioning context */
[data-zba-root]{ position: relative; }

/* Overlay wrapper (centered within the plugin width) */
[data-zba-root] .zba-overlay-notice-wrap{
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  z-index: 50;
  width: min(420px, calc(100% - 32px));
  pointer-events: none;
  opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
}

@media (max-width: 640px){
  [data-zba-root] .zba-overlay-notice-wrap{
    top: 8px;
    width: calc(100% - 24px);
  }
}

@media (prefers-reduced-motion: reduce){
  [data-zba-root] .zba-overlay-notice-wrap{ transition: none !important; }
}

[data-zba-root] .zba-overlay-notice-wrap.is-visible{
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Notice "card" */
[data-zba-root] .zba-nearby-notice{
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(0,0,0,.12);
  border: 1px solid rgba(0,0,0,.08);

  display: flex;
  align-items: flex-start;
  gap: 10px;

  color: rgba(0,0,0,.82);
  font-size: 14px;
  line-height: 1.35;
  font-weight: 600;

  pointer-events: auto;
}

[data-zba-root] .zba-nearby-notice__text{ display:block; }

[data-zba-root] .zba-nearby-notice__dot{
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 4px;
  flex: 0 0 10px;
  background: rgba(0,0,0,.28);
}

[data-zba-root] .zba-nearby-notice--warning .zba-nearby-notice__dot{
  background: rgba(0,0,0,.28);
}

/* ------------------------------------------------------------
   Loading UI: Skeleton list + map placeholder
   ------------------------------------------------------------ */
/* Skeleton list container */
.zba-nearby .zba-skel-list{ display:block; }
.zba-nearby .zba-skel-card{
  display:flex;
  align-items:center;
  gap:12px;
  padding:12px;
  margin:8px 0;
  border-radius:10px;
  background: rgba(0,0,0,.03);
  animation: zbaPulse 1.2s ease-in-out infinite;
}

.zba-nearby .zba-skel-date{
  width:64px;
  height:44px;
  border-radius:8px;
  background: rgba(0,0,0,.06);
  flex: 0 0 64px;
}

.zba-nearby .zba-skel-body{ flex: 1 1 auto; }
.zba-nearby .zba-skel-line{
  height:10px;
  border-radius:6px;
  background: rgba(0,0,0,.06);
  margin:8px 0;
}
.zba-nearby .zba-skel-line--title{ height:12px; width:70%; }
.zba-nearby .zba-skel-line--short{ width:45%; }

.zba-nearby .zba-skel-cta{
  width:84px;
  height:30px;
  border-radius:999px;
  background: rgba(0,0,0,.06);
  flex: 0 0 auto;
}

@keyframes zbaPulse{
  0%, 100% { opacity: .75; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce){
  .zba-nearby .zba-skel-card{ animation: none !important; }
}

/* Map placeholder overlay (shimmer + small loader) */
.zba-nearby [data-zba-map]{ position: relative; }
.zba-nearby .zba-map-loader{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  pointer-events:none;
}

.zba-nearby .zba-map-shimmer{
  position:absolute;
  inset:0;
  background: linear-gradient(90deg,
    rgba(0,0,0,.05) 0%,
    rgba(0,0,0,.08) 40%,
    rgba(0,0,0,.05) 80%
  );
  background-size: 200% 100%;
  animation: zbaShimmer 1.4s ease-in-out infinite;
}

.zba-nearby .zba-loader{
  width:22px;
  height:22px;
  border-radius:50%;
  border:2px solid rgba(0,0,0,.18);
  border-top-color: rgba(0,0,0,.45);
  animation: zbaSpin .8s linear infinite;
  position: relative;
  z-index: 1;
}

@keyframes zbaShimmer{
  0%{ background-position: 200% 0; }
  100%{ background-position: -200% 0; }
}

@keyframes zbaSpin{
  0%{ transform: rotate(0deg); }
  100%{ transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce){
  .zba-nearby .zba-map-shimmer{ animation: none !important; }
  .zba-nearby .zba-loader{ animation: none !important; }
}

/* Mini spinner used inside the geo icon button */
.zba-nearby .zba-mini-spinner{
  width:16px;
  height:16px;
  border-radius:50%;
  border:2px solid rgba(0,0,0,.18);
  border-top-color: rgba(0,0,0,.45);
  animation: zbaSpin .8s linear infinite;
  display:inline-block;
}

@media (prefers-reduced-motion: reduce){
  .zba-nearby .zba-mini-spinner{ animation: none !important; }
}



/* Map attribution toggle button (Leaflet) */
.zba-attrib-toggle{
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.15);
  background: rgba(255,255,255,.9);
  color: rgba(0,0,0,.7);
  font-weight: 700;
  line-height: 26px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.zba-attrib-toggle:hover{ background: #fff; }

@media (max-width: 640px) {
  .uk-input, .uk-textarea, .uk-select {
    font-size: 16px !important;
  }
}

/* Move attribution/info button slightly left for better alignment with map controls */
.leaflet-top.leaflet-right .zba-attrib-toggle {
  margin-right: 8px;
}

/* Align attribution/info button with the other Leaflet controls */
.leaflet-top.leaflet-right .zba-attrib-toggle {
  margin-right: 11px;
  width: 30px;
  height: 30px;
  box-sizing: border-box;
}
