/* Impostazioni globali */
body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #0D47A1;
  /* Blu scuro moderno */
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

/* Contenitore principale */
.container {
  background: #1976D2;
  /* Blu più chiaro per la card */
  padding: 2em;
  border-radius: 10px;
  text-align: center;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

/* Titoli e sottotitoli */
h1.title {
  margin: 0;
  font-size: 2em;
}

h2.subtitle {
  margin: 0.2em 0 1em;
  font-size: 1.5em;
}

.subtitle {
  font-size: 1.2em;
  margin-bottom: 1em;
}

/* Pulsanti */
.btn {
  background: #0D47A1;
  color: #fff;
  border: none;
  padding: 0.7em 1.5em;
  font-size: 1.1em;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.3s;
}

.btn:hover {
  background: #063970;
}

/* Informazioni (codice stanza, ascoltatori, QR Code e VU Meter) */
.info {
  margin: 1em 0;
}

/* QR Code centrato */
.qrcode {
  margin: 1em auto;
  width: 220px;
  height: 220px;
}

/* VU Meter */
.vu-meter {
  margin: 1em auto;
  width: 220px;
  height: 20px;
  background: #ccc;
  border-radius: 10px;
  overflow: hidden;
}

.vu-meter-fill {
  height: 100%;
  width: 0%;
  background: #00E676;
  /* Verde per il livello audio */
  transition: width 0.1s linear;
}

/* Controlli */
.controls {
  margin-top: 1.5em;
}

.mic-controls {
  margin-top: 1em;
}

.mic-icon {
  font-size: 2em;
  cursor: pointer;
  margin-bottom: 1em;
}

.volume-control-container {
  margin: 1em 0;
}

#volumeControl {
  width: 100%;
  max-width: 400px;
}

/* Stato della connessione */
.status-text {
  margin-top: 1em;
  font-style: italic;
}

/* Popup overlay styling */
/* Popup overlay styling */
#roomChoicePopup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  /* Nascondi di default */
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

/* Popup content styling */
#roomChoicePopup .popup-content {
  background: #fff;
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  max-width: 90%;
  width: 400px;
  text-align: center;
}

/* Popup message styling */
#roomChoicePopup #popupMessage {
  font-size: 16px;
  margin-bottom: 20px;
  color: #333;
}

/* Bottoni del popup */
#roomChoicePopup button {
  background: #007bff;
  color: #fff;
  border: none;
  padding: 10px 20px;
  margin: 0 10px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.3s ease;
}

#roomChoicePopup button:hover {
  background: #0056b3;
}

.input {
  width: 100%;
  padding: 10px;
  margin: 8px 0;
  border: 1px solid #1565C0;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.9);
  color: #0D47A1;
}

.form-container {
  max-width: 300px;
  margin: 0 auto;
}

.hidden {
  display: none;
}

.status-container {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 10px 0;
}

.listeners-container {
  display: flex;
  align-items: center;
  gap: 5px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #ccc;
}

.status-dot.connected {
  background-color: #4CAF50;
}

.status-dot.disconnected {
  background-color: #f44336;
}

.status-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
  padding: 10px;
  font-family: inherit;
}

.listeners-box,
.connection-box {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  font-size: 1em;
}

#roomCode {
  margin: 0;
  white-space: nowrap;
  font-family: inherit;
  font-size: 1em;
}

@media (max-width: 480px) {
  .status-row {
    gap: 10px;
    font-size: 0.9em;
  }

  #roomCode {
    flex-basis: 100%;
    text-align: center;
    margin-bottom: 5px;
  }

  .listeners-box,
  .connection-box {
    flex: 0 0 auto;
  }
}

.fas {
  font-size: 1em;
  /* match icon size with text */
}

.status-container {
  display: flex;
  justify-content: center;
  width: 100%;
  margin: 10px 0;
}

.status-row {
  display: flex;
  align-items: center;
  
  font-family: inherit;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.5em;
  color: #1565C0;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.modal-content {
  background-color: white;
  margin: 15% auto;
  padding: 20px;
  width: 80%;
  max-width: 500px;
  border-radius: 10px;
  position: relative;
}

.close {
  position: absolute;
  right: 10px;
  top: 5px;
  font-size: 28px;
  font-weight: bold;
  color: #666;
  cursor: pointer;
}

.select-step {
  display: flex;
  flex-direction: column;
  margin-bottom: 20px;
}

.dropdown-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.back-btn {
  order: -1;
  /* move to start of flex container */
}

.back-btn {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 8px;
  font-size: 1.5em;
  transition: transform 0.2s ease;
}

.back-btn:hover {
  transform: scale(1.1);
}

.tour-icon {
  color: white;
  font-size: 1.5em;
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.summary-content {
  background: rgba(255, 255, 255, 0.1);
  padding: 15px;
  border-radius: 5px;
  margin-top: 10px;
}

.select-label {
  color: white;
}

.select-step {
  display: flex;
  flex-direction: column;
  margin-bottom: 20px;
}

.summary-content {
  background: rgba(255, 255, 255, 0.1);
  padding: 15px;
  border-radius: 5px;
  margin: 15px 0;
}

.summary-title {
  color: white;
  margin-bottom: 10px;
}

.message-controls {
  margin: 20px 0;
  display: flex;
  gap: 10px;
  justify-content: center;
}

.message-controls .input {
  flex: 1;
  max-width: 300px;
}

.message-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  z-index: 1000;
}

.message-popup.hidden {
  display: none;
}

.message-content {
  position: relative;
  color: #333;
}

.close-message {
  position: absolute;
  right: -10px;
  top: -10px;
  cursor: pointer;
  font-size: 20px;
  color: #666;
}

.message-content p {
  margin: 10px 0;
  font-size: 16px;
}


.message-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  margin-top: 15px;
}

.message-controls textarea {
  width: 100%;
  min-height: 100px;
  resize: vertical;
}

.message-controls .btn {
  width: 150px;
}

.audio-controls {
  margin-bottom: 30px;
}

.room-input {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  color: white;
  font-size: 1.1em;
  padding: 12px 15px;
  width: 100%;
  max-width: 300px;
  text-align: center;
  transition: all 0.3s ease;
}

.room-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.room-input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.15);
}

.message-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #1976D2;
  padding: 25px;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  min-width: 300px;
  max-width: 80%;
}

.message-content {
  position: relative;
  color: white;
  text-align: center;
}

.message-content h3 {
  margin: 0 0 15px 0;
  font-size: 1.2em;
  color: white;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 10px;
}

.message-content p {
  margin: 15px 0;
  font-size: 1.1em;
  line-height: 1.4;
  padding: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
}

.close-message {
  position: absolute;
  right: -15px;
  top: -15px;
  cursor: pointer;
  font-size: 24px;
  color: white;
  background: rgba(0, 0, 0, 0.2);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
}

.close-message:hover {
  background: rgba(0, 0, 0, 0.4);
}


.tour-gallery {
  display: flex;
  overflow-x: auto;
  gap: 10px;
  padding: 10px;
  /* opzionale: nasconde la scrollbar in alcuni browser */
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.tour-gallery::-webkit-scrollbar {
  display: none;
}

.tour-item {
  flex: 0 0 auto;
  width: 150px;
  text-align: center;
  cursor: pointer;
  padding: 5px;
  transition: border-color 0.3s;
  position: relative;
}

.tour-item.selected img {
  border: 2px solid #ffffff;
  border-radius: 5px;
  padding: 3px;
  box-sizing: border-box;
}

.tour-item.selected {
  border-color: transparent;
}

.tour-item img {
  width: 100%;
  height: auto;
  border-radius: 5px;
  margin-bottom: 5px;
  border: 2px solid transparent;
  padding: 3px;
  box-sizing: border-box;
  transition: border-color 0.3s;
}

/* Stile per il tag "inviato" */
.sent-label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%) translateY(-50%); /* Posiziona il tag a metà della sua altezza */
  background-color: #4CAF50;
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  z-index: 2;
  /* Rimuoviamo qualsiasi posizionamento top/bottom predefinito */
  display: block; /* Assicuriamoci che sia visibile */
}

.tour-gallery-container {
  position: relative;
  width: 100%;
}

.tour-gallery {
  display: flex;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 20px 40px;
  -webkit-overflow-scrolling: touch;
}

.gallery-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.3);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 2;
}

.gallery-arrow:hover {
  background: rgba(0, 0, 0, 0.5);
}

.gallery-arrow.prev {
  left: 0;
}

.gallery-arrow.next {
  right: 0;
}

@media (max-width: 480px) {
  .gallery-arrow {
    width: 30px;
    height: 30px;
  }
}

.tour-gallery-container {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tour-gallery-container h3 {
  margin: 0 0 20px 0;
  width: 100%;
  text-align: center;
  position: relative;
}

.tour-gallery {
  width: 100%;
  display: flex;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 20px 40px;
  -webkit-overflow-scrolling: touch;
}


.select-step {
  width: 100%;
  height: 300px;
  /* Scegli l'altezza desiderata */
  position: relative;
  overflow: hidden;
  transition: opacity 0.3s ease;
}

.select-step.hidden {
  opacity: 0;
  /* Puoi usare anche visibility: hidden se preferisci */
  pointer-events: none;
}

/* Se usi le gallerie, assicurati che il container mantenga le dimensioni */
.tour-gallery-container,
.tour-gallery {
  width: 100%;
  height: 100%;
}

.selection-summary {
  background: rgba(255, 255, 255, 0.1);
  padding: 10px 15px;
  border-radius: 5px;
  margin-bottom: 15px;
  font-size: 0.9em;
  color: rgba(255, 255, 255, 0.9);
}

.tour-gallery img {
  width: 150px;
  /* Imposta la larghezza desiderata */
  height: 150px;
  /* Imposta l'altezza desiderata */
  object-fit: cover;
  /* Fa in modo che l'immagine mantenga le proporzioni riempiendo lo spazio */
}


.select-step {
  position: relative;
  width: 100%;
}

.back-btn {
  position: absolute;
  left: 0;
  top: 10px;
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 10px;
  z-index: 10;
  transition: transform 0.2s ease;
}

.back-btn:hover {
  transform: scale(1.1);
}

.back-btn i {
  color: white;
}





/* Stile per la sezione "join-room" */
.join-room {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  width: 300px;
  margin: 20px auto;
  /* centra il box nella pagina */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.join-room h2 {
  font-size: 1.2em;
  margin-bottom: 15px;
  color: #fff;
  /* Assicurati che il colore si adatti al tema */
}

.join-room input {
  width: 80%;
  padding: 10px;
  border: none;
  border-radius: 4px;
  margin-bottom: 15px;
  font-size: 1em;
}

.join-room button {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  background-color: #3498db;
  color: #fff;
  font-size: 1em;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.join-room button:hover {
  background-color: #2980b9;
}


#mediaContainer {
  max-width: 90vw;
  max-height: 80vh;
  overflow: auto;
  margin: 10px 0;
}

#mediaContainer img,
#mediaContainer video {
  max-width: 100%;
  height: auto;
  border-radius: 5px;
  display: block;
  margin: 0 auto;
}

.message-popup {
  max-width: 90vw;
  max-height: 90vh;
}



.tour-gallery::after {
  content: "";
  flex: 0 0 170px;
  /* 150px (l'elemento) + 20px (gap) */
}

.modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
}

#confirmStop {
  background-color: #ff4444;
}

#cancelStop {
  background-color: #666;
}







.status-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  padding: 10px;
  background-color: rgba(0, 0, 0, 0.2);
}

.status-row {
  display: flex;
  align-items: center;
  width: 100%;
}

.top-row {
  justify-content: space-between;
  flex-wrap: nowrap;
  padding: 10px 10px;

}

.bottom-row {
  justify-content: space-around;
  padding: 5px 10px;
}

#roomCode {
  margin: 0;
  font-size: 0.9em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
  padding-right: 10px;
}

.btn-icon {
  padding: 8px;
  margin-left: 5px;
  flex-shrink: 0;
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.listeners-box,
.connection-box {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

/* Mobile specific adjustments */
@media screen and (max-width: 480px) {
  .status-container {
    padding: 5px;
  }
  
  .top-row {
    padding: 5px;
  }
  
  .btn-icon {
    width: 30px;
    height: 30px;
    padding: 6px;
    margin-left: 3px;
  }
  
  #roomCode {
    font-size: 0.85em;
    max-width: 50%;
  }
}


.join-btn {
  padding: 25px 20px!important;
  font-size: 1.4em;
  font-weight: bold;
  background-color: rgb(13, 71, 161)!important;
  color: white;
  border: 2px solid black;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  margin-top: 15px;
  width: 80%;
  text-transform: uppercase;
}

.join-btn i {
  font-size: 0.9em;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.5);
    opacity: 0.7;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Stile per il pulsante di invio */
.send-button {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background-color: #4CAF50;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 4px 12px;
  font-size: 14px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  opacity: 0.9;
  transition: all 0.3s ease;
  min-width: 60px;
  height: auto;
}

.send-button:hover {
  opacity: 1;
  background-color: #45a049;
  transform: translateX(-50%) scale(1.05);
}

/* Mostra il pulsante di invio sempre (non solo quando selezionato) */
.tour-item .send-button {
  display: flex;
}