/* ======================================================
   LAYOUT MAPPA + PANNELLO
====================================================== */

.obfa-map-wrap {
    display: flex;
    gap: 16px;
    padding: 16px;
    height: calc(100vh - 200px); /* header + titolo */
    box-sizing: border-box;
    align-items: stretch;
}

/* ======================================================
   MAPPA (Leaflet)
====================================================== */

#map-obfa {
    flex: 1;
    height: 100%;
    min-height: 0;
    width: auto;
    border-radius: 12px;
    overflow: hidden;
}

/* ======================================================
   PANNELLO LATERALE
====================================================== */

.obfa-panel {
    width: 320px; /* puoi portare a 280 se vuoi */
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    background: #fff;
    padding: 14px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,.08);
}

.obfa-panel-head {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
    color: #234423;
}

/* ======================================================
   FILTRI
====================================================== */

.obfa-label {
    font-size: 13px;
    font-weight: 600;
    opacity: .8;
    display: block;
    margin-top: 10px;
}

.obfa-input,
.obfa-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    margin-top: 6px;
}

/* ======================================================
   LISTA PIANTE (SCROLLABILE)
====================================================== */

#obfa-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    margin-top: 12px;
    padding-right: 4px; /* spazio scrollbar */
    -webkit-overflow-scrolling: touch;
}

.obfa-item {
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.obfa-item + .obfa-item {
    border-top: 1px solid #eee;
}

.obfa-item:hover {
    background: #f2f7f4;
}

/* ======================================================
   TOOLTIP
====================================================== */

.obfa-tooltip {
    background: #fff;
    border-radius: 10px;
    padding: 6px;
    box-shadow: 0 3px 10px rgba(0,0,0,.3);
}

/* ======================================================
   LEGENDA
====================================================== */

.obfa-legend {
    background: #ffffffdd;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,.2);
    font-size: 14px;
}

.legend-color {
    width: 14px;
    height: 14px;
    display: inline-block;
    margin-right: 5px;
    border-radius: 3px;
    border: 1px solid #00000022;
}

/* ======================================================
   ETICHETTA ZONA
====================================================== */

.obfa-zona-label {
    position: absolute;
    top: 15px;
    left: 15px;
    background: #ffffffd8;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    color: #234423;
    z-index: 900;
    box-shadow: 0 3px 10px rgba(0,0,0,.25);
}

/* ======================================================
   GALLERY INDIVIDUO
====================================================== */

.individuo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

.individuo-gallery img {
    width: 100%;
    height: auto;
    border-radius: 6px;
    transition: transform .2s ease;
}

.individuo-gallery img:hover {
    transform: scale(1.03);
}

/* ======================================================
   MOBILE
====================================================== */
@media (max-width: 768px) {

    /* ======================================================
       BLOCCA SCROLL PAGINA (fondamentale)
    ====================================================== */
    body.obfa-map-page {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
    }

    body.obfa-map-page #Wrapper,
    body.obfa-map-page #Content {
        height: 100%;
        overflow: hidden;
    }

    /* ======================================================
       MAPPA FULLSCREEN
    ====================================================== */
    .obfa-map-wrap {
        padding: 0;
        margin: 0;
        width: 100%;
        height: 100dvh;
        overflow: hidden;
    }

    #map-obfa {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100dvh;
        border-radius: 0;
        z-index: 1;
    }

    /* ======================================================
       BOTTOM SHEET (LISTA PIANTE)
    ====================================================== */
    .obfa-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 45dvh;
        background: #fff;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -10px 30px rgba(0,0,0,.25);
        z-index: 1000;

        display: flex;
        flex-direction: column;
        padding: 14px;
    }

    #obfa-list {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        padding-bottom: 20px;
        -webkit-overflow-scrolling: touch;
    }

    /* ======================================================
       LEGENDA OFF SU MOBILE
    ====================================================== */
    .obfa-legend,
    .leaflet-control.obfa-legend {
        display: none !important;
    }
}

@media (max-width: 768px) {

  /* Nascondi pannello filtri/lista */
  .obfa-panel {
    display: none !important;
  }

  /* Nascondi legenda su mobile (se ti copre) */
  .obfa-legend,
  .leaflet-control.obfa-legend {
    display: none !important;
  }

  /* Mappa full width e senza bordi */
  .obfa-map-wrap {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  #map-obfa {
    width: 100% !important;
    height: 60vh !important;     /* puoi mettere 70vh se la vuoi più grande */
    min-height: 420px;           /* sicurezza su alcuni device */
    border-radius: 0 !important;
  }

  /* Assicura che i controlli Leaflet (zoom) stiano sopra */
  .leaflet-control-container {
    z-index: 500 !important;
  }
}
