/* =========================
   Reset e layout base
   ========================= */              
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  font-family: "Helvetica Neue", Arial, sans-serif;
}

#map {
  margin: 0;
  padding: 0;
  height: 100vh;
  width: 100vw;
  position: relative;
}

/* =========================
   Leaflet popup fixes (AMEGLIA)
   ========================= */
.leaflet-popup-content {
  width: 100% !important;
  margin: 0;
  overflow: visible;
  box-sizing: border-box;
}
.leaflet-popup-content-wrapper {
  overflow: hidden;
}
.leaflet-popup-tip-container {
  overflow: hidden;
}

/* Contenuto interno */
.popup-content {
  width: 100%;
  max-height: 70vh;
  overflow: auto;
  padding: 10px;
  box-sizing: border-box;
  font-size: 16px;
  line-height: 1.5;
}
.popup-content ul {
  margin-left: 10px;
  list-style: none;
  padding: 0;
  font-size: 16px;
  line-height: 1.6;
  white-space: nowrap;
}
.popup-content iframe {
  display: block;
  width: 100%;
  height: 65vh;
  border: none;
}

/* =========================
   Popup differenziati
   ========================= */
.popup-pluvio .leaflet-popup-content-wrapper,
.popup-temp   .leaflet-popup-content-wrapper,
.popup-hum    .leaflet-popup-content-wrapper {
  width: 700px;
  max-width: 90vw;
}
.popup-idro .leaflet-popup-content-wrapper {
  width: 900px;
  max-width: 95vw;
}
.popup-vento .leaflet-popup-content-wrapper {
  width: 800px;
  max-width: 90vw;
}

/* =========================
   Controllo parametri
   ========================= */
.param-control {
  background: rgba(255,255,255,0.95);
  padding: 10px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  font-size: 14px;
}
.param-control h4 {
  margin: 0 0 8px 0;
  font-size: 15px;
  font-weight: bold;
  color: #0078d7;
}
.param-control button {
  display: block;
  width: 100%;
  margin: 4px 0;
  padding: 6px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  font-size: 14px;
}
.param-control button:hover {
  background: #f0f0f0;
}
.param-control button i {
  margin-right: 6px;
}
.param-control button.active {
  background: #0078d7;
  color: #fff;
  border: 1px solid #005a9e;
}

/* =========================
   Layer switch
   ========================= */
.leaflet-control-layers {
  background: rgba(255,255,255,0.95);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
  overflow: hidden;
}
.leaflet-control-layers-toggle {
  width: 32px;
  height: 32px;
}
.leaflet-control-layers-expanded {
  padding: 8px;
  font-size: 13px;
}
.leaflet-control-layers-selector {
  margin-right: 6px;
}

/* =========================
   Fondini vettoriali
   ========================= */
.custom-temp-icon,
.custom-hum-icon,
.custom-pluvio-icon,
.custom-idro-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  font-weight: bold;
  font-size: 14px;
}
.temp-value,
.hum-value,
.pluvio-value,
.idro-value {
  line-height: 1;
}

/* Temperature */
.temp-verycold { background: #1e3799; border: 2px solid #0c2461; }
.temp-cold     { background: #3498db; border: 2px solid #2980b9; }
.temp-cool     { background: #5dade2; border: 2px solid #2e86c1; }
.temp-mild     { background: #58d68d; border: 2px solid #28b463; }
.temp-pleasant { background: #2ecc71; border: 2px solid #27ae60; }
.temp-warm     { background: #f39c12; border: 2px solid #d35400; }
.temp-hot      { background: #e67e22; border: 2px solid #ca6f1e; }
.temp-veryhot  { background: #e74c3c; border: 2px solid #c0392b; }
.temp-extreme  { background: #922b21; border: 2px solid #641e16; }
.temp-offline  { background: #7f8c8d; border: 2px solid #555; }

/* Umidità */
.hum-offline   { background: #7f8c8d; border: 2px solid #555; }
.hum-verylow   { background: #f5b041; border: 2px solid #d35400; }
.hum-low       { background: #f39c12; border: 2px solid #d68910; }
.hum-medium    { background: #58d68d; border: 2px solid #28b463; }
.hum-high      { background: #5dade2; border: 2px solid #2e86c1; }
.hum-extreme   { background: #2e86c1; border: 2px solid #1b4f72; }

/* Vento */
.custom-vento-icon {
  position: relative;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #3498db;
  border: 2px solid #21618c;
  color: #fff;
  font-weight: bold;
  font-size: 14px;
}
.vento-value {
  font-size: 14px;
  line-height: 1;
}
.vento-dir {
  font-size: 16px;
  line-height: 1;
  transform-origin: center center;
  margin-top: 2px;
}
.vento-offline {
  background: #7f8c8d;
  border: 2px solid #555;
}

/* Pioggia */
.pluvio-offline { background: #7f8c8d; border: 2px solid #555; }
.pluvio-zero    { background: #bdc3c7; border: 2px solid #95a5a6; }
.pluvio-5       { background: #a9dfbf; border: 2px solid #7dcea0; }
.pluvio-10      { background: #58d68d; border: 2px solid #28b463; }
.pluvio-30      { background: #5dade2; border: 2px solid #2e86c1; }
.pluvio-50      { background: #3498db; border: 2px solid #21618c; }
.pluvio-70      { background: #2e86c1; border: 2px solid #1b4f72; }
.pluvio-100     { background: #1f618d; border: 2px solid #154360; }
.pluvio-200     { background: #6c3483; border: 2px solid #4a235a; }
.pluvio-300     { background: #8e44ad; border: 2px solid #5b2c6f; }
.pluvio-extreme { background: #c71585; border: 2px solid #8b0a50; }

/* Idrometri */
.idro-offline { background: #7f8c8d; border: 2px solid #555; }
.idro-verde   { background: #58d68d; border: 2px solid #28b463; }
.idro-arancio { background: #f39c12; border: 2px solid #d35400; }
.idro-rosso   { background: #e74c3c; border: 2px solid #c0392b; }


/* LOGIN — stile desktop */
.login-inner input {
    display: block;
    width: 100%;
    margin-bottom: 8px;
    padding: 8px;
    font-size: 14px;
    box-sizing: border-box;
}

.login-inner button {
    width: 100%;
    padding: 8px;
    font-size: 14px;
    margin-top: 4px;
}

/* ============================================================
   MOBILE — SLIDE-IN PANEL (70%) stile Windy
   ============================================================ */
@media (max-width: 768px) {

    html, body {
        overflow-x: hidden;
    }

    #mobile-menu-btn {
        position: fixed;
        bottom: 15px;
        left: 15px;
        width: 48px;
        height: 48px;
        background: #0078d7;
        color: white;
        border-radius: 8px;
        font-size: 28px;
        z-index: 10000002;
        box-shadow: 0 2px 6px rgba(0,0,0,0.35);
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
    }

    #mobile-panel {
        position: fixed;
        top: 0;
        left: -70%;
        width: 70%;
        max-width: 70%;
        height: 100vh;
        background: rgba(255,255,255,0.97);
        box-shadow: 3px 0 10px rgba(0,0,0,0.3);
        z-index: 10000001;
        transition: left 0.3s ease;
        overflow-y: auto;
        padding: 10px;
        box-sizing: border-box;
    }

    #mobile-panel.open {
        left: 0;
    }

    #mobile-panel .param-control {
        position: relative !important;
        margin: 0 !important;
        box-shadow: none !important;
        background: transparent !important;
        padding: 0 !important;
    }

    .leaflet-top.leaflet-left .param-control {
        display: none !important;
    }

    .login-inner input {
        display: block;
        width: 100%;
        margin-bottom: 10px;
        font-size: 16px;
        padding: 10px;
        border-radius: 6px;
        border: 1px solid #ccc;
        box-sizing: border-box;
    }

    .login-inner button {
        width: 100%;
        padding: 10px;
        font-size: 16px;
        border-radius: 6px;
        margin-top: 4px;
    }
}

/* =========================
   FIX SCROLL DESKTOP — PRESENTAZIONE
   ========================= */
@media (min-width: 769px) {

    html, body {
        overflow: hidden !important;
        height: 100%;
        width: 100%;
    }

    #map {
        position: fixed !important;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        overflow: hidden !important;
    }
}

/* ============================================================
   COOKIE BANNER
   ============================================================ */
#cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  background: rgba(255,255,255,0.97);
  padding: 12px 16px;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  font-size: 14px;
  z-index: 10000000;

  /* stato iniziale */
  display: none;
}
     

#cookie-banner .cookie-text {
  flex: 1 1 auto;
  min-width: 200px;
}




.cookie-buttons {
  display: flex;
  gap: 8px;
}

.cookie-buttons button {
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  background: #0078d7;
  color: white;
  font-size: 14px;
}

#cookie-manage {
  position: fixed;
  left: 10px;
  background: rgba(255,255,255,0.9);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  z-index: 9999999;
  border: 1px solid #ccc;
}

/* Desktop */
@media (min-width: 769px) {
    #cookie-banner {
        bottom: 0;
        top: auto;
    }
    #cookie-manage {
        bottom: 10px;
        top: auto;
    }
}

/* Mobile */
@media (max-width: 768px) {
    #cookie-banner {
        top: 0;
        bottom: auto;
    }
    #cookie-manage {
        top: 10px;
        left: 60px;
    }
}
   