/* Animacja dla collapse */
.collapse {
    display: none;
}

.collapse.show {
    display: block;
}

.collapsing {
    height: 0;
    overflow: hidden;
    transition: height 0.35s ease;
}

/* Responsive mapa - automatycznie dostosowuje wysokość do dostępnej przestrzeni */
#map {
    /* Użyj dostępnej przestrzeni viewport minus szacowany header i padding */
    height: calc(100vh - 220px);
    min-height: 300px; /* Minimalna wysokość dla małych ekranów */
    width: 100%;
    transition: height 0.3s ease-in-out; /* Płynna animacja */
}

/* Dostosuj wysokość mapy gdy filtry są rozwinięte */
.filters-expanded #map {
    height: calc(100vh - 350px);
}

.producers-expanded #map {
    height: calc(100vh - 350px);
}

.filters-expanded.producers-expanded #map {
    height: calc(100vh - 480px);
}

/* Dostosowania dla mniejszych ekranów */
@media (max-height: 700px) {
    #map {
        height: calc(100vh - 180px);
        min-height: 250px;
    }

    .filters-expanded #map {
        height: calc(100vh - 310px);
    }

    .producers-expanded #map {
        height: calc(100vh - 310px);
    }

    .filters-expanded.producers-expanded #map {
        height: calc(100vh - 440px);
    }
}

/* Bardzo małe ekrany */
@media (max-height: 500px) {
    #map {
        height: calc(100vh - 150px);
        min-height: 200px;
    }

    .filters-expanded #map {
        height: calc(100vh - 280px);
    }

    .producers-expanded #map {
        height: calc(100vh - 280px);
    }

    .filters-expanded.producers-expanded #map {
        height: calc(100vh - 410px);
    }
}

/* Style dla modalu */
.modal-dialog {
    overflow: visible !important;
    max-width: 70%;
    margin: 0; /* Usuwamy marginesy */
}

.modal-body {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

#pointModal .modal-dialog {
    max-width: 70%;
    width: 50%;
    position: absolute; /* Wracamy do absolute */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* Centrujemy modal */
}

#pointModal.dragging .modal-dialog {
    transform: none; /* Wyłączamy centrowanie podczas przeciągania */
}

.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.1);
}

/* Ukrywamy scrollbar na stronie głównej gdy modal jest otwarty */
body.modal-open {
    overflow: hidden !important;
    padding-right: 0 !important;
}

/* Styl dla zawartości modalu */
#pointModal .modal-content {
    overflow: hidden;
    height: auto;
    max-height: 85vh;
}

/* Poprawka na header modalu do przeciągania */
#pointModal .modal-header {
    cursor: move;
}

/* Zapobieganie przesuwaniu się tła */
.modal {
    padding-right: 0 !important;
}


.icon-preview-select {
    font-family: "Font Awesome 6 Free", "Font Awesome", sans-serif;
  }
  .fa-preview {
    margin-right: 0.5rem;
  }
  
/* Styl tooltipa */
.custom-tooltip {
  min-width: 250px; /* Zmniejszona minimalna szerokość */
  max-width: 400px; /* Maksymalna szerokość tooltipa */
  /* Usunięto max-height - tooltip rozciągnie się do pełnej wysokości */
  overflow: visible; /* Brak przewijania - pokazuj całą zawartość */
  display: block;
  word-wrap: break-word; /* Zawijanie długich słów */
  overflow-wrap: break-word; /* Dodatkowe wsparcie dla zawijania */
  white-space: normal !important; /* Wymuszenie normalnego zawijania tekstu */
  cursor: default; /* Pokazuje że tooltip jest interaktywny */
  position: relative;
  z-index: 1000 !important; /* Upewnij się że tooltip jest ponad mapą */
  pointer-events: auto !important; /* Upewnij się że tooltip przechwytuje zdarzenia myszy */
}

/* Rozszerzenie obszaru interakcji tooltipa */
.custom-tooltip::before {
  content: '';
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -20px; /* Większy obszar na dole, gdzie łączy się z markerem */
  z-index: -1;
}



/* Styl zawartości tooltipa */
.custom-tooltip .leaflet-tooltip-content {
  padding: 0;
  /* Usunięto max-height i overflow - tooltip rozciągnie się do pełnej wysokości */
  pointer-events: auto !important; /* Zawartość też musi przechwytywać zdarzenia */
}

/* Usunięto style paska przewijania - tooltip nie będzie przewijalny */

.marker-tooltip {
  width: 100%;
  padding: 10px; /* Dodanie paddingu dla lepszego wyglądu */
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto; /* Dodaje przenoszenie wyrazów, jeśli to możliwe */
  white-space: normal !important;
  position: relative; /* Dla pozycjonowania przycisku zamykania */
}

/* Przycisk zamykania tooltipa */
.tooltip-close-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 3px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  color: #666;
  transition: all 0.2s;
  z-index: 1001;
  pointer-events: auto !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.tooltip-close-btn:hover {
  background: #f0f0f0;
  color: #333;
  border-color: #999;
}

/* Nagłówek tooltipa */
.marker-tooltip h6 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #333;
}

/* Styl obrazków w tooltipie */
.marker-tooltip .order-photos img {
  width: 100%; /* Obrazek dopasowuje się do szerokości tooltipa */
  max-width: 300px; /* Maksymalna szerokość obrazka */
  height: auto; /* Zachowanie proporcji */
  object-fit: cover; /* Dopasowanie obrazka */
  display: block; /* Wyświetlanie jeden pod drugim */
  margin: 4px auto; /* Wyśrodkowanie obrazka i odstęp między nimi */
  border: none; /* Usunięcie obramowania */
  padding: 0;
}


/* Styl dla zdjęć w tooltipie */
.tooltip-photo img {
  transition: transform 0.2s ease;
  border-radius: 4px;
  max-height: 250px;
  max-width: calc(100% - 50px);
  object-position: top center;
  object-fit: cover;
  margin: 0 auto;
  display: block;
}
.tooltip-photo img:hover {
  transform: scale(1.05);
}

.marker-tooltip p, 
.marker-tooltip div, 
.marker-tooltip span, 
.marker-tooltip h6, 
.marker-tooltip small {
  max-width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word; 
}

.marker-tooltip * {
  overflow-wrap: anywhere;
}

/* Style dla zakładek w modalu punktu */
#pointModalTabs .nav-link {
  font-weight: 500;
  color: #6c757d;
}

#pointModalTabs .nav-link.active {
  font-weight: 600;
  color: #0d6efd;
}

/* Style dla listy zamówień */
#ordersList .list-group-item {
  transition: all 0.2s ease;
}

#ordersList .list-group-item:hover {
  background-color: #f8f9fa;
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Style dla pojedynczego zamówienia */
#pointSingleOrder .card {
  border: none;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

#pointSingleOrder .card-header {
  padding: 0.75rem 1.25rem;
}

#singleOrderPhotos img {
  transition: all 0.2s ease;
  cursor: pointer;
}

#singleOrderPhotos img:hover {
  opacity: 0.8;
  transform: scale(1.05);
}



