/* /css/map.css — mapa, toolbar, kontrolka w rogu, tryb "Postaw pinezkę", wspólne style popupów */

.map-screen {
  max-width: 1100px;
  margin: 24px auto 80px;
  padding: 0 16px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.map-frame {
  width: 100%;
  height: 70vh;
  min-height: 460px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(0,0,0,.16);
  border: 1px solid #e8e8e8;
  position: relative;

  /* ====== TUNING POZYCJI PRZYCISKU ALGO (gdy jest w MapLibre controls) ====== */
  /* Tylko to zmieniasz, żeby przesuwać SAM przycisk algorytmu */
  --algo-shift-x: -30px;  /* ujemne = w lewo, dodatnie = w prawo */
  --algo-shift-y: 10px;    /* dodatnie = w dół, ujemne = w górę */

  /* Fallback pozycja (gdyby JS nie przeniósł przycisku do kontrolek mapy) */
  --algo-fallback-top: 10px;
  --algo-fallback-right: 10px;
}

/* Toolbar */
.map-toolbar {
  margin: 14px 0 24px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.map-toolbar .searchbox { 
  display: flex; 
  gap: 8px; 
  align-items: center; 
  flex: 1; 
}
.map-toolbar input[type="text"] {
  flex: 1; 
  min-width: 260px; 
  padding: 9px 10px; 
  border: 1px solid #ddd; 
  border-radius: 10px; 
  outline: none;
}
.map-toolbar input[type="text"]:focus { 
  border-color: #888; 
}

/* Ogólne przyciski na mapie */
.btn {
  appearance: none; 
  border: 1px solid #ddd; 
  background: #fff; 
  padding: 9px 12px; 
  border-radius: 10px; 
  cursor: pointer;
  transition: transform .12s ease, background .12s ease, box-shadow .12s ease;
  font-size: 14px;
}
.btn:hover { 
  background: #f6f6f6; 
  box-shadow: 0 2px 6px rgba(0,0,0,.06); 
}
.btn:active { 
  transform: translateY(1px); 
  box-shadow: none; 
}
.btn-geo  { 
  border-color: #cdd9ff; 
}
.btn-ghost{ 
  background: #f7f7f7; 
  border-color: #e3e3e3; 
  padding: 8px 10px; 
}

/* ============ KONTROLKA: 3 przyciski w lewym górnym rogu mapy ============ */
.map-report-ctrl {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 10;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-report-btn {
  height: 46px;
  min-width: 52px;
  width: 52px;
  border-radius: 999px;
  border: 2px solid transparent;
  background: #E43D30; /* domyślna wartość – warianty poniżej i tak nadpisują */
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px 0 12px;
  overflow: hidden;
  white-space: nowrap;
  cursor: pointer;
  transition:
    width .25s cubic-bezier(.2,.8,.2,1),
    border-radius .25s cubic-bezier(.2,.8,.2,1),
    background .18s ease,
    box-shadow .18s ease,
    transform .12s ease;
  box-shadow: 0 8px 18px rgba(0,0,0,.10);
}

.map-report-btn .ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  color: inherit;
  flex: 0 0 auto;
  margin-left: 2px;
}

.map-report-btn .lb {
  font-weight: 700;
  opacity: 0;
  transform: translateX(8px);
  transition: opacity .18s ease, transform .18s ease;
  font-size: 14px;
}

/* Rozwijanie przy hover/focus – wspólne dla wszystkich */
.map-report-btn:hover,
.map-report-btn:focus-visible {
  width: 260px;
  border-radius: 14px;
  outline: none;
}

.map-report-btn:hover .lb,
.map-report-btn:focus-visible .lb {
  opacity: 1;
  transform: translateX(0);
}

/* Wariant 1: Zgłoś zaginięcie – delikatny czerwony */
.map-report-btn--lost {
  background: #FDE0DC;
  color: #B71C1C;
  border-color: #F8BBD0;
  box-shadow: 0 8px 18px rgba(244, 67, 54, .25);
}
.map-report-btn--lost:hover,
.map-report-btn--lost:focus-visible {
  background: #F8BBD0;
}

/* Wariant 2: Zgłoś znalezienie – lekko zielony */
.map-report-btn--found {
  background: #E8F5E9;
  color: #1B5E20;
  border-color: #A5D6A7;
  box-shadow: 0 8px 18px rgba(46, 125, 50, .25);
}
.map-report-btn--found:hover,
.map-report-btn--found:focus-visible {
  background: #C8E6C9;
}

/* Wariant 3: Szukaj w zaginionych – lekko złoty */
.map-report-btn--search {
  background: #FFF8E1;
  color: #8D6E14;
  border-color: #FFE082;
  box-shadow: 0 8px 18px rgba(251, 192, 45, .25);
}
.map-report-btn--search:hover,
.map-report-btn--search:focus-visible {
  background: #FFECB3;
}

/* Mobilki – trochę mniejsze rozwinięcie */
@media (max-width: 640px) {
  .map-report-btn:hover,
  .map-report-btn:focus-visible {
    width: 220px;
  }
}

/* ============ Tryb "Postaw pinezkę" ============ */
.cursor-crosshair { 
  cursor: crosshair !important; 
}
.placing-hint {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,.95);
  color: #333;
  border: 1px solid #e5e5e5;
  border-radius: 999px;
  padding: 6px 12px;
  box-shadow: 0 8px 18px rgba(0,0,0,.12);
  font-size: 13px;
  z-index: 9;
}

/* "Gotowe?" obok markera */
.pin-done-wrap { 
  pointer-events: auto; 
}
.pin-done-btn {
  appearance: none;
  border: 1px solid #dcdcdc;
  background: #ffffff;
  color: #111;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0,0,0,.12);
  font-weight: 600;
  font-size: 13px;
}
.pin-done-btn:hover { 
  background: #f6f6f6; 
}

/* Znacznik mini po zapisie */
.dot-marker {
  width: 14px;
  height: 14px;
  background: #E43D30;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(0,0,0,.35);
  display: inline-block;
}

/* ============ Wspólne style popupów maplibre ============ */

/* ZAWSZE NAD WSZYSTKIM */
.maplibregl-popup {
  z-index: 2147483647 !important;
}

/* Domyślny wrapper — zerujemy padding i tło, bo własne cardy mają swoje */
.maplibregl-popup-content {
  padding: 0 !important;
  background: transparent !important;
  border-radius: 14px !important;
  box-shadow: none !important;
  overflow: visible !important;
}

/* Domyślna "strzałka" popupa */
.maplibregl-popup-tip {
  border-top-color: #ffffff !important;
  border-bottom-color: #ffffff !important;
}

/* Przycisk zamknięcia — subtelny i nie koliduje z obrazkiem */
.maplibregl-popup-close-button {
  right: 6px;
  top: 6px;
  width: 28px;
  height: 28px;
  line-height: 26px;
  background: rgba(255,255,255,0.9);
  border-radius: 50%;
  color: #333;
  font-size: 18px;
  border: 1px solid #e9e9e9;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.maplibregl-popup-close-button:hover {
  background: #fff;
}

/* ============ ANIMALS TICKER (nad mapą) ============ */
.animals-ticker{
  margin: 10px 0 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 840px){
  .animals-ticker{ grid-template-columns: 1fr; }
}

.ticker-card{
  --surface: #ffffff;
  --border: rgba(0,0,0,.08);
  --shadow: 0 10px 24px rgba(0,0,0,.10);
  --prog-bg: rgba(0,0,0,.08);
  --prog-color: rgba(0,0,0,.35);

  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 12px 12px 12px;
  cursor: pointer;
  user-select: none;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
  outline: none;
}

.ticker-card:hover{
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(0,0,0,.12);
}

.ticker-card:focus-visible{
  box-shadow: 0 0 0 3px rgba(0,0,0,.12), 0 14px 30px rgba(0,0,0,.12);
}

.ticker-card--lost{
  --surface: #fff7f6;
  --border: rgba(228,61,48,.20);
  --prog-bg: rgba(228,61,48,.18);
  --prog-color: #e43d30;
}

.ticker-card--found{
  --surface: #f6fff8;
  --border: rgba(27,94,32,.18);
  --prog-bg: rgba(46,125,50,.16);
  --prog-color: #2e7d32;
}

.ticker-top{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.ticker-badge{
  font-weight: 800;
  letter-spacing: .6px;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,.06);
}

.ticker-card--lost .ticker-badge{
  background: rgba(228,61,48,.14);
  color: #9f1b12;
}
.ticker-card--found .ticker-badge{
  background: rgba(46,125,50,.14);
  color: #155a1e;
}

.ticker-meta{
  display:flex;
  align-items:center;
  gap: 10px;
  color: rgba(0,0,0,.62);
  font-size: 13px;
}

.ticker-time{
  white-space: nowrap;
}

.ticker-main{
  display:flex;
  align-items:center;
  gap: 10px;
}

.ticker-img{
  width: 54px;
  height: 54px;
  border-radius: 14px;
  object-fit: cover;
  background: rgba(0,0,0,.06);
  border: 1px solid rgba(0,0,0,.06);
  flex: 0 0 auto;
}

.ticker-text{
  min-width: 0;
}

.ticker-title{
  font-weight: 800;
  font-size: 14px;
  color: rgba(0,0,0,.86);
  line-height: 1.25;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.ticker-desc{
  font-size: 13px;
  color: rgba(0,0,0,.66);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Animacja zmiany wpisu */
.ticker-card[data-anim="out"] .ticker-main{
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .18s ease, transform .18s ease;
}
.ticker-card[data-anim="in"] .ticker-main{
  opacity: 1;
  transform: translateY(0);
  transition: opacity .22s ease, transform .22s ease;
}

/* Progress ring */
.ticker-progress{
  --angle: 0deg;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: conic-gradient(var(--prog-color) var(--angle), var(--prog-bg) 0);
  position: relative;
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
}

.ticker-progress::after{
  content:"";
  position:absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.05);
}

/* ============ ALGO INFO (ikonka + treść modala) ============ */

/* Fallback: gdyby JS NIE przeniósł przycisku do MapLibre controls */
.map-algo-ctrl{
  position: absolute;
  top: var(--algo-fallback-top);
  right: var(--algo-fallback-right);
  z-index: 11;
  pointer-events: auto;
}

/* Gdy przycisk jest w MapLibre controls — ta grupa ma być “przezroczysta” */
.algo-maplibre-group{
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  overflow: visible !important;
}

/* Przycisk: większy + lekki puls */
.map-algo-info-btn{
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 1px solid #cfe0ff;
  background: #eaf3ff;
  color: #0b67c7;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(0,0,0,.10);
  transition: transform .12s ease, background .12s ease, box-shadow .12s ease;
  position: relative;
  isolation: isolate;
}

.map-algo-info-btn:hover{
  background: #dcebff;
  box-shadow: 0 8px 18px rgba(0,0,0,.12);
}

.map-algo-info-btn:active{
  transform: translateY(1px);
  box-shadow: none;
}

.map-algo-info-btn:focus-visible{
  outline: none;
  box-shadow: 0 0 0 3px rgba(0,0,0,.12), 0 8px 18px rgba(0,0,0,.12);
}

/* Ikona większa */
.map-algo-info-btn svg{
  width: 34px;
  height: 34px;
  display: block;
}

/* Puls — delikatny “ring” */
.map-algo-info-btn::after{
  content:"";
  position: absolute;
  inset: -8px;
  border-radius: 999px;
  background: rgba(11, 103, 199, .18);
  opacity: 0;
  transform: scale(.85);
  z-index: -1;
  pointer-events: none;
  animation: algoPulse 2.4s ease-out infinite;
}

@keyframes algoPulse{
  0%   { opacity: 0;   transform: scale(.86); }
  18%  { opacity: .32; transform: scale(1.00); }
  100% { opacity: 0;   transform: scale(1.32); }
}

@media (prefers-reduced-motion: reduce){
  .map-algo-info-btn::after{ animation: none; }
}


/* ============ ALGO: obok NavigationControl (top-right) ============ */

/* Wiersz (algo + nav) — NIE PRZESUWAJ TYM, bo przesunie i nav */
.maplibregl-ctrl-top-right .algo-row-ctrl{
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 10px 10px 0 0 !important; /* standardowy offset MapLibre w prawym górnym */
}

/* Dzieci w wierszu nie mogą używać float/clear MapLibre */
.maplibregl-ctrl-top-right .algo-row-ctrl > .maplibregl-ctrl{
  float: none !important;
  clear: none !important;
  margin: 0 !important;
}

/* RUSZASZ TYLKO ALGORYTMEM (nav zostaje gdzie był) */
.maplibregl-ctrl-top-right .algo-maplibre-group{
  transform: translate(var(--algo-shift-x), var(--algo-shift-y));
  z-index: 5;
  pointer-events: auto;
}

/* =========================================================
   DODATEK: klik w cały pet-frame otwiera szczegóły (UX)
   ========================================================= */
.pet-frame.js-open-detail{
  cursor: pointer;
}
.pet-frame.js-open-detail:focus-visible{
  outline: none;
  box-shadow: 0 0 0 3px rgba(0,0,0,.12);
  border-radius: 16px;
}
