/* Mobile Responsive CSS per cartella categorie */
/* Ottimizzazione mobile-first per layout a tabelle legacy */

/* Base: mantiene tutto come desktop */
@media (min-width: 769px) {
  /* Nessuna modifica su desktop */
}

/* Tablet e Mobile */
@media (max-width: 768px) {
  
  /* Tabelle di layout principali */
  body {
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden !important;
  }
  
  table {
    width: 100% !important;
    max-width: 100% !important;
    border-collapse: collapse !important;
  }
  
  /* Fix per larghezze fisse (720px, 747px, 800px, ecc.) */
  table[width="720"],
  table[width="747"],
  table[width="800"],
  table[width="735"],
  table[width="732"],
  div[style*="width:720"],
  div[style*="width:747"] {
    width: 100% !important;
    max-width: 100% !important;
  }
  
  td {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  
  /* Immagini responsive */
  img {
    max-width: 100% !important;
    height: auto !important;
    width: auto !important;
  }
  
  /* Fix per immagini con larghezza fissa */
  img[width="747"],
  img[width="720"],
  img[width="748"] {
    width: 100% !important;
    height: auto !important;
  }
  
  /* Font leggibili su mobile */
  body {
    font-size: 16px !important;
    line-height: 1.5 !important;
  }
  
  /* Link e pulsanti più grandi (touch-friendly) */
  a {
    min-height: 44px !important;
    display: inline-block !important;
    padding: 8px !important;
  }
  
  /* Contenuto principale */
  td[width="90%"],
  td[width="80%"] {
    padding: 10px !important;
  }
  
  /* Menu laterale - NASCOSTO su mobile */
  td[width="10%"],
  td[width="20%"],
  tr > td:first-child {
    display: none !important;
  }
  
  /* Contenuto principale prende tutto lo spazio */
  td[width="90%"],
  td[width="80%"],
  tr > td:last-child {
    width: 100% !important;
    display: block !important;
  }
  
  /* Nascondi elementi decorativi pesanti */
  td[background] {
    background: none !important;
  }
  
  /* Tabelle annidate (menu) */
  table table {
    margin: 0 auto !important;
  }
  
  /* Header e titoli */
  h1 {
    font-size: 1.8em !important;
    line-height: 1.2 !important;
    padding: 10px !important;
  }
  
  h2 {
    font-size: 1.4em !important;
    line-height: 1.3 !important;
  }
  
  /* Contenuto testuale */
  p, li {
    font-size: 1em !important;
    line-height: 1.6 !important;
    margin: 10px 0 !important;
  }
  
  /* Blocchi di contenuto */
  div[align="center"] {
    padding: 5px !important;
  }
  
  /* Fix per tabelle di dati (liste programmi) */
  table[id="table3"],
  table[bgcolor] {
    font-size: 0.9em !important;
  }
  
  table[id="table3"] td {
    padding: 8px 4px !important;
  }
}

/* Mobile piccolo (smartphone) */
@media (max-width: 480px) {
  
  body {
    font-size: 14px !important;
  }
  
  h1 {
    font-size: 1.5em !important;
  }
  
  h2 {
    font-size: 1.2em !important;
  }
  
  /* Riduci padding su schermi molto piccoli */
  td {
    padding: 5px !important;
  }
  
  /* Font più piccoli per tabelle dati */
  table[id="table3"] {
    font-size: 0.85em !important;
  }
  
  /* Immagini icone più piccole */
  img[width="131"] {
    width: 100px !important;
  }
}

/* Ottimizzazioni performance */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
