/* --- reset & layout --- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: #e6e6e6;
  background: #141414;
}

/* mapa + warstwy */
#mapa {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}
#markersContainer,
#worldMarkersContainer {
  position: absolute;
  inset: 0;
  pointer-events: auto;
}

/* --- HUD / przyciski --- */
#coordinates {
  position: fixed;
  left: 12px;
  bottom: 12px;
  margin: 0;
  padding: 4px 8px;
  background: rgba(0,0,0,.45);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 6px;
  font-size: 12px;
  z-index: 1000;
}

#controls {
  position: fixed;
  left: 12px; top: 12px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  z-index: 1000;
}

/* wszystkie kontrolki jako zwarte „chipsy” */
#controls button,
#controls .dropdown-toggle {
  appearance: none;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(18,18,18,.85);
  color: #f2f2f2;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  line-height: 1;
  white-space: nowrap;
  backdrop-filter: blur(6px);
  transition: border-color .15s ease, background-color .15s ease, transform .05s ease;
}
#controls button:hover,
#controls .dropdown-toggle:hover { border-color: rgba(255,255,255,.28); }
#controls button:active,
#controls .dropdown-toggle:active { transform: translateY(1px); }

/* „Wstecz” */
#backButton { font-size: 18px; width: 36px; justify-content: center; }

/* dropdown */
.dropdown { position: relative; }
.dropdown-toggle { font-size: 14px; }
.dropdown-icon { opacity: .7; }
.dropdown-list {
  position: absolute; top: calc(100% + 6px); left: 0;
  min-width: 190px;
  padding: 6px;
  margin: 0;
  list-style: none;
  background: rgba(18,18,18,.95);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px;
  display: none;
  z-index: 1100;
}
.dropdown.open .dropdown-list { display: block; }
.dropdown-list li {
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.dropdown-list li:hover { background: rgba(255,255,255,.06); }
.dropdown-list li.active { background: rgba(92,191,76,.18); }
.dropdown-list li.disabled {
  opacity: .45; pointer-events: none;
}

/* przełącznik znaczników */
#toggleMarkersBtn { font-size: 14px; }
#toggleMarkersBtn .check {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 5px;
  border: 1px solid rgba(255,255,255,.25);
  font-size: 12px; line-height: 1;
}
#toggleMarkersBtn.on .check { background: #5cbf4c; border-color: #5cbf4c; }

/* PRZYCISKI PRAWY GÓRNY RÓG */
#reportButton, #legendButton {
  position: fixed;
  right: 10px;
  z-index: 1000;
  height: 36px; padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(18,18,18,.85);
}
#reportButton { top: 10px; right: 20px; }   /* (1) Zgłoś błąd – na samej górze */
#legendButton { top: 10px; right: 120px; }  /* obok, jak wcześniej */


/* notyfikacja */
#mapNotification {
  position: fixed; left: 50%; top: 12px; transform: translateX(-50%);
  padding: 8px 14px; border-radius: 10px;
  background: rgba(32,32,32,.9); border: 1px solid rgba(255,255,255,.14);
  font-size: 14px; z-index: 1000;
}


/* (4) Edytor – pod import/eksport */
#poiControls{
  position: fixed;
  right: 20px;
  top: 60px;         /* niżej od stateControls */
  display: none;      /* admin-only */
  gap: 8px;
  z-index: 1000;
}

/* (5) Skróty – pod edytorem, drobniejsze */
.poi-help{
  position: fixed;
  right: 20px;
  top: 130px;         /* pod #poiControls */
  display: none;      /* admin-only */
  background: rgba(0,0,0,.9);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  padding: 8px 10px;
  box-shadow: 0 6px 18px rgba(0,0,0,.35);
  font-size: 11px;    /* trochę mniejsze, jak prosiłeś */
  line-height: 1.25;
}
.poi-help h4{ margin:0 0 6px; font-size:12px; }
.poi-help kbd{ font-size:10px; padding:0 4px; }

.chip-btn {
  appearance: none;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(18,18,18,.85);
  color: #f2f2f2;
  width: 36px; height: 36px;
  border-radius: 10px;
  font-size: 18px; font-weight: 700;
  line-height: 1; cursor: pointer;
  backdrop-filter: blur(6px);
  transition: border-color .15s ease, transform .05s ease;
}
.chip-btn:hover  { border-color: rgba(255,255,255,.28); }
.chip-btn:active { transform: translateY(1px); }

/* LOADER centralny */
#loading {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: #000; z-index: 1200;
}
#loading.hidden { opacity: 0; pointer-events: none; transition: opacity .3s ease; }
#loadingInner {
  display: grid; place-items: center; gap: 10px;
}
.loader {
  width: 52px; height: 52px; border-radius: 50%;
  border-top: 3px solid #fff; border-right: 3px solid transparent;
  animation: rotation 1s linear infinite;
}
#loadingPercentage { font-size: 14px; }
/* tooltip dla ikon świata */
#worldTooltip {
  position: fixed; z-index: 2000; pointer-events: none;
  padding: 6px 8px; border-radius: 6px; font-size: 12px;
  background: rgba(0,0,0,.85); color: #fff; border: 1px solid rgba(255,255,255,.12);
}

/* --- markery skrytek --- */
/* gołe kółko z numerem */
.marker{
  position:absolute;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:14px;height:14px;
  border-radius:9999px;
  transform:translate(-50%,-50%);
  font-weight:700;
  font-size:9px;         /* skaluje się w JS */
  line-height:1;
  color:#fff;
  border:1px solid rgba(0,0,0,.35);
  box-shadow:none !important;
  user-select:none;
  pointer-events:auto;
}
.marker.red{   background:#e74c3c; }
.marker.blue{  background:#2980b9; }
.marker.green{ background:#27ae60; }

/* ukryj wszystkie stare etykiety jeśli gdzieś zostały */
.marker .marker-label{ display:none !important; }


/* --- LEGENDA (odświeżona) --- */
#legendModal{position:fixed; inset:0; display:none; place-items:center; background:rgba(0,0,0,.45); z-index:2000}
#legendContent{background:#121317; border:1px solid rgba(255,255,255,.12); border-radius:14px; padding:14px 16px; min-width:260px;}
.legend-title{font-weight:700; font-size:16px; margin:0 0 10px 0; opacity:.95}
.legend-list{display:grid; gap:14px}

/* Cała legenda skrytek wyśrodkowana */
.legend-list.skrytek {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.legend-list.skrytek .legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
}

.legend-title {
  text-align: center;
  font-weight: 600;
  margin-bottom: 6px;
}


/* wiersz legendy */
.legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}
.legend-dot.red   { background:#ff3b3b }
.legend-dot.blue  { background:#2f80ff }
.legend-dot.green { background:#20d55a }

/* skrzynki mniejsze */
.legend-img {
  width: 70px;
  height: auto;
  border-radius: 6px;
  flex-shrink: 0;
}

/* telefony – mniejsze ikony */
.legend-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.legend-label {
  font-weight: 500;
  opacity: .9;
}

button, .chip-btn {
  user-select: none;
  caret-color: transparent;
}



/* --- modal: Zgłoś błąd (nowy wygląd) --- */
#reportFormOverlay {
  position: fixed; inset: 0; display: none; place-items: center;
  background: rgba(0,0,0,.6); z-index: 1400;
}
#reportFormOverlay.visible { display: grid; }
#reportForm {
  width: min(560px, calc(100% - 32px));
  background: #151515;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  padding: 18px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
#reportForm h2 { margin: 0 0 10px; font-size: 18px; }

#reportForm .close-btn {
  position: absolute; right: 8px; top: 6px; width: 34px; height: 34px;
  border-radius: 10px; border: 1px solid rgba(255,255,255,.14);
  background: rgba(22,22,22,.85); color: #fff; cursor: pointer;
}

#bugReportForm label { display: block; margin: 12px 0 6px; font-size: 13px; opacity: .9; }
#bugReportForm input, #bugReportForm select {
  width: 100%;
  height: 38px;
  background: #0f0f0f;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px;
  color: #eee;
  padding: 0 10px;
}
#bugReportForm input::placeholder { color: #888; }

.form-field { display: none; }
.form-field.visible { display: block; }

.form-actions {
  display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px;
}
.form-actions button {
  height: 36px; padding: 0 12px; border-radius: 10px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(24,24,24,.9); color: #fff; cursor: pointer;
}
.form-actions button[type="submit"] { background: #2a6023; border-color: #2a6023; }

.error-message {
  display: none;
  margin-top: 10px;
  color: #ff6b6b;
  background: rgba(255,0,0,.06);
  border: 1px solid rgba(255,0,0,.25);
  padding: 8px 10px;
  border-radius: 8px;
}
.loading   { display: none; margin-top: 10px; opacity: .8; }
.loading.visible { display: block; }
.success-message { display: none; margin-top: 10px; color: #8be37f; }

/* --- responsywność --- */
@media (max-width: 640px) {
  #controls { left: 8px; top: 8px; gap: 6px; }
#reportButton { top: 10px; right: 20px; }   /* (1) Zgłoś błąd – na samej górze */
#legendButton { top: 10px; right: 120px; }  /* obok, jak wcześniej */

}


#mediaPlayer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    will-change: opacity, visibility;
}

#mediaPlayer.visible {
    opacity: 1;
    visibility: visible;
}

#mediaPlayer .close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background-color: #1a1a1a;
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 101;
    transition: background-color 0.2s ease;
    transform: translateZ(0);
}

#mediaPlayer .close-btn:hover {
    background-color: #2a2a2a;
}

#mediaPlayer .content-container {
    position: relative;
    width: 100%;
    max-width: 1000px;
    background-color: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
    transform: scale(1.5);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    will-change: transform, opacity;
}

#mediaPlayer.visible .content-container {
    transform: scale(1);
    opacity: 1;
}

#mediaPlayer .content {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
}

#mediaPlayer .content iframe {
    width: 100%;
    aspect-ratio: 16/9;
    border: none;
}

#mediaPlayer .content video {
    width: 100%;
    aspect-ratio: 16/9;
    border: none;
}

#mediaPlayer .content img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
}


/* Style dla przycisku zgłaszania błędów */
#reportButton, #legendButton {
    position: fixed;
    right: 10px;
    padding: 8px 12px;
    background-color: #1a1a1a;
    color: white;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    cursor: pointer;
    z-index: 50;
    transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 15px;
    font-weight: 600;
    text-transform: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
#reportButton:hover, #legendButton:hover {
    background-color: #262626;
    border-color: #3a3a3a;
}

#reportButton {
    top: 10px;
}

#legendButton {
    top: 10px;
}


.loader {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: inline-block;
    border-top: 3px solid #FFF;
    border-right: 3px solid transparent;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

#loadingPercentage {
    margin-top: 10px;
    font-size: 14px;
}

#mapNotification.visible {
    opacity: 1;
}



#legendModal.visible #legendContent {
    transform: scale(1);
    opacity: 1;
}

#legendContent h2 {
    margin-top: 0;
    text-align: center;
    border-bottom: 1px solid #444;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    gap: 15px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 16px;
    font-weight: bold;
    text-transform: none;
}

.legend-marker {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-marker.red { background-color: rgba(255, 0, 0, 0.7); }
.legend-marker.blue { background-color: rgba(0, 89, 255, 0.7); }
.legend-marker.green { background-color: rgba(0, 255, 0, 0.7); }



.icon-btn {
    background: #1a1a1a;
    color: #fff;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    padding: 8px 12px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}


/* Toggle WŁ/WYŁ znaczników */
.toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #1a1a1a;
    color: #fff;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    padding: 8px 12px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    user-select: none;
}
.toggle-btn .check {
    display: inline-flex;
    width: 18px;
    height: 18px;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    background: #2a2a2a;
    color: transparent;
    font-weight: 900;
}
.toggle-btn.on .check {
    background: #6b46ff;
    color: #fff;
}


/* pojedyncza ikonka */
.world-icon {
    position: absolute;
    transform: translate(-50%, -50%);
    width: 18px;
    height: 18px;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    pointer-events: auto;  /* żeby działał hover */
    cursor: pointer;
}

dialog.confirm{ border:none; border-radius:14px; background:linear-gradient(180deg,#0d1117,#0a0a0a); color:#fff; box-shadow:0 8px 28px rgba(0,0,0,.45); padding:0 }
dialog.confirm::backdrop{ background:rgba(0,0,0,.55); backdrop-filter:blur(2px) }
dialog.confirm .box{ padding:16px 18px; min-width:280px }
dialog.confirm .row{ display:flex; gap:8px; justify-content:flex-end }
dialog.confirm button{ height:34px; padding:0 12px; border-radius:10px; border:1px solid rgba(255,255,255,.15); background:#1a1a1a; color:#fff; }
dialog.confirm button.ok{ background:#256f25; border-color:#256f25 }

/* wrapper ikony + etykiety */
.world-poi {
    position: absolute;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    cursor: pointer;
}
/* stała etykieta nad ikoną */
.world-label {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(100% + 8px);
    padding: 4px 8px;
    background: rgba(0,0,0,.85);
    color: #fff;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,.12);
    white-space: nowrap;
    line-height: 1.2;
    font-size: 12px; /* delikatnie podbijana w JS przy zoomie */
    z-index: 1;
    /* NOWE: domyślnie ukryj */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .15s ease;
}
.world-label::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(0,0,0,.85);
}
#worldTooltip::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -6px;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #fff;
}
.world-poi:hover .world-label {
    opacity: 1;
    visibility: visible;
}


/* [NOWE] Panel skrótów edytora */
.poi-help{
  position:fixed;
  right:20px;
  top:160px;
  z-index:1000;
  background:rgba(0,0,0,.9);
  color:#fff;
  border:1px solid rgba(255,255,255,.12);
  border-radius:10px;
  padding:10px 12px;
  box-shadow:0 6px 18px rgba(0,0,0,.35);
  font-size:12px;
  line-height:1.3;
}
.poi-help h4{
  margin:0 0 6px 0;
  font-size:13px;
  font-weight:600;
}
.poi-help ul{ margin:0; padding:0 0 0 18px; }
.poi-help kbd{
  background:#111;
  border:1px solid rgba(255,255,255,.2);
  border-radius:4px;
  padding:0 5px;
  font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size:11px;
}

.chip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  line-height: 1;           /* żeby glify nie skakały */
  font-size: 16px;
  padding: 0;
}

/* Przycisk kopiowania */
.copy-btn {
  padding: 8px;
  background: #4a90e2;
  border: 1px solid #357abd;
  border-radius: 4px;
  color: white;
  cursor: pointer;
  font-size: 12px;
  min-width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.copy-btn:hover {
  background: #357abd;
}

.copy-btn:active {
  background: #2a5f8f;
  transform: scale(0.95);
}

.chip-btn svg { pointer-events: none; }
