/* ===========================================================================
   Portal Obywatela — publikacje gminy jako PŁYWAJĄCA KARTA nad mapą.

   Dlaczego nie kolumna: stała kolumna + wysunięty panel warstw zjadały pół
   ekranu, a mapa jest tu głównym bohaterem. Karta unosi się nad mapą po prawej
   stronie (tam jest wolne miejsce — warstwy i narzędzia siedzą po lewej),
   da się ją zwinąć do samego paska, a mapa zostaje pełnej szerokości.

   Niczego nie nadpisuje w układzie strony: .app i .map-container zostają
   dokładnie takie, jakie były.
   =========================================================================== */

#portal-side {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 344px;
  max-width: calc(100vw - 24px);
  max-height: calc(100% - 24px);
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(15, 27, 68, 0.10);
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(15, 27, 68, 0.14), 0 2px 6px rgba(15, 27, 68, 0.06);
  z-index: 30;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.45;
}

/* Przyciski zoomu OpenLayers siedzą domyślnie w prawym górnym rogu —
   zsuwamy je w lewo, żeby karta ich nie przykryła. */
.map-container .ol-zoom {
  right: 372px !important;
  left: auto !important;
}

/* --- pasek górny karty: gmina albo wyszukiwanie --- */
.ps-place {
  padding: 11px 40px 11px 13px;   /* miejsce na przycisk zwijania w rogu */
  border-bottom: 1px solid rgba(15, 27, 68, 0.07);
  background: linear-gradient(180deg, #FFFFFF, #FBFCFE);
  flex-shrink: 0;
}
.ps-place label {
  display: block;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: #9AA8C4;
  margin-bottom: 5px;
}
.ps-place input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #E1E6F0;
  border-radius: 8px;
  font: inherit;
  font-size: 12.5px;
  background: #fff;
}
.ps-place input:focus {
  outline: none;
  border-color: #4F6CE0;
  box-shadow: 0 0 0 3px rgba(79, 108, 224, 0.10);
}
.ps-current { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.ps-current .ps-name { font-size: 15px; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }
.ps-current .ps-where { font-size: 10.5px; color: #8A9AB5; margin-top: 2px; }
.ps-change {
  color: #4F6CE0; font-weight: 600; font-size: 11px; cursor: pointer;
  white-space: nowrap; padding: 3px 7px; border-radius: 6px; flex-shrink: 0;
}
.ps-change:hover { background: #EEF1FB; }

/* zwijanie karty do samego paska */
.ps-toggle {
  position: absolute; top: 9px; right: 10px; width: 22px; height: 22px;
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #8A9AB5; font-size: 13px; line-height: 1;
}
.ps-toggle:hover { background: #EEF1FB; color: #4F6CE0; }
#portal-side.collapsed .ps-body { display: none; }
#portal-side.collapsed { max-height: none; }

/* --- treść --- */
.ps-body { padding: 11px 13px 14px; overflow-y: auto; min-height: 0; }
.ps-body::-webkit-scrollbar { width: 6px; }
.ps-body::-webkit-scrollbar-thumb { background: #D5DDEA; border-radius: 3px; }
.ps-body::-webkit-scrollbar-track { background: transparent; }

/* --- zakładki --- */
.ps-tabs { display: flex; gap: 4px; margin-bottom: 11px; }
.ps-tab {
  font-size: 11.5px; padding: 4px 10px; border-radius: 7px; cursor: pointer;
  font-weight: 600; border: 1px solid transparent; background: #F1F4FA; color: #7A8BB5;
  white-space: nowrap;
}
.ps-tab:hover { background: #E7ECF7; color: #4F6CE0; }
.ps-tab.on { background: #0F1B44; color: #fff; }

/* --- karty publikacji --- */
.ps-card {
  border: 1px solid #EAEEF6;
  border-left: 3px solid #C6D0E2;
  border-radius: 9px;
  padding: 9px 11px;
  margin-bottom: 6px;
  cursor: pointer;
  background: #fff;
  transition: box-shadow .14s, border-color .14s;
}
.ps-card:hover { box-shadow: 0 3px 12px rgba(15, 27, 68, .09); border-color: #C7D3EC; }
.ps-card h3 { margin: 0 0 5px; font-size: 12.5px; font-weight: 600; line-height: 1.35; letter-spacing: -0.005em; }
.ps-card .ps-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 10.5px; color: #8A9AB5; }
.ps-card .ps-meta .ps-right { margin-left: auto; font-weight: 700; color: #1A1E2E; font-size: 11px; }
.ps-card p { margin: 5px 0 0; font-size: 11px; color: #6B7A94; line-height: 1.45; }

.ps-k-consultation { border-left-color: #1E8D55; }
.ps-k-parcel_sale  { border-left-color: #E58A1F; }
.ps-k-investment   { border-left-color: #8A35AF; }
.ps-k-announcement { border-left-color: #F5A623; }

.ps-badge { font-size: 9.5px; font-weight: 700; padding: 2px 7px; border-radius: 5px; letter-spacing: .02em; }
.ps-b-consultation { background: #E4F5EC; color: #1E8D55; }
.ps-b-parcel_sale  { background: #FDF0E0; color: #C9741A; }
.ps-b-investment   { background: #F3E9F9; color: #8A35AF; }
.ps-b-announcement { background: #FEF3DF; color: #B4770F; }
.ps-b-decision     { background: #F0F3FA; color: #7A8BB5; }

/* --- nagłówki sekcji --- */
.ps-eyebrow {
  font-size: 9.5px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase;
  color: #9AA8C4; margin: 14px 0 8px; display: flex; align-items: center; gap: 8px;
}
.ps-eyebrow:after { content: ""; flex: 1; height: 1px; background: #EAEEF6; }
.ps-eyebrow:first-child { margin-top: 0; }

/* --- lista gmin --- */
.ps-muni {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 7px 10px; border: 1px solid #EAEEF6; border-radius: 8px;
  margin-bottom: 4px; cursor: pointer; font-size: 12px; background: #fff;
}
.ps-muni:hover { border-color: #4F6CE0; background: #FAFBFE; }
.ps-muni b { font-weight: 600; }
.ps-muni .ps-where { display: block; color: #8A9AB5; font-size: 10px; margin-top: 1px; }
.ps-muni .ps-count {
  background: #F1F4FA; color: #5B6B80; font-size: 10.5px; font-weight: 700;
  border-radius: 20px; padding: 1px 7px; flex-shrink: 0;
}

/* --- szczegóły --- */
.ps-back { display: inline-block; color: #4F6CE0; font-weight: 600; font-size: 11.5px; cursor: pointer; margin-bottom: 9px; }
.ps-back:hover { text-decoration: underline; }
.ps-title { font-size: 14.5px; font-weight: 700; margin: 6px 0 3px; line-height: 1.3; letter-spacing: -0.01em; }
.ps-sub { font-size: 10.5px; color: #8A9AB5; margin: 0 0 11px; }
.ps-file {
  display: flex; justify-content: space-between; align-items: center; gap: 9px;
  border: 1px solid #EAEEF6; border-radius: 8px; padding: 8px 10px;
  margin-bottom: 5px; font-size: 11.5px;
}
.ps-file a { color: #4F6CE0; font-weight: 600; text-decoration: none; white-space: nowrap; }

/* --- formularz --- */
.ps-field {
  width: 100%; padding: 7px 10px; border: 1px solid #E1E6F0;
  border-radius: 8px; font: inherit; font-size: 12px; margin-bottom: 6px; background: #fff;
}
.ps-field:focus { outline: none; border-color: #4F6CE0; box-shadow: 0 0 0 3px rgba(79,108,224,.10); }
textarea.ps-field { resize: vertical; font-family: inherit; }
.ps-note { border-radius: 8px; padding: 8px 10px; font-size: 11px; line-height: 1.5; margin: 9px 0; }
.ps-note.info { background: #EEF1FB; border-left: 3px solid #4F6CE0; color: #2B3B6E; }
.ps-note.ok   { background: #E4F5EC; border-left: 3px solid #1E8D55; color: #12603B; }
.ps-note.err  { background: #FDECEA; border-left: 3px solid #E7473C; color: #8E241C; }
.ps-note.grey { background: #F5F7FB; border-left: 3px solid #E1E6F0; color: #8A9AB5; }
.ps-send {
  width: 100%; padding: 9px; background: #4F6CE0; color: #fff; border: none;
  border-radius: 8px; font-size: 12.5px; font-weight: 600; cursor: pointer; margin-top: 2px;
}
.ps-send:hover { background: #3B54BF; }
.ps-agree { display: flex; gap: 7px; align-items: flex-start; font-size: 10.5px; color: #8A9AB5; margin: 3px 0 8px; }
.ps-empty { text-align: center; color: #8A9AB5; font-size: 11.5px; padding: 20px 6px; line-height: 1.6; }

/* ===========================================================================
   EKRAN POWITALNY — „gdzie chcesz zajrzeć?"
   Pierwsze, co widzi mieszkaniec. Wybiera gminę (dowolną w Polsce, nie tylko
   naszą) albo pomija i ogląda całą Polskę.
   =========================================================================== */
#ps-welcome {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 20, 45, 0.42);
  backdrop-filter: blur(3px);
  animation: psFade .25s ease-out;
}
@keyframes psFade { from { opacity: 0 } to { opacity: 1 } }
#ps-welcome.hidden { display: none; }

.psw-card {
  width: 100%;
  max-width: 470px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(10, 20, 45, .28);
  padding: 26px 26px 20px;
  animation: psRise .28s cubic-bezier(.2, .8, .3, 1);
}
@keyframes psRise { from { transform: translateY(14px); opacity: 0 } to { transform: none; opacity: 1 } }

.psw-card h2 {
  margin: 0 0 5px;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #0F1B44;
}
.psw-card .psw-lead { margin: 0 0 18px; font-size: 13px; color: #7A8BB5; line-height: 1.5; }

.psw-search { position: relative; }
.psw-search input {
  width: 100%;
  padding: 13px 15px;
  border: 1.5px solid #E1E6F0;
  border-radius: 11px;
  font: inherit;
  font-size: 14.5px;
  background: #FBFCFE;
}
.psw-search input:focus {
  outline: none; border-color: #4F6CE0; background: #fff;
  box-shadow: 0 0 0 4px rgba(79, 108, 224, .12);
}

.psw-results { max-height: 268px; overflow-y: auto; margin-top: 10px; }
.psw-results::-webkit-scrollbar { width: 6px; }
.psw-results::-webkit-scrollbar-thumb { background: #D5DDEA; border-radius: 3px; }

.psw-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-radius: 10px; cursor: pointer; border: 1px solid transparent;
}
.psw-item:hover { background: #F5F7FC; border-color: #E1E6F0; }
.psw-item b { font-size: 14px; font-weight: 600; color: #0F1B44; }
.psw-item .psw-where { display: block; font-size: 11px; color: #8A9AB5; margin-top: 1px; }
.psw-tag {
  font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 20px;
  background: #E4F5EC; color: #1E8D55; white-space: nowrap; flex-shrink: 0;
}
.psw-tag.off { background: #F1F4FA; color: #9AA8C4; }

.psw-hint { font-size: 11.5px; color: #9AA8C4; margin-top: 14px; line-height: 1.6; }
.psw-hint b { color: #5B6B80; }
.psw-ex {
  display: inline-block; background: #F1F4FA; color: #4F6CE0; font-weight: 600;
  padding: 1px 7px; border-radius: 5px; cursor: pointer;
}
.psw-ex:hover { background: #E4EAFA; }

/* Ostatnio oglądana gmina — skrót powrotu. */
.psw-item.psw-last { background: #F7F9FD; border-color: #E4EAF6; margin-bottom: 8px; }
.psw-item.psw-last:hover { background: #EFF3FC; border-color: #4F6CE0; }
.psw-item.psw-last .psw-tag { background: #E7ECF7; color: #4F6CE0; }

/* Pierwsza pozycja, gdy w pytaniu jest cyfra — działka albo adres. */
.psw-item.psw-parcel { background: #F4F7FE; border-color: #DCE4F8; margin-bottom: 8px; }
.psw-item.psw-parcel:hover { background: #EBF0FD; border-color: #4F6CE0; }
.psw-item.psw-parcel .psw-tag { background: #4F6CE0; color: #fff; }
.psw-skip {
  display: block; width: 100%; margin-top: 12px; padding: 10px;
  background: #fff; border: 1px solid #E1E6F0; border-radius: 10px;
  font: inherit; font-size: 12.5px; font-weight: 600; color: #5B6B80; cursor: pointer;
}
.psw-skip:hover { border-color: #4F6CE0; color: #4F6CE0; }
.psw-empty { padding: 18px 4px; text-align: center; color: #9AA8C4; font-size: 12.5px; }

/* --- wąski ekran: karta na dole, pełna szerokość --- */
@media (max-width: 820px) {
  #portal-side {
    top: auto; right: 8px; left: 8px; bottom: 8px;
    width: auto; max-height: 52%;
  }
  .map-container .ol-zoom { right: 8px !important; }
}


/* --- rysunek planu jako warstwa --- */
.ps-layer {
  border: 1px solid #EAEEF6; border-radius: 9px; padding: 9px 11px; margin-bottom: 6px; background: #fff;
}
.ps-layer-row { display: flex; align-items: center; gap: 8px; font-size: 12px; cursor: pointer; font-weight: 600; }
.ps-layer-row input { margin: 0; }
.ps-layer-opacity { display: flex; align-items: center; gap: 8px; margin-top: 7px; font-size: 10px; color: #8A9AB5; }
.ps-layer-opacity input { flex: 1; }

/* Wskazanie miejsca uwagi na mapie — punkt albo obrys terenu. */
.ps-pick { margin: 2px 0 8px; }
.ps-pick-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.ps-pick-btn {
    flex: 1 1 auto; padding: 7px 10px; font: inherit; font-size: 11px; font-weight: 600;
    color: #3B4A6B; background: #F4F6FB; border: 1px solid #DDE3EF; border-radius: 7px;
    cursor: pointer; white-space: nowrap;
}
.ps-pick-btn:hover { background: #E9EEF9; border-color: #C6D2E8; }
.ps-pick-btn.del { flex: 0 0 auto; color: #B4453C; background: #FCF1F0; border-color: #F0D4D1; }
.ps-pick-info { margin-top: 6px; font-size: 10.5px; line-height: 1.45; color: #8A9AB5; }
.ps-pick-info.rysuje { color: #2F5BD8; font-weight: 600; }
.ps-pick-info.ok { color: #2C7A52; font-weight: 600; }

/* Klauzula informacyjna RODO — rozwijana przy zgodzie, żeby było co przeczytać. */
.ps-rodo { margin: -4px 0 10px; font-size: 10.5px; color: #8A9AB5; }
.ps-rodo summary { cursor: pointer; color: #3E63D3; font-weight: 600; }
.ps-rodo div {
    margin-top: 6px; padding: 9px 10px; max-height: 220px; overflow-y: auto;
    background: #F7F9FD; border: 1px solid #E4E9F4; border-radius: 7px;
    white-space: pre-line; line-height: 1.5; color: #4A5578;
}

/* Kreator pisma — trzy kroki zamiast jednej długiej listy pól. */
.ps-kroki { display: flex; gap: 4px; margin: 4px 0 10px; }
.ps-krok-znacznik {
    flex: 1; padding: 5px 4px; text-align: center; font-size: 9.5px; font-weight: 700;
    color: #98A4BC; background: #F4F6FB; border-radius: 6px; letter-spacing: .01em;
}
.ps-krok-znacznik.akt { color: #FFFFFF; background: #4A63D8; }
.ps-krok.hidden { display: none; }
.ps-label { margin: 9px 0 4px; font-size: 11px; font-weight: 700; color: #3B4A6B; }
.ps-label b { color: #C4453C; }
.ps-pod { display: block; margin-top: 2px; font-size: 10px; font-weight: 500; color: #96A2B8; }
.ps-row { display: flex; gap: 6px; }
.ps-row .ps-field { flex: 1; }
.ps-field.waski { flex: 0 0 72px; }
.ps-wybor { display: flex; gap: 16px; margin: 2px 0 6px; font-size: 12px; color: #3B4A6B; }
.ps-wybor label { display: flex; align-items: center; gap: 5px; cursor: pointer; }
.ps-licznik { margin: -4px 0 8px; text-align: right; font-size: 10px; color: #98A4BC; }
.ps-nawigacja { display: flex; gap: 6px; }
.ps-nawigacja .ps-send { flex: 1; }
.ps-send.wtorny { color: #4A5578; background: #EEF1F8; }
.ps-send.wtorny:hover { background: #E2E7F3; }
