/* Navbar fissa in alto */
#navbar {
  height: 60px;
  background-color: #111;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  font-size: 18px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}

#loader {
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.9);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

/* Flipbook container sotto la navbar */
#flipbook-container {
  position: fixed;
  top: 60px;
  /* altezza navbar */
  left: 0;
  right: 0;
  bottom: 60px;
  /* spaziatura per lasciare posto al footer (che è 60px di altezza) */
  height: calc(100vh - 200px);
  /* navbar + pulsanti + footer stimati insieme */
  background-color: black;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  z-index: 0;
}


/* Flipbook */
#flipbook {
  width: 100%;
  height: 100%;
  max-width: 100vw;
  max-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Pulsanti sotto il flipbook */
#bottomButtons {
  margin-top: 8px;
  display: none;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

button,
.btn {
  margin: 0 5px;
  padding: 8px 12px;
}

/* Body e html */
html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background-color: #050505;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
}


.spinner {
  border: 6px solid rgba(255, 255, 255, 0.2);
  border-top: 6px solid #00A859;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

#mainContent {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Pagine del flipbook */
.page {
  width: 100%;
  height: 100%;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.page img,
.page.hard img,
.page.front img,
.page.back img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* <-- cambia cover in contain */
  position: absolute;
  top: 0;
  left: 0;
  margin: 0;
  pointer-events: none;
  background-color: rgb(0, 0, 0);
  /* opzionale, per riempire gli spazi vuoti */
}


/* Copertina rigida */
.hard-cover {
  background-color: red;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.hard-cover img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* così si vede tutta la copertina */
  background-color: black;
}

/* Pulsanti fissi in basso */
.fixed-bottom-section {
  position: fixed;
  bottom: 60px;
  left: 0;
  width: 100%;
  padding: 15px 0;
  text-align: center;
  z-index: 1000;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
}

.fixed-bottom-section .btn-all,
.btn-home,
.btn-audio1,
.btn-audio2 {
  padding: 12px 30px;
  border-radius: 8px;
  font-size: 16px;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  margin: 0 5px;
  text-decoration: none;
  cursor: pointer;
  transition: 0.3s ease;
}

/* Stili pulsanti */
.btn-all {
  background-color: white;
  color: green;
}

.btn-download:hover {
  background-color: darkblue;
  color: yellow;
}

.btn-home {
  background-color: white;
  color: darkred;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.btn-home:hover {
  background-color: darkred;
  color: white;
}

.btn-audio1,
.btn-audio2 {
  background-color: #ffffff;
  color: orange;
  font-weight: bold;
}

.btn-audio1:hover {
  background-color: red;
  color: white;
}

.btn-audio2:hover {
  background-color: deepskyblue;
  color: white;
}

.btn-all.disabled,
.btn-download:disabled {
  opacity: 0.5;
  pointer-events: none;
  cursor: default;
}

/* Footer */
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: #111827;
  color: white;
  padding: 12px 0;
  text-align: center;
  z-index: 1100;
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
}

footer a {
  color: #00A859;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

@media only screen and (max-width: 768px) {
  #flipbook-container {
    position: absolute;
    top: 60px;
    bottom: 120px;
    /* spazio per pulsanti + footer */
    left: 0;
    right: 0;
    height: auto;
    overflow: hidden;
  }

  .fixed-bottom-section {
    bottom: 60px;
    padding: 10px 0;
  }

  footer {
    height: 60px;
    padding: 8px 0;
    font-size: 14px;
  }

  .hard-cover img,
  .page img {
    object-fit: contain;
  }

  #flipbook {
    max-width: 100vw;
    max-height: 100%;
  }

  html,
  body {
    overflow: auto;
  }
}