/* Reset di base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f5f5f5;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
header {
  margin-bottom: 30px;
  text-align: center;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  color: #2c3e50;
}

.survey-description {
  font-size: 1.1rem;
  color: #555;
  max-width: 800px;
  margin: 0 auto;
}

/* Navigazione */
nav ul {
  display: flex;
  list-style: none;
  justify-content: center;
  margin: 20px 0;
}

nav ul li {
  margin: 0 10px;
}

nav ul li a {
  text-decoration: none;
  color: #3498db;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 4px;
  transition: background-color 0.3s;
}

nav ul li a:hover {
  background-color: #eaf2f8;
}

/* Form */
form {
  background-color: #fff;
  border-radius: 8px;
  padding: 30px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
}

.form-group {
  margin-bottom: 20px;
}

.form-row {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

.form-row .form-group {
  flex: 1;
  margin-bottom: 0;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #2c3e50;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  transition: border-color 0.3s;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="datetime-local"]:focus,
select:focus,
textarea:focus {
  border-color: #3498db;
  outline: none;
}

input[type="checkbox"],
input[type="radio"] {
  margin-right: 8px;
}

.help-text {
  font-size: 0.9rem;
  color: #777;
  margin-top: 5px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 30px;
}

/* Bottoni */
.btn {
  display: inline-block;
  background-color: #3498db;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  text-decoration: none;
  transition: background-color 0.3s;
}

.btn:hover {
  background-color: #2980b9;
}

.btn-secondary {
  background-color: #95a5a6;
}

.btn-secondary:hover {
  background-color: #7f8c8d;
}

.btn-danger {
  background-color: #e74c3c;
}

.btn-danger:hover {
  background-color: #c0392b;
}

.btn-small {
  padding: 5px 10px;
  font-size: 0.9rem;
}

/* Tabelle */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 30px;
  background-color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  overflow: hidden;
}

th,
td {
  padding: 15px;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

th {
  background-color: #f8f9fa;
  font-weight: 600;
  color: #2c3e50;
}

tr:hover {
  background-color: #f5f5f5;
}

/* Messaggi */
.error-box,
.success-box {
  padding: 15px;
  border-radius: 4px;
  margin-bottom: 20px;
}

.error-box {
  background-color: #fce4e4;
  border: 1px solid #e74c3c;
  color: #c0392b;
}

.success-box {
  background-color: #e7f4e4;
  border: 1px solid #27ae60;
  color: #27ae60;
}

.error-box ul,
.success-box ul {
  margin-left: 20px;
}

/* Stato */
.status {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 0.9rem;
}

.status.active {
  background-color: #e7f4e4;
  color: #27ae60;
}

.status.inactive {
  background-color: #f8f9fa;
  color: #95a5a6;
}

/* Sondaggio */
.survey-progress {
  margin-bottom: 20px;
}

.progress-text {
  margin-bottom: 5px;
  font-size: 0.9rem;
  color: #555;
}

.progress-bar {
  height: 10px;
  background-color: #ecf0f1;
  border-radius: 5px;
  overflow: hidden;
}

.progress {
  height: 100%;
  background-color: #3498db;
  transition: width 0.3s;
}

.page-header {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #ecf0f1;
}

.page-header h2 {
  font-size: 1.8rem;
  color: #2c3e50;
  margin-bottom: 10px;
}

.question {
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid #ecf0f1;
}

.question-text {
  font-size: 1.2rem;
  font-weight: 500;
  margin-bottom: 15px;
  color: #2c3e50;
}

.required {
  color: #e74c3c;
  margin-left: 5px;
}

.question-image {
  margin-bottom: 15px;
}

.question-image img {
  max-width: 100%;
  border-radius: 4px;
}

.question-options {
  margin-left: 10px;
}

.option {
  margin-bottom: 10px;
}

/* Gestione sondaggio */
.survey-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.survey-pages {
  margin-bottom: 30px;
}

.survey-page {
  background-color: #fff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.page-questions {
  margin-left: 20px;
}

.no-questions {
  color: #95a5a6;
  font-style: italic;
}

.questions-list {
  list-style: none;
}

.question-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid #ecf0f1;
}

.question-text {
  flex: 2;
}

.question-type {
  flex: 1;
  color: #7f8c8d;
  font-size: 0.9rem;
}

.question-actions {
  display: flex;
  gap: 5px;
}

.add-question,
.add-page {
  margin-top: 20px;
  text-align: center;
}

/* Opzioni di risposta nell'editor */
.options-list {
  margin-bottom: 20px;
}

.option-item {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.option-item input[type="text"] {
  flex: 1;
}

/* Messaggio di ringraziamento */
.thank-you-message {
  text-align: center;
  margin-bottom: 30px;
}

.thank-you-message p {
  font-size: 1.2rem;
  margin-bottom: 10px;
}

.actions {
  text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
  .form-row {
    flex-direction: column;
    gap: 10px;
  }

  .survey-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .question-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .question-actions {
    margin-top: 10px;
  }
}

/* Stili per l'autenticazione */
.auth-container {
  max-width: 500px;
  margin: 0 auto;
}

.auth-form {
  background-color: #fff;
  border-radius: 8px;
  padding: 30px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.auth-links {
  margin-top: 20px;
  text-align: center;
  font-size: 0.9rem;
}

.auth-links a {
  color: #3498db;
  text-decoration: none;
}

.auth-links a:hover {
  text-decoration: underline;
}

/* Stili per le immagini e modal */
.image-preview {
  max-width: 300px;
  max-height: 200px;
  margin-top: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.image-preview:hover {
  transform: scale(1.05);
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.9);
}

.modal-content {
  margin: auto;
  display: block;
  max-width: 90%;
  max-height: 90%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.close {
  position: absolute;
  top: 15px;
  right: 35px;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  transition: 0.3s;
  cursor: pointer;
}

.close:hover,
.close:focus {
  color: #bbb;
  text-decoration: none;
  cursor: pointer;
}

/* Aggiungi questi stili per le domande condizionali */
.hidden {
  display: none !important;
}

.conditional-question {
  transition: opacity 0.3s ease;
}

.conditional-question.hidden {
  opacity: 0;
  height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
}
