:root {
  --default-color: #2c3e50;
  --link-color: #2c5282;
  --background-color: #eedc00;
  --border-color-a: #4d6999;
  --border-color-b: #dbcb00;
  --title-color: #1a365d;
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* CORRETTO: Mancava il selettore universale */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  font-size: 16px;
  color: var(--default-color);
  line-height: 1.6;
}

.testata {
  background-color: var(--background-color);
  font-size: 24px;
  color: var(--title-color);
  text-align: center;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1em 2em;
  margin: 0;
}

.appname {
  text-align: center;
  font-size: 42px;
  padding: 0.5em;
  flex: 1;
}

.logo {
  width: 150px;
  flex-shrink: 0;
}

.logo img {
  display: block;
  width: 130px;
  height: 130px;
}

#nav {
  transition: transform 0.2s ease-in-out, visibility 0.2s ease-in-out;
  visibility: visible;
  overflow-y: visible;
  position: relative;
  color: inherit;
  max-width: 80%;
  height: 100%;
  padding: 1em 2em;
  z-index: 10010;
  flex-shrink: 0;
}

ul#navigation {
  margin: 0;
  position: relative;
  list-style: none;
  padding: 0;
  display: flex;
  gap: 1em;
}

ul#navigation li {
  display: inline;
  font-size: 18px;
  font-weight: bold;
  margin: 0;
  padding: 0;
  position: relative;
}

ul#navigation li a {
  padding: 10px 20px;
  color: var(--link-color);
  font-size: 20px;
  display: inline-block;
  transition: color 0.2s linear, background 0.2s linear;
  text-decoration: none;
}

ul#navigation li a:hover,
ul#navigation li a.current {
  color: var(--title-color);
  font-weight: 700;
  text-decoration: underline;
}

.sottotitolo {
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  padding-top: 2em;
}

.radioval {
  text-align: left;
  width: 200px;
  margin:auto;
}

h1 {
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  padding-top: 1em;
  margin-bottom: 1em;
}

h2 {
  font-size: 2em;
  font-weight: 500;
  margin-top: 1.5em;
}

h3 {
  font-size: 1.3em;
  font-weight: 300;
}

a {
  color: var(--link-color);
  text-decoration: underline;
}

a:hover {
  color: var(--title-color);
  font-weight: 700;
  text-decoration: underline;
}

a:focus {
  outline: 2px solid var(--link-color);
  outline-offset: 2px;
}

#main {
  width: 100%;
  font-family: var(--font-family);
  font-size: 18px;
  color: var(--default-color);
  text-align: left;
  padding: 2em 0;
}

#top, #licenza, #uso, #supporto {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2em 0;
}

#top {
  text-align: left;
}

#download {
  padding: 3em 0;
  text-align: center;
}

#licenza-attuale {
  padding-top: 2em;
  text-align: center;
}

#utilizzo-finora {
  max-width: 500px;
  margin: 1.5em auto 0 auto;
  padding: 1.5em 2em;
  text-align: center;
  border: 2px solid var(--border-color-a);
  border-radius: 4px;
}

#utilizzo-finora h2 {
  margin-top: 0;
  font-size: 1.4em;
  color: var(--title-color);
}

#utilizzo-finora .stat-riga {
  margin: 0.8em 0;
}

#utilizzo-finora .stat-numero {
  font-size: 2em;
  font-weight: 700;
  color: var(--link-color);
  line-height: 1.1;
}

#utilizzo-finora .stat-etichetta {
  font-size: 0.9em;
  color: var(--default-color);
}

#utilizzo-finora .stat-nota {
  font-size: 0.75em;
  color: #777;
  margin: 1em 0 0 0;
}

#rinnovi, #corpo {
  padding-bottom: 2em;
  text-align: center;
}

#newsletter {
  text-align: center;
  padding: 2em 0;
}

#topBtn {
  border: 2px solid var(--border-color-a);
  color: var(--background-color);
  background-color: var(--link-color);
  display: none;
  position: fixed;
  bottom: 20px;
  right: 30px;
  z-index: 99;
  font-size: 18px;
  outline: none;
  cursor: pointer;
  padding: 15px;
  border-radius: 4px;
  transition: background-color 0.3s ease;
}

#topBtn:hover {
  background-color: var(--background-color);
  color: var(--link-color);
  border: 2px solid var(--border-color-b);
}

#cform {
  width: 90%;
  max-width: 600px;
  margin: 2em auto;
}

.button {
  padding: 2em 0;
  text-align: center;
}

.button1 {
  border: 2px solid var(--border-color-a);
  color: var(--background-color);
  background-color: var(--link-color);
  padding: 20px 40px;
  font-family: var(--font-family);
  font-size: 24px;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.button1:hover {
  background-color: var(--background-color);
  color: var(--link-color);
  border: 2px solid var(--border-color-b);
}

.button1:focus {
  outline: 2px solid var(--title-color);
  outline-offset: 2px;
}

#footer {
  padding: 3em 2em;
  text-align: center;
  font-size: 18px;
  font-family: var(--font-family);
  color: var(--default-color);
  margin: 0 auto;
  width: 100%;
  background-color: #f5f5f5;
}

.f30 {
  float: left;
  width: 30%;
  text-align: center;
  padding: 1em;
  margin: 0 1.5%;
}

.clear {
  clear: both;
}

/* ====== CONTENITORE SCHERMATA - FIX CLS ====== */
.schermata {
  width: 100%;
  max-width: 748px; /* larghezza massima dell'immagine principale */
  margin: 0 auto;
  padding: 2em 0;
  text-align: center;
}

/* Regola per l'immagine principale (screen_main.webp) */
.schermata img[width="748"][height="400"] {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 748 / 400; /* forza il rapporto esatto, riserva lo spazio */
  max-width: 100%;
  object-fit: contain; /* evita distorsioni se le proporzioni non corrispondono */
}

/* Regole generali per tutte le immagini con attributi width/height */
img[width][height]:not(.immagine2) {
  height: auto;
  max-width: 100%;
  display: block;
}

/* Immagini piccole (es. le due schermate pin/qrcode) */
.immagine2 {
  height: auto;
  max-width: 30%;
  display: inline-block; /* per stare affiancate */
  vertical-align: middle;
}

/* ====== CAROUSEL / MODAL ====== */
.slideshow-container {
  position: relative;
  max-width: 1000px;
  margin: 2em auto;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background-color: #f0f0f0;
}

.mySlides {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.mySlides img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Bottoni prev/next - ora sono <button> */
.prev, .next {
  border: none;
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  cursor: pointer;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: auto;
  padding: 16px;
  font-weight: bold;
  font-size: 20px;
  transition: background-color 0.3s ease;
  border-radius: 0 3px 3px 0;
  user-select: none;
  z-index: 10;
}

.next {
  right: 0;
  border-radius: 3px 0 0 3px;
}

.prev {
  left: 0;
}

.prev:hover, .next:hover {
  background-color: rgba(0, 0, 0, 0.8);
}

.numbertext {
  color: #f2f2f2;
  font-size: 12px;
  padding: 8px 12px;
  position: absolute;
  top: 0;
  left: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 10;
}

.caption-container {
  text-align: center;
  background-color: black;
  padding: 10px 16px;
  color: white;
  margin-top: 0;
}

.demo {
  opacity: 0.6;
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.active, .demo:hover {
  opacity: 1;
}

.row {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 10px 0;
}

.column {
  width: 100px;
}

.column img {
  width: 100%;
  height: auto;
  display: block;
  border: 2px solid transparent;
  transition: border-color 0.3s ease;
}

.column img.active {
  border-color: var(--link-color);
}

/* MODALE */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  padding-top: 100px;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.9);
}

.modal-content {
  position: relative;
  background-color: #fefefe;
  margin: auto;
  padding: 0;
  width: 90%;
  max-width: 1200px;
}

.close {
  color: white;
  position: absolute;
  top: 10px;
  right: 25px;
  font-size: 35px;
  font-weight: bold;
  cursor: pointer;
  z-index: 1001;
}

.close:hover, .close:focus {
  color: #999;
  text-decoration: none;
  cursor: pointer;
}

/* ====== FORM ====== */
label {
  font-weight: 700;
  display: block;
  margin-top: 1em;
  margin-bottom: 0.5em;
}

input[type="text"],
input[type="email"],
select,
textarea {
  font-family: var(--font-family);
  font-size: 16px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-color-a);
  border-radius: 4px;
  margin-bottom: 1em;
  transition: border-color 0.3s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--link-color);
  box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.1);
}

input[type="submit"] {
  border: 2px solid var(--border-color-a);
  color: var(--background-color);
  background-color: var(--link-color);
  padding: 12px 30px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  transition: background-color 0.3s ease, color 0.3s ease;
}

input[type="submit"]:hover {
  background-color: var(--background-color);
  color: var(--link-color);
  border: 2px solid var(--border-color-b);
}

input[type="submit"]:focus {
  outline: 2px solid var(--title-color);
  outline-offset: 2px;
}

.text-center {
  text-align: center;
}

.subtitle {
  margin-top: -1em;
  margin-bottom: 2em;
}

.undo {
  margin-top: 1em;
}

.error {
  color: #d32f2f;
  text-align: center;
  padding: 1em;
  background-color: #ffebee;
  border-radius: 4px;
  margin: 1em 0;
}

.success {
  color: var(--title-color);
  font-weight: 400;
  text-align: center;
  padding: 1em;
  background-color: #e3f2fd;
  border-radius: 4px;
  margin: 1em 0;
}

/* ====== RESPONSIVE ====== */
@media screen and (max-width: 768px) {
  .testata {
    flex-direction: column;
    padding: 1em;
  }
  .appname {
    font-size: 28px;
    padding: 0.5em 0;
  }
  #nav {
    padding: 1em 0;
    max-width: 100%;
  }
  ul#navigation {
    flex-direction: column;
    gap: 0.5em;
  }
  ul#navigation li a {
    font-size: 18px;
    padding: 10px;
  }
  .f30 {
    width: 100%;
    margin: 0.5em 0;
  }
  h1 {
    font-size: 24px;
  }
  .button1 {
    font-size: 18px;
    padding: 15px 30px;
  }
  .slideshow-container {
    aspect-ratio: 4 / 3;
  }
  .schermata {
    max-width: 100%;
  }
  .immagine2 {
    max-width: 45%; /* su mobile si affiancano meglio */
  }
}
