*,#sidebarinfo{
    font-family: Roboto, sans-serif;
}


/* STILE HOME */

#header{
    background-image: none;
    height:  auto;
    max-width: 100%;
    position: static !important;
    background-color: #fff;
}

#header .ubermenu .ubermenu-nav{
    position: relative;
}

#logo img{
    max-width:220px;
}

#header:not(.header-webtv) nav.ubermenu.ubermenu-main {
    width: 100%;
    float: none;
    margin-right: 150px;
    background: #4e77ad;
    display: flex !important;
    justify-content: center;
}  

#container{
    padding: 40px 0 0 0;
}

.home #contentfull{
    padding-top:0px;
}

.bigarticolo .imgevidenza a {
    display: inline;
}

.bigarticolo .imgevidenza a img {
    width: 100%;
}

div.infotraffico-section {
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    float: none;
    margin-bottom: 0;
    margin-right: 0;
    padding-bottom: 0;
    min-height: 1px;
    max-width: calc(100% - 420px);
}

.marquee{
    line-height: 50px;
}

.infotraffico-section  .news-title{
    color:#fff;
}

.home #content-archive{
    margin-top:15px;
}

.home .newsdescription {
    bottom: -42px;
    padding: 10px;
}

#chiusure{
    margin-top:0;
}

.home .newsdescription {
    max-width: 980px;
}

.wrapper-inside{
    max-width: 980px;
    margin: 0 auto;
    padding: 0 10px;
}

.home .bigarticolo{
    padding:0;
    max-width: 100%;
}

.home .bigarticolo .post h2 a {
    line-height: 1;
}

.home #content-archive .bigarticolo .post {
    margin: 0 0 50px 0;
    border:0;
}

.insideheader .top{
    height:100px;
}

@media (max-width: 980px) {
    .home .newsdescription{
        position: static;
        background: #fff;
        box-shadow: none;
        padding-bottom:20px;
    }

    .home #wrapper {
        padding: 0;
    }

    .page-template-template-homepage div.infotraffico-section{
        width: 100%;
        display: block;
        max-width: 100%;
    }

    .home .bigarticolo .post {
        margin: 0;
    }

}

@media (max-width: 768px) {

    #nav_menu-2 .widget-title h4{
        background-size: 20px auto;
    }

    #menu-principale li {
        margin: 10px 0;
    }

    #menu-principale li .sub-menu li.sub_ubermenu_item a{
        line-height: 1;
    }

    .bigarticolo {
        margin: 0;
    }

    #top-widget{
        position: relative;
    }

    .boundary {
        margin-bottom: 18px;
      }

      .home #contentfull{
        padding-top: 0px;
      }

     #top-widget #nav_menu-2, .radio span {
        display: block;
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .insideheader .top {
        height: 100px;
        display: flex;
        justify-content: space-between;
      }

      #logo {
        left: 10px;
        width: 220px;
        position: relative;
        height: 95px;
      }

      #logo .custom-logo-link {
        display: inline;
      }

      #logo img {
        width: 220px;
        height: auto;
        margin-top: 0;
      }

      .loghi-social{
        display: none;
      }

      div#top-search {
        top: 10px;
        right: 10px;
        position: relative;
        width: 180px;
      }

      .socialtopbar {
        text-align: right;
        padding-top: 0px;
        float: none;
        clear: both;
        margin-bottom: 0;
      }

      #header .top > div.clear{
        display: none;
      }

    .top-widget {
        top: 0;
        position: relative;
        z-index: 9999;
        width: 100%;
        float: none;
    }

    .menu-principale-container,.menu-main-container {
        width: 100%;
        text-align: left;
        padding: 1px 0 10px 10px;
        margin: 0;
        float: none;
    }

    #header{
        height: 136px;;
    }

    #header div.widget-title {
        display: block;
        padding: 4px 0;
        background: #4771a5;
    }

    #logo {
        left: 10px;
        width: 220px;
    }

    div#top-search {
        top: 10px;
        right: 10px;
      }

      .new #searchform{
        display: none;;
    }
}

@media (max-width: 600px) {

    .home #content-archive .bigarticolo .post {
        margin: 0 0 10px 0;
        border: 0;
    }
}    

/* STILE MAPPA */

body.page-template-template-mappa{
    background: none !important;
}

gmp-advanced-marker {
    z-index: 99999;
}

#container-gmap {
    height: 640px;
    width: 100%;
    position: relative;
    overflow: hidden;
    margin-bottom:30px;
}

.gm-style-iw-chr{
    width: 100%;
    position: absolute;
}

.gm-style .gm-style-iw-c{
    border-radius:0 !important;
}


#map {
    width: 100%; 
}

/*#container-gmap {
    height: 100vh;
    width: 100%;
    position: relative;
    overflow: hidden;
  }
*/
  

  /* Barra inferiore con pulsanti */
  #sidebarinfo {
    width: 100%;
    height: 50px;
    background: #577389;
    padding: 0;
    position: relative;
    bottom: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
  }

  .control-button {
    font-family: Roboto, sans-serif;
    border: 0;
    padding: 0 15px;
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
    min-height: 50px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  #toggleButton {
    background: #436caa;
    font-family: Roboto, sans-serif;
    color: #fff;
    cursor: pointer;
    border: 0;
    width:50%;
    max-width: 400px;
    font-size: 15px;
    font-weight: 700;
  }

  #toggleButton:active {
    background: #365a92;
  }

  #toggleNews {
    background: #6aa04a;
    font-family: Roboto, sans-serif;
    color: #fff;
    border: 0;
    width:50%;
    max-width: 400px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
  }

  #toggleNews:active {
    background: #588a3d;
  }

  .control-button svg {
    transition: transform 0.3s;
    flex-shrink: 0;
  }

  .control-button.open svg {
    transform: rotate(180deg);
  }

  /* Sidebar Filtri - Mobile First */
  #sidebar {
    position: absolute;
    bottom: 50px;
    left: 0;
    width: 100%;
    max-height: 60vh;
    background: rgba(47, 65, 89, 0.98);
    z-index: 999;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  #sidebar.open {
    transform: translateY(0);
  }

  #sidebar .title-filtri {
    padding:10px 20px;
    background-color: rgba(67, 108, 170, 0.95);
    position: sticky;
    top: 0;
    z-index: 1;
  }

  #sidebar h3 {
    color: #fff;
    font-size: 16px;
    font-weight: 500;
    margin: 0;
  }

  #sidebar #events-filtri {
    padding:10px 20px 10px 20px;
    background-color: rgba(51, 66, 89, 0.95);
  }

  /* Radio button personalizzati - Touch Friendly */
  .custom-radio {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-bottom: 10px;
    font-size: 15px;
    color: #fff;
    position: relative;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0;
    transition: background 0.2s;
    min-height: 50px;
  }

  .custom-radio:active {
    background: rgba(255, 255, 255, 0.1);
  }

  .custom-radio input[type="radio"] {
    display: none;
  }

  .radio-btn {
    width: 24px;
    height: 24px;
    border: 2px solid #fff;
    border-radius: 50%;
    margin-right: 10px;
    position: relative;
    flex-shrink: 0;
  }

  .custom-radio input[type="radio"]:checked + .radio-btn::after {
    content: "";
    width: 14px;
    height: 14px;
    background-color: #fff;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }

  /* Sidebar News - Mobile First */
  #newsSidebar {
    position: absolute;
    bottom: 50px;
    left: 0;
    width: 100%;
    max-height: 60vh;
    background: rgba(63, 88, 48, 0.98);
    z-index: 999;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  #newsSidebar.open {
    transform: translateY(0);
  }

  #newsSidebar .title-box {
    padding: 10px 20px;
    background-color: rgba(106, 160, 74, 0.95);
    position: sticky;
    top: 0;
    z-index: 1;
  }

  #newsSidebar h3 {
    color: #fff;
    font-size: 16px;
    font-weight: 500;
    margin: 0;
  }

  #newsSidebar .inner-closed {
    padding: 20px;
  }

  #newsSidebar .post-closed {
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    margin-bottom: 15px;
  }

  #newsSidebar .post-closed:last-child {
    border: 0;
    margin-bottom: 0px;
  }

  span.news-time {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    display: block;
    margin-bottom: 8px;
  }

  #newsSidebar h4 {
    margin: 0 0 8px 0;
    line-height: 1.3;
    font-size: 16px;
  }

  #newsSidebar h4 a {
    color: #fff;
    text-decoration: none;
  }

  #newsSidebar p {
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    line-height: 1.5;
    font-size: 14px;
  }

  /* Legenda - Ottimizzata per mobile */
  #legend {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 15px;
    border-radius: 0px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    font-size: 12px;
    color: #333;
    z-index: 1!important;
    max-width: calc(100% - 30px);
  }
  

  .legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    white-space: nowrap;
  }

  .legend-item:last-child {
    margin-bottom: 0;
  }

  .legend-line {
    width: 25px;
    height: 4px;
    border-radius: 2px;
    margin-right: 8px;
    flex-shrink: 0;
  }

  /* Evita scroll orizzontale ma mantiene testo leggibile */
.gm-style .gm-style-iw {
    overflow-x: hidden !important;
    max-width: 280px; /* puoi regolare */
    word-wrap: break-word; /* manda a capo parole lunghe */
    white-space: normal;   /* consente il ritorno a capo */
    padding:0;
}

.gm-style .gm-style-iw-d {
    overflow-x: hidden !important;
    width: 100%;
    margin: 0;
    max-width: 350px;
    padding:0;
    overflow-y: auto !important;
}

  /* Info Window Styles */
  .map-info-window {
    max-width: 100%;
    width: 100%;
  }

  .map-info-window {
    max-width: 350px;
    word-wrap: break-word;
    white-space: normal;
    line-height: 1.4;
    padding:0;
    margin:0;
    box-sizing: border-box;
}

.map-info-window p {
    margin: 0 0 6px;
}

.map-info-window a {
    word-break: break-all; /* per link molto lunghi */
    text-decoration: none;
}


  .map-info-window h3 {
    font-size: 16px;
    background: #4c8f34;
    color: #fff;
    padding: 12px 35px 12px 12px;
    margin: 0;
    font-weight: 500;
  }

  .inner-map-info {
    padding: 10px;
  }

  .map-info-window ul {
    list-style: none;
    padding: 0;
    margin: 0;
  }

  .map-info-window ul li {
    margin-bottom: 15px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
  }

  .map-info-window ul li:last-child {
    margin-bottom: 0;
  }

  .map-info-window ul li img {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
  }

  .map-info-window ul li strong {
    color: #4c8f34;
    display: block;
    margin-bottom: 0px;
  }

  .gm-ui-hover-effect {
    opacity: 1;
    margin:0 !important;
    color: #fff;
    width:24px !important;
    height:24px !important;
    margin: 8px 5px 0px 0 !important;
}

.gm-ui-hover-effect>span {
    background-color: #fff;
    width:24px !important;
    height:24px !important;
    margin:0 !important;
}

  .map-info-window p {
    margin: 0;
    line-height: 1.2;
    font-size: 14px;
  }

  /* Tablet e Desktop */
  @media (min-width: 768px) {
    #container-gmap {
      height: 640px;
    }

    #map{
      height: 590px; 
    }

    .custom-radio input[type="radio"]:checked + .radio-btn::after{
        width: 10px;
        height: 10px;
    }

    .radio-btn {
        width: 18px;
        height: 18px;
    }

    #map {
      height: calc(100% - 50px);
    }

    #sidebarinfo {
      position: relative;
      height: 50px;
    }

    .control-button {
      font-size: 14px;
      padding: 0 20px;
    }

    #toggleButton {
        max-width:180px;
        width:100%;
        font-size:14px;
    }

    #toggleNews {
      max-width: 240px;
      width:100%;
      font-size:14px;
    }

    /* Sidebar tornano laterali su desktop */
    #sidebar {
      bottom: 50px;
      width: 280px;
      max-height: none;
      height: auto;
      transform: translateY(100%);
    }

    #sidebar.open {
      transform: translateY(0);
    }

    #newsSidebar {
      bottom: 50px;
      right: 0;
      left: auto;
      width: 350px;
      max-height: 500px;
      transform: translateY(100%);
    }

    #newsSidebar.open {
      transform: translateY(0);
    }

    #legend {
      font-size: 13px;
    }

    .legend-line {
      width: 30px;
    }

    .custom-radio {
      font-size: 14px;
      margin-bottom: 10px;
      min-height: 35px;
      background: transparent;
      padding: 0;
    }

    .map-info-window {
      max-width: 350px;
    }
  }

  /* Desktop Large */
  @media (min-width: 1024px) {
    #legend {
      font-size: 14px;
    }
  }

  /* Migliora la scrollabilità su iOS */
  #sidebar::-webkit-scrollbar,
  #newsSidebar::-webkit-scrollbar {
    width: 6px;
  }

  #sidebar::-webkit-scrollbar-thumb,
  #newsSidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
  }

  /* Overlay per chiudere sidebar su mobile */
  .sidebar-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 50px;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s;
  }

  .sidebar-overlay.active {
    display: block;
    opacity: 1;
  }

@media (min-width: 768px) {
    .sidebar-overlay {
      display: none !important;
    }
}
/* SOSTITUISCI LA SEZIONE MOBILE DEL TUO CSS CON QUESTA */

@media (max-width: 767px) {

  /* stili mappa */
  /* Container mappa - occupa viewport meno header */
  #container-gmap {
      position: relative;
      height: calc(100dvh - 136px);  /* Si adatta alle barre browser */
      height: calc(var(--vh, 1vh) * 100 - 136px); /* Fallback */
      width: 100%;
      display: flex;
      flex-direction: column;
  }

  /* Mappa - cresce per occupare lo spazio disponibile */
  #map {
      flex: 1;
      width: 100%;
      min-height: 0; /* Importante per flex */
      touch-action: pan-y pinch-zoom !important;
  }

  /* Barra inferiore - POSITION RELATIVE (scorre con la pagina) */
  #sidebarinfo {
      position: relative !important;
      bottom: auto !important;
      width: 100%;
      height: 50px;
      flex-shrink: 0; /* Non si riduce */
      z-index: 1000;
      background: #577389;
      display: flex;
      justify-content: space-between;
      box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
  }

  /* Sidebar - ABSOLUTE rispetto al container */
  #sidebar {
      position: absolute !important;
      bottom: 50px !important; /* Sopra #sidebarinfo */
      left: 0;
      width: 100%;
      max-height: 60vh;
      transform: translateY(100%);
      transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      z-index: 999;
  }

  #sidebar.open {
      transform: translateY(0);
  }

  #newsSidebar {
      position: absolute !important;
      bottom: 50px !important; /* Sopra #sidebarinfo */
      left: 0;
      width: 100%;
      max-height: 60vh;
      transform: translateY(100%);
      transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      z-index: 999;
  }

  #newsSidebar.open {
      transform: translateY(0);
  }

  /* Overlay per chiudere sidebar - ABSOLUTE nel container */
  .sidebar-overlay {
      position: absolute !important;
      top: 0;
      left: 0;
      right: 0;
      bottom: 50px; /* Sopra #sidebarinfo */
      background: rgba(0, 0, 0, 0.5);
      z-index: 998;
      display: none;
      opacity: 0;
      transition: opacity 0.3s;
  }

  .sidebar-overlay.active {
      display: block;
      opacity: 1;
  }

  /* Legenda */
  #legend {
      position: absolute;
      top: 10px;
      left: 10px;
      z-index: 5;
      padding: 5px;
  }

  #legend span {
      display: none;
  }

  /* Nascondi sezione infotraffico su mobile */
  div.infotraffico-section {
      display: none;
  }

  /* Pulsanti controllo */
  #toggleButton {
      background: #436caa;
      font-family: Roboto, sans-serif;
      color: #fff;
      cursor: pointer;
      border: 0;
      width: 50%;
      font-size: 15px;
      font-weight: 700;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
  }

  #toggleNews {
      background: #6aa04a;
      font-family: Roboto, sans-serif;
      color: #fff;
      border: 0;
      width: 50%;
      cursor: pointer;
      font-size: 15px;
      font-weight: 700;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
  }

  /* Fix info window */
  .gm-ui-hover-effect {
      margin: 8px 20px 0px 0 !important;
  }

  /* Hint visivo per gesture (opzionale - si nasconde dopo 4 secondi) */
  #map::before {
      content: "Usa 2 dita per muovere la mappa";
      display: block;
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      background: rgba(67, 108, 170, 0.95);
      color: white;
      padding: 12px 20px;
      border-radius: 8px;
      font-size: 13px;
      font-weight: 500;
      z-index: 10;
      pointer-events: none;
      animation: fadeOutHint 4s forwards;
      box-shadow: 0 4px 12px rgba(0,0,0,0.3);
      white-space: nowrap;
  }

  @keyframes fadeOutHint {
      0%, 60% { opacity: 1; }
      100% { opacity: 0; visibility: hidden; }
  }

  /* Nascondi hint dopo il primo tocco */
  #map.touched::before {
      display: none;
  }

  /* Assicura scroll fluido su iOS */
  body {
      -webkit-overflow-scrolling: touch;
  }
}

@media screen and (max-width: 1024px) {
  body {
    background-size: 150% auto !important;
  }

}
@media screen and (max-width: 750px) {
  .titletop h2 {
     padding-top: 0;
  }

  .titletop {
      margin-top: 0px;
  }

}

