body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  display: flex;
  flex-direction: row; /* Postavlja sidebar lijevo, a mapu desno */
  overflow-x: hidden; /* Sprečava kvarenje ekrana sa strane */
  background-color: #bca779;
  position: relative;
}

/* Osigurava da se vaša SVG mapa ispravno širi i skuplja */
svg {
  width: 100%;
  height: auto;
  max-height: 100vh;
  display: block;
  flex: 1;
}

.sidebar {
  width: 300px;
  height: 100vh;
  background-color: #302011;
  position: sticky; /* Stabilnije za responzivni flex raspored */
  top: 0;
  left: 0;
  padding: 20px;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 1);
  box-sizing: border-box;
  flex-shrink: 0; /* Ne dozvoljava meniju da se suzi na desktopu */
}

.sidebar .logo {
  display: flex;
  justify-content: center;
}

.sidebar .logo img {
  max-width: 70%;
  height: auto;
}

.sidebar .nav-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 80%;
}

.sidebar .nav-links li {
  margin-bottom: 30px;
}

.sidebar .nav-links a {
  text-decoration: none;
  color: #bca779;
  font-size: 20px;
  text-align: center;
  display: block;
  padding: 2px;
  border-radius: 4px;
  transition: background-color 0.3s;
}
.sidebar .nav-links a:hover {
  background-color: #8f7e5a;
}

.cls-1:hover {
  fill: #302011;
}

.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 999;
}

.popup {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #302011;
  padding: 0;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  width: 90%;
  max-width: 800px;
}

.overlay.show {
  display: block;
}
.popup.show {
  display: block;
  animation: slideIn 0.4s ease-out forwards;
}

.content-container {
  display: flex;
  align-items: stretch;
  width: 100%;
}

.text-container {
  flex: 1;
  padding: 30px;
  color: #c9b98f;
}

.general-rules {
  font-weight: bold;
  margin-bottom: 5px;
}

.popup img {
  width: 50%;
  object-fit: cover;
  margin: 0;
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
}

#popup-herne .text-container,
#popup-cespar .text-container {
  padding: 45px 40px;
}

.popup .close-popup-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  font-weight: bold;
  font-size: 16px;
  color: #302011;
  background: #bfaa7b;
  border: none;
  border-radius: 5px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  z-index: 1002;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.2s,
    color 0.2s;
}

.popup .close-popup-btn:hover {
  color: #302011;
  background: #c9b98f;
}

@keyframes slideIn {
  from {
    transform: translate(-50%, -60%) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

/* ========================================== */
/* STIL ZA FIKSIRANI INFO PROZOR U DESNOM ĆOŠKU */
/* ========================================== */
.map-tooltip {
  position: fixed;
  display: none;
  top: 20px;
  right: 20px;
  background: #302011;
  color: #c9b98f;
  padding: 15px 20px;
  border-radius: 8px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
  z-index: 999999;
  white-space: pre-line;
  width: 250px;
}

/* ========================================== */
/* STIL ZA NOVI PROZOR IKONA (LIJEVI ĆOŠAK)    */
/* ========================================== */

#ikone path {
  cursor: pointer;
}

.icon-info-window {
  position: fixed;
  display: none;
  top: 150px;

  /* --- ISPRAVKA: Prozor pomjeren lijevo, odmah do sidebara --- */
  left: 320px;
  right: auto;

  background: #302011;
  border-radius: 8px;
  width: 453px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.7);
  z-index: 999999;
  overflow: hidden;
  font-family: Arial, Helvetica, sans-serif;
}

.icon-info-window img {
  width: 453px;
  height: 252px;
  object-fit: cover;
  display: block;
}

.window-text-content {
  padding: 15px;
  color: #c9b98f;
}

.window-name {
  font-weight: bold;
  font-size: 17px;
  margin-bottom: 5px;
  color: #bca779;
}

.window-type {
  font-size: 14px;
  line-height: 1.4;
}

/* ========================================== */
/* STIL ZA DUGMAD I ANIMACIJU CRTANJA LINIJA   */
/* ========================================== */

.map-controls-bottom {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  gap: 10px;
  z-index: 100000;
}

.map-controls-bottom .control-btn {
  background: #302011;
  color: #c9b98f;
  border: 1px solid #bca779;
  border-radius: 5px;
  padding: 10px 15px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  transition:
    background 0.2s,
    color 0.2s;
}

.map-controls-bottom .control-btn:hover {
  background: #bfaa7b;
  color: #302011;
}

.drawing-animation {
  stroke: #302011;
  stroke-width: 1px;
  animation: drawLine 2.5s ease-in-out forwards;
}

@keyframes drawLine {
  from {
    stroke-dashoffset: var(--path-length);
  }
  to {
    stroke-dashoffset: 0;
  }
}

/* ======================================================= */
/* SVEOBUHVATNE POPRAVKE ZA TELEFONE I MANJE EKRANE        */
/* ======================================================= */
@media (max-width: 768px) {
  body {
    flex-direction: column; /* Pomijera meni na vrh, a mapu ispod njega */
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  }

  .sidebar .nav-links {
    height: auto;
    flex-direction: row; /* Linkovi idu vodoravno u niz */
    flex-wrap: wrap; /* Prelaze automatski u novi red ako nema mjesta */
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
  }

  .sidebar .nav-links li {
    margin-bottom: 0; /* Resetujemo razmak sa desktopa */
  }

  .sidebar .nav-links a {
    font-size: 14px;
    padding: 6px 12px;
    background-color: rgba(143, 126, 90, 0.15);
  }

  /* Prilagođavanje pop-up prozora */
  .content-container {
    flex-direction: column-reverse;
  }

  .popup img {
    width: 100%;
    height: 180px;
    border-radius: 10px 10px 0 0;
  }

  #popup-herne .text-container,
  #popup-cespar .text-container {
    padding: 25px 20px;
  }

  /* Info prozorčići se na telefonima fiksiraju na dno (Ignoriše left pravilo sa desktopa) */
  .map-tooltip,
  .icon-info-window {
    position: fixed !important;
    top: auto !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 15px 15px 0 0 !important; /* Zaobljeni samo gornji uglovi */
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.5);
    transform: none !important;
  }

  .icon-info-window img {
    width: 100% !important;
    height: 160px !important;
  }

  /* Pomijera "Draw" dugmad iznad info prozora na dnu telefona */
  .map-controls-bottom {
    bottom: 80px;
    left: 10px;
    right: 10px;
    justify-content: center;
  }

  .map-controls-bottom .control-btn {
    padding: 8px 12px;
    font-size: 12px;
  }
}
