:root {
  --bg: #ffffff;
  --bg-elevated: #f3f4f6;
  --bg-sidebar: #f3f4f6;
  --header-bg: #94b021;
  --header-text: #ffffff;
  --border-subtle: #d1d5db;
  --accent: #4d7c0f;
  --accent-soft: rgba(189, 216, 73, 0.22);
  --accent-strong: rgba(132, 204, 22, 0.4);
  --text: #111827;
  --text-dim: #6b7280;
  --danger: #b91c1c;
  --shadow-strong: rgba(15, 23, 42, 0.18);
} 

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

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Museo Sans", "Trebuchet MS", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.page {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1320px;
  padding: 20px;
  gap: 16px;
  min-height: 100vh; /* jak w mapa-hufcow – strona ma co najmniej wysokość okna */
}

.page-footer {
  margin-top: auto; /* dociśnij stopkę do dołu strony */
  font-size: 0.78rem;
  color: var(--text-dim);
}

.page-footer a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.page-footer-logo-wrap {
  text-align: center;
  padding: 1rem 0 0.5rem;
}

.page-footer-logo-wrap .page-footer-logo-link {
  display: inline-block;
  line-height: 0;
}

.page-footer-zhp-logo {
  max-height: 48px;
  width: auto;
  display: block;
  opacity: 0.85;
}

.page-footer-logo-wrap .page-footer-logo-link:hover .page-footer-zhp-logo {
  opacity: 1;
}

.page-header {
  background-color: var(--header-bg) !important;
  color: var(--header-text) !important;
  border-radius: 18px;
  padding: 18px 22px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12);
}

.page-header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.page-header-logo-link {
  display: block;
  line-height: 0;
  flex-shrink: 0;
}

.page-header-logo {
  max-height: 80px;
  width: auto;
  display: block;
}

.page-header h1 {
  margin: 0 0 6px;
  font-size: clamp(1.4rem, 2.1vw, 1.7rem);
  letter-spacing: 0.02em;
}

.page-header-title-link {
  color: inherit;
  text-decoration: none;
}

.page-header-title-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.page-header p {
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.94rem;
}

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(260px, 2fr);
  gap: 16px;
  min-height: 560px;
}

.toolbar {
  background: var(--bg);
  border-radius: 18px;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
  padding: 14px 18px;
}

.toolbar-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toolbar-search {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(640px, 100%);
}

.toolbar-logo-link {
  display: inline-block;
  line-height: 0;
  margin-left: 16px;
}

.toolbar-zhp-logo {
  max-height: 32px;
  width: auto;
  display: block;
}

.toolbar-search-label {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text-dim);
}

.toolbar-search input {
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  padding: 12px 18px;
  font-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  background: var(--bg);
  color: var(--text);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.05);
}

.toolbar-search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(148, 176, 33, 0.22);
}

.map {
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.sidebar {
  border-radius: 18px;
  background-color: var(--bg-sidebar) !important;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar-content {
  padding: 16px 18px;
  width: 100%;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.base-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 10px; /* odstęp nad i pod przyciskami (Strona bazy / Strona hufca) */
}

.link-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  text-decoration: none;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  color: var(--text-dim);
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.1s ease,
    box-shadow 0.15s ease;
}

.link-pill:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: #111827;
  transform: translateY(-1px);
  box-shadow: 0 6px 15px rgba(15, 23, 42, 0.08);
}

.link-pill-icon {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--accent-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  color: #fff;
}

.base-detail {
  background: var(--bg);
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
  padding: 16px 18px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}

.base-detail h2 {
  margin: 0 0 6px;
  font-size: 1.1rem;
}

.base-detail h3 {
  margin: 16px 0 6px;
  font-size: 0.98rem;
}

.base-detail p {
  margin: 0 0 10px;
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.5;
}

.base-detail p:last-child {
  margin-bottom: 0;
}

.base-detail-placeholder {
  margin-bottom: 0;
}

.base-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 14px;
  margin: 10px 0 6px;
  font-size: 0.86rem;
  color: var(--text-dim);
}

.base-detail-grid-item strong {
  display: block;
  font-weight: 600;
  color: var(--text);
}

.base-detail-photo {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  margin: 12px 0;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.12);
  max-height: 220px;
}

.base-detail-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.base-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 4px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.74rem;
  border: 1px solid rgba(77, 124, 15, 0.3);
}

.sidebar-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.search-field-label {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text-dim);
}

.search-field input {
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  padding: 10px 12px;
  font-size: 0.9rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  background: var(--bg);
  color: var(--text);
}

.search-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(148, 176, 33, 0.22);
}

.result-summary {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.bases-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 120px;
}

.base-card {
  border-radius: 14px;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  padding: 12px 14px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
  cursor: pointer;
  transition: border-color 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
}

.base-card:hover,
.base-card:focus-visible {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
  outline: none;
}

.base-card[data-selected="true"] {
  border-color: var(--accent);
  box-shadow: 0 12px 28px rgba(77, 124, 15, 0.3);
}

.base-card h3 {
  margin: 0 0 4px;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text);
}

.base-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.base-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(148, 176, 33, 0.18);
  color: var(--accent);
  font-size: 0.72rem;
  border: 1px solid rgba(148, 176, 33, 0.35);
}

.leaflet-container {
  background-color: var(--bg-elevated) !important;
}

.leaflet-popup-content-wrapper {
  border-radius: 12px;
}

.leaflet-popup-content {
  margin: 8px 12px;
  font-size: 0.82rem;
}

.marker-popup {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
}

.leaflet-control-attribution {
  font-size: 9px !important;
  background: var(--bg) !important;
  color: #6b7280 !important;
}

.leaflet-control-zoom a {
  background: var(--bg);
  color: #111827;
  border-color: var(--border-subtle);
}

.leaflet-control-zoom a:hover {
  background: var(--accent-soft);
  color: #111827;
  border-color: var(--accent);
}

.loading {
  color: var(--text-dim);
  font-size: 0.86rem;
}

.error-message {
  color: var(--danger);
  font-weight: 600;
  font-size: 0.86rem;
}

.hidden {
  display: none !important;
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1.4fr);
  }
}

@media (max-width: 768px) {
  .page {
    padding: 12px;
  }

  .toolbar {
    padding: 12px;
  }

  .page-header {
    padding: 14px;
  }

  .page-header-content {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
  }

  .page-header-content > div {
    flex: 1 1 auto;
    min-width: 0;
  }

  .page-header-content .page-header-logo-link {
    flex: 0 0 auto;
    order: 2;
    margin-left: auto;
  }

  .page-header-logo {
    max-height: 52px;
  }

  .layout {
    grid-template-columns: minmax(0, 1fr);
    /* Jak w mapie OC: mapa niższa, lista/treść ważniejsza, bez sztucznej minimalnej wysokości. */
    grid-template-rows: minmax(220px, auto) minmax(0, auto);
    min-height: auto;
  }

  .map {
    min-height: 220px;
  }

  /* Na mobile lista baz nie powinna być w małym przewijanym okienku,
     tylko normalnie pod mapą – jak w mapie OC. */
  .sidebar-content {
    padding: 16px 12px 20px;
    flex: 0 0 auto;       /* wysokość wg zawartości, bez wymuszania wypełniania wysokości */
    min-height: auto;
    max-height: none;
    overflow-y: visible;  /* brak wewnętrznego scrolla – przewija się cała strona */
  }

  .sidebar {
    min-height: auto;
  }
}

