html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
    #map {
      position: absolute;
      top: 0;
      bottom: 0;
      left: 0;
      right: 0;
    }

    /* Toolbar verticale a sinistra */
    .toolbar-vertical {
      position: absolute;
      top: 80px;
      left: 10px;
      z-index: 1100;
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    /* Toolbar orizzontale in alto */
    .toolbar-horizontal {
      position: absolute;
      top: 10px;
      left: 60px;
      z-index: 1100;
      display: flex;
      flex-direction: row;
      gap: 6px;
    }

    /* Bottone base (quadrato blu con icona bianca) */
    .tool-btn {
      width: 40px;
      height: 40px;
      border: none;
      border-radius: 2px;
      background: linear-gradient(#0b63c4, #0153a3);
      color: #ffffff;
      font-size: 18px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      box-shadow: 0 2px 4px rgba(0,0,0,0.4);
      padding: 0;
    }

    .tool-btn i {
      pointer-events: none;
    }

    .tool-btn:hover {
      background: linear-gradient(#1977de, #0b63c4);
    }

    .tool-btn.disabled {
      background: linear-gradient(#f2f2f2, #d9d9d9);
      color: #888;
      cursor: default;
      box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    }

    .tool-btn.disabled:hover {
      background: linear-gradient(#f2f2f2, #d9d9d9);
    }

    /* ===========================
       PANNELLO LAYER A DESTRA
       =========================== */

    /* ===========================
   PANNELLO LAYER A DESTRA (SEMPLIFICATO)
   =========================== */

#layers-panel {
  position: absolute;
  top: 60px;
  right: 10px;
  width: 260px;
  max-height: 70%;
  background: #f5f5f5;
  border-radius: 3px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: 13px;
}

/* Barra blu "Visualizzatore" */
#layers-panel-header {
  background: #0b63c4;
  color: #ffffff;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

#layers-panel-header-title {
  font-weight: 600;
}

/* Contenuto scrollabile: solo elenco layer */
#layers-panel-body {
  padding: 10px;
  overflow-y: auto;
  background: #ffffff;
  flex: 1;
}

#layers-panel-body h3 {
  margin: 0 0 8px 0;
  font-size: 13px;
  color: #444;
}

/* Singolo layer */
.layer-item {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.layer-item input[type="checkbox"] {
  margin: 0;
}

.layer-item label {
  cursor: pointer;
  flex: 1;
}


#info-panel {
  position: absolute;
  right: 10px;
  bottom: 50px;
  min-width: 280px;
  max-width: 380px;
  max-height: 260px;
  background: #ffffff;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
  z-index: 1500;
  overflow: hidden;
  display: none;        /* nascosto di default */
  font-size: 12px;
}

/* Header blu con titolo e X */
#info-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0b63c4;
  color: #ffffff;
  padding: 4px 8px;
  font-weight: 600;
}

#info-panel-close {
  border: none;
  background: transparent;
  color: #ffffff;
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
}

#info-panel-close:hover {
  opacity: 0.8;
}

/* Corpo scrollabile */
#info-panel-body {
  padding: 8px;
  max-height: 220px;
  overflow: auto;
}

/* Tabella attributi */
.info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.info-table th,
.info-table td {
  padding: 3px 6px;
  vertical-align: top;
}

.info-table th {
  width: 35%;
  text-align: left;
  background: #f5f5f5;
  font-weight: 600;
}

.info-table tr:nth-child(even) th,
.info-table tr:nth-child(even) td {
  background: #fafafa;
}



/* ===== BOTTOM BAR ===== */

#bottom-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 40px;
  z-index: 1200;

  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;

  background: #003b78;
}



/* Barra blu con CRS, coordinate e scala */
#status-bar {
  flex: 1;
  height: 40px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 12px;
  color: #fff;
}


#status-bar span {
  white-space: nowrap;
}

.status-sep {
  margin: 0 10px;
}


/* --- CONTENITORE PRINCIPALE DELLA OVERVIEW --- */
.ol-overviewmap {
  position: absolute !important;
  top: 420px !important;
  left: 10px !important;

  width: 180px !important;
  height: 165px !important;  /* + top bar */

  background: #ffffff;
  border-radius: 6px;
  overflow: hidden;
  z-index: 2000;

  box-shadow: 0 6px 14px rgba(0,0,0,0.35);
  border: 1px solid #ccc;

  display: flex !important;
  flex-direction: column !important;
}

/* --- TOP BAR DELLA CARD --- */
.ol-overviewmap::before {
  content: "Overview";
  display: block;
  width: 100%;
  background: #0b63c4;
  color: white;
  font-size: 12px;
  padding: 4px 6px;
  font-weight: 600;
  box-sizing: border-box;
}

/* --- CONTENITORE DELLA MINI MAPPA --- */
.ol-overviewmap .ol-overviewmap-map {
  width: 100% !important;
  height: calc(100% - 24px) !important; /* sottrae la top bar */
}

/* Solo le tile della overview in bianco e nero */
.ol-overviewmap .ol-overviewmap-map .ol-layer > canvas,
.ol-overviewmap .ol-overviewmap-map .ol-layer > img {
  filter: grayscale(100%) brightness(0.9) contrast(1.1);
}



/* --- RETTANGOLO ROSSO DELLâ€™INQUADRAMENTO --- */
.ol-overviewmap-box {
  border: 2px solid red !important;
}

/* --- NASCONDI IL BOTTONE +/- DI DEFAULT --- */
.ol-overviewmap button {
  display: none !important;
}

.tool-btn.active {
  outline: 2px solid yellow;
}

/* ---LOADING OVERLAY--- */
/* Overlay morbido con sfocatura */
/* =====================================
   OVERLAY CARICAMENTO DINAMICO
   ===================================== */

#loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.20);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 4000;
}

/* Box principale */
#loading-box {
  width: 260px;
  border-radius: 10px;
  box-shadow: 0 8px 22px rgba(0,0,0,0.35);
  overflow: hidden;
  font-family: sans-serif;
}

/* Header bianco con logo */
#loading-header {
  background: #ffffff;
  padding: 8px 12px;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
}

.logo-blue {
  color: #2c6fd6;
}

.logo-orange {
  color: #f0a000;
}

/* Corpo grigio */
#loading-body {
  background: #666666;
  padding: 16px 14px 14px 14px;
  text-align: center;
  color: #ffffff;
}

/* Cerchio di caricamento */
.loading-spinner {
  width: 42px;
  height: 42px;
  margin: 0 auto 10px auto;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.35);
  border-top-color: #ffffff;
  animation: spin 0.8s linear infinite;
}

/* Testo caricamento */
#loading-text {
  font-size: 14px;
  margin-bottom: 10px;
}

/* Barra di progresso */
#loading-progress {
  width: 100%;
  height: 10px;
  background: #f0f0f0;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: inset 0 0 3px rgba(0,0,0,0.4);
}

#loading-bar {
  height: 100%;
  width: 0%;
  background: #2c6fd6;
  transition: width 0.2s ease-out;
}

/* Animazioni */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* query panel */
#query-panel{
  position: fixed;
  top: 10px;
  left: 382px;
  z-index: 3000;

  height: 40px;                 /* ?? UGUALE AI BOTTONI */
  display: none;                /* controllato via JS */
  align-items: center;

  background: linear-gradient(#0b63c4, #0153a3);
  color: #fff;
  padding: 0 10px;              /* ?? niente padding verticale */
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);

  font-size: 13px;
  white-space: nowrap;
}

#query-panel label{
  margin-right: 10px;   /* prova 8–12px a gusto */
  font-weight: 500;
}

/* select */
#query-layer-select{
  width: 220px;
  max-width: 220px;
  flex: 0 0 auto;

  padding: 3px 10px;
  font-size: 12px;

  border: 1px solid #417a42;
  border-radius: 999px;

  background: #fff;
  color: #333;

  box-sizing: border-box;
  outline: none;

  overflow: hidden;
  text-overflow: ellipsis;
}

#query-layer-select:focus{
  box-shadow: 0 0 0 2px rgba(65,122,66,0.25);
}