/* Reset di base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Stili globali */
html, body {
  height: 100%;
  width: 100%;
  background-color: #ffffff;
  font-family: Arial, sans-serif;
  /* Nuovo colore meno contrastato per tutto il testo */
  color: #555555;
  overflow-x: hidden;
}
body {
  opacity: 0;
  transition: opacity 0.5s ease;
}
body.fade-in {
  opacity: 1;
}
body.fade-out {
  opacity: 0;
  transition: opacity 0.5s ease;
}

.view {
  width: 100%;
}

/* Container principale (Desktop) */
.container {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 1440px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 4vh clamp(16px, 2vw, 32px) 0;
  overflow-y: auto;
}

/* Logo */
.logo {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: 4vh;
}
.logo img {
  width: min(50vw, 100%);
  max-width: 400px;
  height: auto;
}

/* Griglia per i pulsanti */
.grid {
  flex: 1;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: clamp(20px, 2vw, 30px);
  max-width: 1200px;
  margin: 0 auto;
  align-content: center;
  justify-items: center;
  padding: 2% clamp(16px, 5vw, 80px);
}

/* Pulsanti */
.grid button {
  width: 100%;
  height: 100%;
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  padding: 1vh 1vw;
  font-size: calc(1em + 0.5vw);
  border: none;
  border-radius: 2vh;
  color: #ffffff;
  cursor: pointer;
  text-align: center;
  box-shadow: 0 4px 6px rgba(0,0,0,0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.grid button:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 12px rgba(0,0,0,0.3);
}
.grid button span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0.5vh;
  text-align: center;
  font-size: clamp(1.4rem, 1.08rem + 0.95vw, 1.95rem);
  font-weight: 600;
  line-height: 1.1;
}

/* Icona dei pulsanti */
.button-icon {
  max-width: 2.5em;
  max-height: 2.5em;
  object-fit: contain;
  margin-right: 0.5em;
  vertical-align: middle;
}

/* Colori dei pulsanti */
.btn-ocra { background-color: #f8b19f; }
.btn-arancione { background-color: #ef4c23; }
.btn-celeste { background-color: #76b9c9; }
.btn-blu { background-color: #2d7c88; }

.btn-ocra,
.btn-celeste {
  color: #16323a;
}

/* Bottom Bar - Nuovo Footer */
.bottom-bar {
  width: 100%;
  background-color: #ffffff;
  padding: 2vh 2vw;
  border-top: 1px solid #eee;
  margin-top: 4vh;
}
#lessons-view .bottom-bar,
#guides-view .bottom-bar {
  margin-top: 0vh;
}
.bottom-content {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 1vw;
}

/* Nuove classi per il footer */
.footer-left,
.footer-right {
  display: flex;
  align-items: center;
  gap: 1vw;
}

.footer-left {
  flex-wrap: nowrap;
  min-width: 0;
}

.footer-text {
  font-size: clamp(0.5rem, 0.85vw, 0.82rem);
  color: #555555;
  white-space: normal;
  max-width: 28vw;
  line-height: 1.35;
  padding: 0.25em 0;
}

.footer-support-logos {
  display: flex;
  align-items: center;
  gap: 0.75vw;
  flex-shrink: 0;
}

.footer-collab {
  /* Non va a capo e ha una dimensione responsive; usato come titolo */
  font-size: clamp(0.6rem, 2vw, 1rem);
  color: #555555;
  white-space: nowrap;
}

/* Separatore */
.separator {
  border-left: 1px solid #eee;
  height: 40px;
  margin: 0 1vw;
}

/* Loghi nel footer */
.bottom-logo {
  display: block;
  width: auto;
  height: 40px;
  max-height: 40px;
  margin: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.bottom-logo:hover {
  transform: translateY(-4px);
}

/* Partner logos (rimangono invariati) */
.partner-logos {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;  
  gap: 1vw; 
}

/* Media Query per smartphone */
@media (max-width: 600px) {
  .container {
    min-height: 100vh;
    width: 100%;
    padding: 4vh 4vw 0vh;
    overflow-y: auto;
  }
  .logo img {
    width: 80vw;
  }
  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 5vw;
    padding: 2% 5%;
    place-items: center;
    align-content: center;
  }
  .grid button {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: calc(1em + 0.5vw);
    padding: 1.5vh 1.5vw;
    border: none;
    border-radius: 2vh;
    color: #ffffff;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }
  .grid button:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 12px rgba(0,0,0,0.3);
  }
  .button-icon {
    width: auto;
    height: 40%;
    max-width: 10vh;
    max-height: 10vh;
    margin: 0;
    object-fit: contain;
  }
  .grid button span {
    margin-top: 0.5vh;
    font-size: clamp(1.28rem, 1.05rem + 1.2vw, 1.65rem);
    font-weight: 600;
    text-align: center;
    white-space: normal;
    overflow-wrap: break-word;
  }
  .bottom-bar {
    padding-bottom: 4vh;
  }
  /* Footer Mobile: layout a colonna e separatore orizzontale */
  .bottom-content {
    flex-direction: column;
    align-items: center;
    gap: 2vh;
  }
  .separator {
    border-left: none;
    border-top: 1px solid #eee;
    width: 80%;
    margin: 1vh 0;
    height: auto;
  }
  .footer-left,
  .footer-right {
    flex-direction: column;
    gap: 0.5vh;
  }
  .footer-left {
    align-items: center;
    flex-wrap: nowrap;
  }
  .footer-support-logos {
    justify-content: center;
  }
  /* Aumenta la larghezza massima e adatta il font per il testo di finanziamento */
  .footer-text {
    max-width: 80vw;
    font-size: clamp(0.72rem, 1.8vw, 0.9rem);
    text-align: center;
  }
  /* Font più grande per "In collaborazione con" */
  .footer-collab {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    text-align: center;
    margin-bottom: 0.5rem;
  }
  /* Spazio extra tra "In collaborazione con" e i loghi dei partner */
  .footer-right .partner-logos {
    margin-top: 1rem;
  }
  .bottom-logo {
    height: 50px;
    max-height: 50px;
  }
  .partner-logos {
    gap: 5vw; 
  }
}
