* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #1a1a1a;
  background: #fff;
}
a { color: #0066cc; text-decoration: none; }
a:hover { text-decoration: underline; }

/* HEADER - sticky */
.header {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 1000;
}
.header img.logo-pig { height: 36px; }
.header img.logo-md { height: 48px; margin-left: auto; }
.header-text { font-size: 13px; color: #444; }

/* MAP HERO */
.map-hero {
  position: relative;
  height: 35vh;
  min-height: 260px;
  overflow: hidden;
  z-index: 1;
}
#map { width: 100%; height: 100%; }
.map-hero.no-map { height: auto; min-height: auto; background: linear-gradient(135deg, #1e3a5f 0%, #2d5a8e 100%); }
.map-hero.no-map .map-overlay { position: relative; background: none; padding: 40px 20px 20px; }

/* Overlay */
.map-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.25) 60%, transparent 100%);
  padding: 30px 20px 12px;
  color: #fff;
  z-index: 400;
  pointer-events: none;
  user-select: none;
  text-align: center;
}
.map-overlay > * { pointer-events: none; }
.map-overlay h1 { font-size: 22px; font-weight: 700; margin-bottom: 2px; text-shadow: 0 1px 3px rgba(0,0,0,0.5); }
.map-overlay .subtitle { font-size: 13px; opacity: 0.9; display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.catalog-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(16,122,139,0.55); color: #fff;
  padding: 3px 10px; border-radius: 10px;
  font-size: 11px; font-weight: 500;
  pointer-events: auto; text-decoration: none;
  border: none;
  transition: background 0.2s;
}
.catalog-btn:hover { background: rgba(16,122,139,0.75); text-decoration: none; }

/* MAIN */
.main-content { width: 85%; max-width: 1300px; margin: 0 auto; padding: 12px 0; }

/* TILES GRID - 6-kolumnowy (kafle po 2 kolumny = 3 na wiersz) */
.tiles-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}
.tile {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  overflow: hidden;
  grid-column: span 2;
}
/* 9 kafli = pelny grid 3x3 */

@media (max-width: 1000px) {
  .main-content { width: 95%; }
  .tiles-grid { grid-template-columns: repeat(2, 1fr); }
  .tile { grid-column: span 1; }
}
@media (max-width: 600px) {
  .main-content { width: 100%; padding: 12px 8px; }
  .tiles-grid { grid-template-columns: 1fr; }
}

.tile-header {
  background: #f8f9fa;
  padding: 8px 10px;
  border-bottom: 1px solid #e8e8e8;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tile-icon {
  width: 24px; height: 24px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.tile-icon svg { width: 14px; height: 14px; color: #fff; }
.tile-icon.blue { background: #3b82f6; }
.tile-icon.green { background: #10b981; }
.tile-icon.purple { background: #8b5cf6; }
.tile-icon.orange { background: #f59e0b; }
.tile-icon.teal { background: #14b8a6; }
.tile-icon.emerald { background: #059669; }
.tile-icon.rose { background: #e11d48; }
.tile-icon.amber { background: #d97706; }
.tile-title { font-size: 12px; font-weight: 600; }
.tile-body { padding: 10px; }
.tile-empty { color: #9ca3af; font-style: italic; font-size: 12px; padding: 12px 0; }

/* Opis */
.description-text { font-size: 13px; line-height: 1.55; color: #444; }
.description-date { font-size: 12px; color: #555; margin-top: 8px; padding-top: 8px; border-top: 1px solid #f0f0f0; display: flex; justify-content: space-between; align-items: baseline; }
.parent-link { font-size: 11px; color: #888; }

/* Keywords grouped */
.kw-group { margin-bottom: 6px; }
.kw-group:last-child { margin-bottom: 0; }
.kw-source { font-size: 9px; color: #999; text-transform: uppercase; letter-spacing: 0.3px; display: block; margin-bottom: 2px; }
.keywords-list { display: flex; flex-wrap: wrap; gap: 4px; }
.keyword-tag {
  background: #e8f4fc;
  color: #0066cc;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}
.keyword-tag.inspire { background: #d1fae5; color: #047857; }

/* Contact */
.contact-card { background: #f8f9fa; border-radius: 4px; padding: 8px; }
.contact-org { font-weight: 600; font-size: 12px; }
.contact-detail { font-size: 11px; color: #666; }

/* Services */
.service-item {
  padding: 6px 10px;
  background: #f8f9fa;
  border-radius: 4px;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.service-item:last-child { margin-bottom: 0; }
.service-name { font-size: 12px; font-weight: 600; color: #333; }
.service-link { font-size: 11px; white-space: nowrap; }

/* License */
.license-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.license-badge {
  background: #eff6ff;
  color: #2563eb;
  padding: 5px 12px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.license-info { font-size: 12px; color: #444; line-height: 1.4; }
.license-info a { font-size: 11px; }
.license-footer { margin-top: 8px; padding-top: 8px; border-top: 1px solid #f0f0f0; font-size: 12px; line-height: 1.4; }

/* Compass bbox */
.compass {
  display: grid;
  grid-template-areas:
    ". top ."
    "left center right"
    ". bottom .";
  grid-template-columns: 1fr auto 1fr;
  justify-items: center;
  align-items: center;
  gap: 4px 10px;
  padding: 10px 4px;
}
.compass-n { grid-area: top; text-align: center; }
.compass-s { grid-area: bottom; text-align: center; }
.compass-w { grid-area: left; justify-self: end; display: flex; align-items: center; gap: 5px; }
.compass-e { grid-area: right; justify-self: start; display: flex; align-items: center; gap: 5px; }
.compass-center { grid-area: center; color: #c0c0c0; font-size: 14px; }
.compass .dir {
  color: #0066cc;
  font-weight: 700;
  font-size: 12px;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eff6ff;
  border-radius: 50%;
  flex-shrink: 0;
}
.compass .val {
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  font-size: 12px;
  color: #333;
  font-weight: 500;
}
.compass-crs {
  text-align: center;
  font-size: 11px;
  color: #666;
  padding-top: 8px;
  border-top: 1px solid #f0f0f0;
}
.compass-crs strong { color: #0066cc; font-weight: 600; }

/* Data list */
.data-list { list-style: none; }
.data-list li {
  padding: 6px 0;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  gap: 8px;
  font-size: 12px;
}
.data-list li:last-child { border-bottom: none; }
.data-label { flex: 0 0 76px; color: #666; font-weight: 500; }
.data-value { flex: 1; color: #1a1a1a; word-break: break-all; }
.data-value-uuid { flex: 1; color: #1a1a1a; word-break: break-all; font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace; font-size: 11px; }

/* Quality */
.quality-item {
  background: #f8f9fa;
  border-radius: 4px;
  padding: 6px 8px;
  margin-bottom: 4px;
  border-left: 3px solid #d4d4d4;
  cursor: default;
}
.quality-item:last-child { margin-bottom: 0; }
.quality-item.conformant { border-left-color: #3b82f6; }
.quality-item.non-conformant { border-left-color: #f59e0b; }
.quality-text { font-size: 12px; color: #333; line-height: 1.4; }

/* JS tooltip */
#tooltip {
  display: none;
  position: absolute;
  background: #1e293b;
  color: #f1f5f9;
  padding: 6px 10px;
  border-radius: 5px;
  font-size: 11px;
  line-height: 1.3;
  max-width: 260px;
  z-index: 9999;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Status metadanych */
.status-display {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0 8px;
}
.status-indicator {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #059669;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.15);
}
.status-indicator svg { width: 20px; height: 20px; color: #fff; }
.status-label { font-size: 11px; color: #666; line-height: 1.2; }
.status-value { font-size: 15px; font-weight: 700; color: #059669; }
.status-meta { font-size: 12px; color: #555; margin-top: 6px; padding-top: 6px; border-top: 1px solid #f0f0f0; }
.status-meta strong { color: #333; }

/* FOOTER */
.footer {
  text-align: center;
  padding: 12px;
  background: #f8f9fa;
  border-top: 1px solid #e8e8e8;
  color: #666;
  font-size: 11px;
}
.footer a { color: #666; text-decoration: none; }
.footer a:hover { text-decoration: none; }
.footer img { height: 24px; opacity: 0.6; vertical-align: middle; margin-left: 6px; }

/* LEAFLET */
.leaflet-top { top: 10px !important; }
.leaflet-control-zoom a, .leaflet-control a {
  width: 26px !important; height: 26px !important; line-height: 26px !important; font-size: 14px !important;
}
.leaflet-control-attribution { font-size: 8px !important; opacity: 0.5; }
.leaflet-control-attribution a { color: #666 !important; }
.leaflet-pane, .leaflet-control { z-index: 400 !important; }
.leaflet-ctrl-btn { width: 26px; height: 26px; line-height: 26px; text-align: center; display: block; }
.leaflet-ctrl-center { font-size: 16px; color: #333; font-weight: bold; }
.leaflet-ctrl-poland { font-size: 14px; }
.bbox-animated { animation: pulse-bbox 2s ease-in-out infinite; }
@keyframes pulse-bbox {
  0%, 100% { stroke-opacity: 1; fill-opacity: 0.2; }
  50% { stroke-opacity: 0.5; fill-opacity: 0.1; }
}
