/* Tuttosuper mobile enhancement - caricare DOPO tutti i CSS esistenti. */
/* Non modificare i CSS desktop: regole globali eliminate. */
@media (max-width: 1024px) {
  *, *::before, *::after { box-sizing: border-box; }
  img, video, iframe { max-width: 100%; }
  img { height: auto; }
}
@media (max-width: 1024px) {
  #bottom_container { position: relative; top: 0; width: 100%; max-width: 100%; }
  #body_page { position: relative !important; top: auto !important; left: auto !important;
               width: 100% !important; max-width: 100% !important; min-width: 0 !important; }
  #right_column { position: relative !important; left: auto !important; top: auto !important;
                  width: 100% !important; max-width: 100% !important; padding: 12px !important; }
  #extra-content { max-width: 100%; }
  #header { position: relative; min-height: 112px; width: 100%; max-width: 100%; }
  #header > div:first-child { left: 12px !important; top: 10px !important; }
  #header > div:first-child img { width: 120px !important; max-width: 45vw; }
  #clock { left: 150px !important; top: 16px !important; }
  #header .language-choice { left: auto !important; right: 12px !important; }
  #header .language-choice.current::before { left: -12px; }
  #navigation, #navigation-area { width: 100%; max-width: 100%; }
}
@media (max-width: 760px) {
  html, body { max-width: 100%; margin: 0; }
  #bottom_container, #body_page { padding: 0 8px; }
  #right_column { padding: 8px !important; }
  #header { min-height: 110px; }
  #clock { display: none; }
  /* Il menu non richiede una seconda versione JSP. */
  #navigation { width: 100%; position: relative; z-index: 50; }
  #navigation > ul#nav { display: none !important; width: 100%; height: auto !important;
                         margin: 0 !important; padding: 6px !important; list-style: none; }
  #navigation.ts-nav-open > ul#nav { display: block !important; }
  #navigation #nav > li { float: none !important; display: block !important; width: 100% !important;
                          margin: 0 0 5px !important; position: relative !important; }
  #navigation #nav li > a { min-height: 44px; display: inline-flex; align-items: center; max-width: calc(100% - 52px);
                            white-space: normal !important; }
  #navigation #nav li ul { display: none !important; position: static !important; float: none !important;
                           left: auto !important; top: auto !important; width: 100% !important;
                           min-width: 0 !important; height: auto !important; padding: 4px 0 4px 14px !important;
                           box-shadow: none !important; visibility: visible !important; opacity: 1 !important; }
  #navigation #nav li.ts-sub-open > ul { display: block !important; }
  #navigation #nav li ul li { display: block !important; float: none !important;
                              position: relative !important; width: 100% !important; }
  #navigation .ts-menu-toggle, #navigation .ts-sub-toggle { border: 1px solid #a9bad8; background: #edf3fb;
    color: #244b86; border-radius: 6px; cursor: pointer; min-height: 44px; min-width: 44px; font: inherit; }
  #navigation .ts-menu-toggle { display: block; width: 100%; text-align: left; padding: 8px 14px; font-weight: bold; }
  #navigation .ts-sub-toggle { display: inline-flex; align-items: center; justify-content: center; margin-left: 5px; vertical-align: middle; }
  .menu_list { width: 100% !important; }
  .menu_head { min-height: 44px; display: flex; align-items: center; }
  .menu_body a { min-height: 44px; padding: 12px !important; }
  .curiosity-tabs { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .curiosity-tabs .curiosity-tab { min-height: 44px; white-space: normal; }
  .curiosity-card { width: 100%; max-width: 100%; }
  .curiosity-content { min-width: 0; overflow-wrap: anywhere; }
  #footer { max-width: 100%; }
  table { max-width: 100%; }
}
@media (min-width: 761px) {
  #navigation .ts-menu-toggle, #navigation .ts-sub-toggle { display: none !important; }
}


/* Layout responsive per struttura JSP reale (#container, #content, #main-content). */
@media (max-width: 1024px) {
  html:not(.tuttosuper-tool-fullpage-host) body { min-width: 0 !important; }
  html:not(.tuttosuper-tool-fullpage-host) #container,
  html:not(.tuttosuper-tool-fullpage-host) #content { width: 100% !important; min-width: 0 !important; max-width: 100% !important; box-sizing: border-box; }
  html:not(.tuttosuper-tool-fullpage-host) #main-content { float: none !important; width: 100% !important; min-width: 0 !important; max-width: 100% !important; margin: 0 !important; box-sizing: border-box; }
  html:not(.tuttosuper-tool-fullpage-host) #tuttosuperSiteHeader,
  html:not(.tuttosuper-tool-fullpage-host) #tuttosuperSiteMainMenu,
  html:not(.tuttosuper-tool-fullpage-host) #tuttosuperSiteExtra,
  html:not(.tuttosuper-tool-fullpage-host) #tuttosuperSiteFooter { width: 100% !important; max-width: 100% !important; min-width: 0 !important; box-sizing: border-box; }
  html:not(.tuttosuper-tool-fullpage-host) #extra-content { width: 100% !important; max-width: 100% !important; }
  html:not(.tuttosuper-tool-fullpage-host) #header { min-height: 115px; }
  html:not(.tuttosuper-tool-fullpage-host) #header .language-choice { left: auto !important; right: 10px !important; }
  html:not(.tuttosuper-tool-fullpage-host) #header .language-choice a { display: block; min-height: 26px; }
  #content input, #content select, #content textarea { max-width: 100%; }
}
@media (max-width: 760px) {
  html:not(.tuttosuper-tool-fullpage-host) #container { padding: 0 8px !important; }
  html:not(.tuttosuper-tool-fullpage-host) #content { padding: 0 !important; display: block !important; }
  html:not(.tuttosuper-tool-fullpage-host) #main-content { padding: 8px 0 !important; }
  html:not(.tuttosuper-tool-fullpage-host) #tuttosuperSiteExtra { clear: both; }
  html:not(.tuttosuper-tool-fullpage-host) #extra-content { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
  html:not(.tuttosuper-tool-fullpage-host) #extra-content > div { max-width: 100%; }
  html:not(.tuttosuper-tool-fullpage-host) #header > div:first-child img { width: 125px !important; height: auto !important; max-width: none !important; }
  html:not(.tuttosuper-tool-fullpage-host) #header .language-choice { right: 7px !important; }
  #navigation #nav { box-sizing: border-box; background: #5e7bb5; margin: 0 !important; border-radius: 8px; }
  #navigation #nav li > a { box-sizing: border-box; }
  #navigation #nav > li > a { color: #fff; }
  #navigation #nav li.ts-sub-open > ul > li > a { color: #222; }
  #navigation #nav ul { background: #eef3fa !important; }
  .tuttosuper-page-breadcrumb { display: block; max-width: 100%; overflow-wrap: anywhere; }
}

/* Patch Samsung S22: menu compatto, righe allineate, nessun effetto su desktop. */
@media (max-width: 760px) {
  #navigation .ts-menu-toggle {
    min-height: 48px;
    margin: 0 0 4px;
    font-size: 16px;
    padding: 10px 14px;
  }
  #navigation .ts-menu-toggle::before { content: "\2630"; margin-right: 9px; }
  #navigation.ts-nav-open .ts-menu-toggle::before { content: "\00D7"; }
  #navigation.ts-nav-open > #nav {
    padding: 8px !important;
    box-sizing: border-box;
    text-align: left;
  }
  #navigation #nav li,
  #navigation #nav ul li {
    box-sizing: border-box;
    width: 100% !important;
    float: none !important;
    text-align: left !important;
    margin: 0 !important;
  }
  #navigation #nav li:has(> .ts-sub-toggle) {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 44px;
    align-items: center;
    column-gap: 4px;
    row-gap: 0;
  }
  #navigation #nav li:has(> .ts-sub-toggle) > a {
    grid-column: 1;
    grid-row: 1;
    min-height: 44px;
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 8px 12px !important;
    text-align: left !important;
    justify-content: flex-start !important;
    box-sizing: border-box;
  }
  #navigation #nav li > .ts-sub-toggle {
    grid-column: 2;
    grid-row: 1;
    margin: 0 !important;
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: 21px;
  }
  #navigation #nav li > ul {
    grid-column: 1 / -1;
    grid-row: 2;
    margin: 0 !important;
    padding: 4px 6px 6px 12px !important;
    border-radius: 6px;
    box-sizing: border-box;
  }
  #navigation #nav li:not(:has(> .ts-sub-toggle)) > a {
    max-width: 100% !important;
    width: 100%;
    min-height: 44px;
    padding: 9px 12px !important;
    justify-content: flex-start !important;
    text-align: left !important;
  }
  #navigation #nav > li + li { margin-top: 3px !important; }
  #navigation #nav ul li { margin-top: 2px !important; }
  #navigation #nav li ul ul { background: #f7f9fc !important; }
  /* Immagini di contorno meno predominanti sul telefono. */
  #right_column img, #extra-content img {
    max-width: min(100%, 320px) !important;
    height: auto !important;
  }
}


/* ============================================================
   FINITURA MOBILE V3 - solo smartphone, nessuna modifica desktop
   Layout compatto header + bandiere, menu e banner laterali.
   ============================================================ */
@media screen and (max-width: 760px) {
  /* Header JSP: logo, orologio e tre language-choice sono figli di #header. */
  html:not(.tuttosuper-tool-fullpage-host) #header {
    height: 88px !important;
    min-height: 88px !important;
    max-height: 88px !important;
    position: relative !important;
    overflow: visible;
  }
  html:not(.tuttosuper-tool-fullpage-host) #header > div:first-child {
    top: 7px !important;
    left: 10px !important;
  }
  html:not(.tuttosuper-tool-fullpage-host) #header > div:first-child img {
    display: block !important;
    width: 92px !important;
    max-width: 92px !important;
    height: auto !important;
  }
  html:not(.tuttosuper-tool-fullpage-host) #header #clock { display: none !important; }
  html:not(.tuttosuper-tool-fullpage-host) #header .language-choice {
    top: 19px !important;
    left: auto !important;
    right: auto !important;
    width: 40px !important;
    height: 34px !important;
    padding: 4px 3px !important;
  }
  html:not(.tuttosuper-tool-fullpage-host) #header .language-choice:nth-of-type(3) { right: 102px !important; }
  html:not(.tuttosuper-tool-fullpage-host) #header .language-choice:nth-of-type(4) { right: 56px !important; }
  html:not(.tuttosuper-tool-fullpage-host) #header .language-choice:nth-of-type(5) { right: 10px !important; }
  html:not(.tuttosuper-tool-fullpage-host) #header .language-choice a { min-height: 0 !important; }
  html:not(.tuttosuper-tool-fullpage-host) #header .language-choice img { width: 33px !important; height: 22px !important; }
  html:not(.tuttosuper-tool-fullpage-host) #header .language-choice.current::before { left: 13px !important; top: 32px !important; transform: rotate(90deg); }

  /* Mobile: meno spazio, senza compromettere i touch target. */
  #navigation .ts-menu-toggle { min-height: 46px; margin-bottom: 3px; }
  #navigation.ts-nav-open > #nav { padding: 5px 7px !important; }
  #navigation #nav > li + li { margin-top: 1px !important; }
  #navigation #nav li > a { min-height: 44px !important; }
  #navigation #nav li > .ts-sub-toggle { min-height: 44px; }
  #navigation #nav li > ul { padding: 2px 5px 3px 9px !important; }
  #navigation #nav ul li { margin-top: 0 !important; }
  #navigation #nav li:not(:has(> .ts-sub-toggle)) > a { padding: 7px 10px !important; }

  /* Colonna decorativa: non visualizzare i banner su smartphone. */
  html:not(.tuttosuper-tool-fullpage-host) #tuttosuperSiteExtra { display: none !important; }
  /* Colonna classica separata: mantenere il contenuto se non decorativo. */
  html:not(.tuttosuper-tool-fullpage-host) #right_column .banner300x250 { display: none !important; }
  .tuttosuper-page-breadcrumb { color: #9a6500 !important; }
}
