/* Resets bàsics */
#sidebar { /* o el selector que utilitzes per al sidebar */
    height: 100vh; /* altura del viewport */
    overflow-y: auto; /* activa el desplaçament vertical */
}


/* Perquè el sidebar no estigui visible al principi */
.leaflet-sidebar {
    display: none;          /* IMPORTANT */
    position: absolute;
    top: 10px;
    left: 70px;
    width: 450px;
    height: calc(100% - 20px);
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}


/* Quan estigui actiu, que es mostri */
.leaflet-sidebar.active {
    display: block;  
} 

.leaflet-left .leaflet-control-zoom {
    top: 10px; /* O la distància que vulguis */
  }

#tooltip-capes{
  position: absolute;   /* IMPORTANT: fora del layout del mapa */
  z-index: 999999;   /* IMPORTANT: per sobre de Leaflet */
  pointer-events: none; /* opcional */
  background: white;
  border-radius: 8px;
  height: 20px;
  top: 100px;
  left: 50px;
}

  

/* Botó de plegar/desplegar */
.sidebar-toggle-btn {
    position: absolute;
    width: 35px;
    height: 35px;
    background: white;
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    padding: 0;
    cursor: pointer;
    z-index: 1001;
    font-size: 24px;
    line-height: 40px;
    text-align: center;
    top: 10px;
    left: 10px;
}

.sidebar-toggle-btn:focus {
    outline: none;
}

  

.sublevel-content {
    padding-left: 15px;
    display: none; /* Plegat per defecte */
    transition: all 0.3s ease;
}

.expanded {
    display: block !important; /* Expandit quan s'obri */
}

#sidebar-content {
    display: flex;
    flex-direction: column;
    margin: 10px;
}

#ressenyagpx{
  resize: vertical;
  max-height: 140px; /* evita que s’empassi mig modal */
}

.icon-choice{
  width: 28px;
  height: 28px;
  cursor: pointer;
}




/* Contenidor del mapa */
#map {
    margin-top: 30px; /* Ajusta aquest valor a l'altura de la teva navbar */
    height: calc(100vh - 30px); /* El mapa ocupa tota la finestra menys l'alçada de la navbar */
    position: relative;
}




html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    padding-top: 0px;  
}


/* Taula dins del sidebar */
#table-body {
    flex-grow: 1;
    overflow-y: auto;
}


th, td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
    font-size: 12px;
}

tbody tr:hover {
    background-color: #f1f1f1;
}


#layerwatch {
    font-size: 12px;
}

/* Estils generals */
.marker-desc {
    width: 250px;
    min-height: 80px;
    text-align: justify;
    color: #333;
    font-size: 14px;
    padding: 10px;
}

.button-map {
    background: #333;
    color: #fff;
    border: 1px solid #333;
    border-radius: 20px;
    padding: 10px 30px;
    margin-bottom: 20px;
}

.button-map:hover {
    background: #fff;
    color: #333;
    cursor: pointer;
    transition: all 0.5s;
}

/* Botó de tancament */
.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

#map-list-button {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    padding: 10px;
    font-size: 14px;
}

/* Ajustos de mida i padding */
.small-label {
    font-size: 0.8rem;
}

.small-range {
    height: 8px;
}

.small-padding {
    padding: 2px;
}

.form-check-label {
    font-size: 0.8rem;
}

h44 {
    font-size: 14px;
    margin: 0;
    font-style: italic;
    color: #006400;
}

.radio-group {
    display: flex;
    align-items: center;
}

.radio-group label {
    margin-right: 25px;
}

.icona-seleccionada {
    background-color: grey;
    border-radius: 8px;
    padding: 4px;
}



.sidebar-header {
    padding: 10px;
    font-size:14px;
    background: #3D52A0;
    color: #EDE8F5;
    font-weight: bold;
}

.control-section {
    padding: 10px;
}

.back01 {

    background: #ADBBDA;

}

.layer-group-title {
    cursor: pointer;
    font-weight: bold;
    margin: 10px 0 5px;
    color: #007bff;
    display: flex;
    align-items: center;
}

.toggle-icon {
    cursor: pointer;
    margin-right: 5px;
    user-select: none;
    transition: transform 0.2s ease;
}

.expanded + .toggle-icon {
    transform: rotate(90deg);
}


/* Indentació visual per nivells */
.checkbox-indent-1 {
    padding-left: 15px;
}
.checkbox-indent-2 {
    padding-left: 30px;
}
.checkbox-indent-3 {
    padding-left: 45px;
}


/* Posicionament individual */
#sidebar-toggle {
    top: 90px;
    left: 10px;
}

#sidebar-toggle2 {
    top: 140px; /* apareix sota el primer */
    left: 10px;
}


.icon-with-r {
    position: relative;
    font-size:12px;
}

.overlay-r {
    position: absolute;
    top: 4px;
    left: 12px;
    font-size: 12px; /* 🔽 Aquesta línia fa la R més petita */
    font-weight: bold;
    color: #3D52A0;
    pointer-events: none;
}

.ModalLabell {
    background: #3D52A0 !important;
}

.btn-dangerM {
    color:white;
    background: #964734;
  } 


.tab {
 
   color: #3D52A0;

}


.tab-close {
    width: 20px; /* més estret que les pestanyes normals */
    background-color: transparent;
    border: none;
    color: white; /* creu blanca */
    background: #964734;
   
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
}
.tab-close:hover {
    background-color: rgba(255, 255, 255, 0.1); /* subtil hover */
}


.btn-primaryM {
color: #3D52A0;
background: #EDE8F5;
}

.btn-secondaryM {
color: #3D52A0;
background: #EDE8F5;
}

.Pugi {
    color: #3D52A0;
   
    }

#tableContainer {
    position: relative;
    border: 1px solid #ccc;
  }

#tableContainer thead th {
    position: sticky;
    top: 0;
    background-color: #7091E6;
    color: white;
    z-index: 2;
    cursor: pointer;
    border-bottom: 1px solid #ccc;
}

.mapestructura-text {
    color: #3D52A0;
    font-size: 12px;
    text-align: right;
    margin-right: 10px;
    margin-top: 4px; /* o el marge que prefereixis */
  }

.close-btn {
    color: white; /* Color del text */
    background: #3D52A0;
    border: none;
  
    font-size: 12px;
    cursor: pointer;
    position: absolute;
   
    right: 10px; /* Distància des de la dreta */
}

 .leaflet-sidebar.closed {
    display: none; /* Mostrar el sidebar */
  }

  .tab-buttons {
    display: flex;
   /* border-bottom: 1px solid #ccc; */
  }

  .tab-buttons button {
    flex: 1;
    padding: 8px;
    border: none;
    cursor: pointer;
  }

  .tab-1 {
    background: #7091E6;
  }

   .tab-2 {
    background: #8697C4;
  }

   .tab-3 {
    background: #ADBBDA;
  }

  .tab-buttons button.active {
    background: #EDE8F5;
    font-weight: bold;
  }

  .tab-content {
    display: none;
    padding: 10px;
  }

  .tab-content.active {
    display: block;
  }


.custom-file-upload {
    display: inline-block;
    padding: 6px 12px;
    cursor: pointer;
    color: #fff;
    background-color: #3D52A0;; /* Color de Bootstrap btn-info */
    border: 1px solid #3D52A0;
    border-radius: 4px;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.custom-file-upload:hover {
    background-color: #138496;
}


    #galeriaGrid .foto-item {
        position: relative;
        cursor: pointer;
        transition: transform .2s;
    }

    #galeriaGrid .foto-item:hover {
        transform: scale(1.03);
    }

  

    .foto-actions {
        display: flex;
        gap: 4px;
        z-index: 5;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease-in-out;
    }

    .foto-item:hover .foto-actions {
        opacity: 1;
        pointer-events: auto;
    }

    .foto-item:hover img {
        filter: brightness(0.9);
    }




    /* Botons icona unificats (galeria + lightbox) */
    .media-icon-btn {
    width: 32px;
    height: 32px;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    line-height: 1;
    }

    /* Footer del lightbox: icones a l'esquerra, tancar a la dreta */
        #lightboxModal .modal-footer {
        display: flex;
        justify-content: space-between;
        align-items: center;
        }

        /* Grup d'icones */
        #lightboxModal .lightbox-actions {
        display: flex;
        gap: 6px;
        }







    .foto-actions .btn {
        padding: 2px 6px !important;
        font-size: 0.75rem !important;
        line-height: 1.1;
        }


    .foto-principal {
        border: 3px solid gold;
    }

    .foto-cim {
        height: 220px;        /* ajusta: 180–260 segons gust */
        object-fit: cover;    /* manté proporció i retalla */
        object-position: center;
    }

    .foto-galeria {
        width: 100%;
        height: 160px;        /* clau */
        object-fit: cover;
        object-position: center;
    }

#lightboxImage {
  max-height: 80vh;
  width: auto;
  object-fit: contain;   /* aquí millor contain */
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;

  padding: 10px 16px;
  background-color: #bfbfc1;
  color: white;

  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;

  box-shadow: 0 2px 4px rgba(0,0,0,.15);
  transition: all .2s ease;
}

.download-btn:hover {
  background-color: #8f9194;
  transform: translateY(-1px);
}

.download-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
