/* Stile per Compiti - Versione DSA */
body {
  font-family: Arial, Verdana, sans-serif;
  background: #f5f7fa;
  margin: 0;
  padding: 20px;
  letter-spacing: 0.04em;
  line-height: 1.9;
}

.container {
  width: 95%;
  max-width: 1100px;
  margin: auto;
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* HEADER */
.header {
  text-align: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #e8f5e9;
}

.header h1 {
  color: #2e7d32;
  margin-bottom: 10px;
  font-size: 2em;
}

.subtitle {
  font-size: 1.1em;
  color: #666;
  margin-top: 10px;
}

/* SEZIONI ESPANDIBILI */
.section {
  margin-bottom: 20px;
}

.section h2 {
  margin: 0;
  padding: 0;
  font-size: 1em;
}

.section-button {
  width: 100%;
  padding: 15px;
  font-size: 1.2em;
  background: #e0f2f1;
  border: 2px solid #80cbc4;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font-weight: bold;
  color: #004d40;
  transition: all 0.3s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 77, 64, 0.1);
  font-family: Arial, Verdana, sans-serif;
  letter-spacing: 0.04em;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.section-button:hover {
  background: #b2dfdb;
  border-color: #4db6ac;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 77, 64, 0.2);
}

.section-button .arrow {
  color: #00796b;
  font-size: 1.2em;
}

.section-content {
  display: none;
  padding: 20px;
  border: 2px solid #e8f5e9;
  border-top: none;
  border-radius: 0 0 8px 8px;
  background: #fafafa;
  overflow-x: auto;
}

.section-content.active {
  display: block;
}

.arrow {
  transition: transform 0.3s ease;
  font-size: 0.8em;
}

.arrow.rotated {
  transform: rotate(180deg);
}

/* CONTENUTI SPECIFICI */
.problem-text {
  background: #f0f4f8;
  padding: 15px;
  margin: 15px 0;
  border-left: 5px solid #2196f3;
  border-radius: 4px;
}

.solution-box {
  background: white;
  padding: 20px;
  margin-top: 20px;
  border-radius: 8px;
  border: 2px solid #4caf50;
}

.step {
  background: #f1f8e9;
  padding: 15px;
  margin: 15px 0;
  border-radius: 8px;
}

/* Intestazioni dei passi — blu come nella versione standard */
.step h3 {
  color: #0277bd;
  border-bottom: 1px solid #e8f5e9;
  padding-bottom: 5px;
}

.formula-box {
  background: white;
  padding: 15px;
  margin: 15px 0;
  border-left: 4px solid #4caf50;
  border-radius: 4px;
  overflow-x: visible;
  overflow-y: visible;
}

.result-box {
  background: #e8f5e9;
  padding: 15px;
  border: 2px solid #2e7d32;
  border-radius: 8px;
  margin-top: 12px;
}

/* SEPARATORE */
.separator {
  border: 0;
  height: 2px;
  background: linear-gradient(to right, transparent, #28a745, transparent);
  margin: 15px 0 25px 0;
}

/* HEADER BOX */
.header-box {
  display: flex !important;
  flex-direction: row !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 15px !important;
  border: 2px dashed #28a745 !important;
  border-radius: 8px !important;
  background-color: white !important;
  margin-bottom: 25px !important;
}

.header-box:hover {
  background-color: #f0fdf4 !important;
  cursor: pointer;
}

/* INSTRUCTION BOX */
.instruction-box {
  background-color: #e8f5e9;
  border-left: 5px solid #2e7d32;
  padding: 15px;
  margin: 20px auto;
  border-radius: 8px;
  font-size: 0.95em;
  color: #1b5e20;
  display: block;
  text-align: left;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  max-width: 90%;
}

/* TITOLO ESERCIZIO */
.question h2 {
  color: #6a1b9a;
  border-bottom: 2px dashed #ce93d8;
  padding-bottom: 5px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

/* BOTTONE AUDIO */
#btn-audio {
  background-color: #ff9800;
  color: #ffffff;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  -webkit-appearance: none;
  appearance: none;
}

#btn-audio:hover {
  background-color: #f57c00;
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

#btn-audio:active {
  transform: scale(0.98);
}

.btn-ascolta-domanda {
  background-color: #ff9800;
  color: white;
  border: none;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.6em;
  vertical-align: middle;
  cursor: pointer;
  font-weight: normal;
  transition: transform 0.2s;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.btn-ascolta-domanda:hover {
  transform: scale(1.1);
  background-color: #f57c00;
}

/* GRAFICI */
.graph img {
  display: block;
  margin: 0 auto 10px auto;
  max-width: 95%;
  height: auto;
}

.graph-container {
  background-color: white;
  border: 1px solid #c8e6c9;
  border-radius: 12px;
  padding: 20px;
  margin: 20px auto;
  max-width: 700px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.graph-container img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.graph-caption {
  font-size: 0.95em;
  font-style: italic;
  color: #555;
  margin-top: 15px;
  border-top: 1px solid #eee;
  padding-top: 10px;
  display: block;
}

/* TABELLE */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 20px 0;
  background-color: #ffffff;
}

table th {
  background-color: #e8f5e9;
  color: #2e7d32;
  font-weight: bold;
}

table td, table th {
  padding: 12px;
  border: 2px solid #ccd1d9 !important;
  text-align: center;
}

table tr:nth-child(even) {
  background-color: #fcfdfc;
}

/* NAVIGAZIONE */
.nav-buttons {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 30px;
  flex-wrap: wrap;
}

.btn-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 260px;
  height: 45px;
  padding: 12px 24px;
  background: white;
  color: #2e7d32;
  border: 2px solid #2e7d32;
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
  font-size: 0.95em;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  box-sizing: border-box;
}

.btn-nav:hover {
  background: #2e7d32;
  color: white;
  transform: translateY(-2px);
}

.btn-stampa {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 260px;
  height: 45px;
  background-color: white;
  color: #9c27b0;
  text-decoration: none;
  border: 2px solid #9c27b0;
  border-radius: 8px;
  font-size: 0.95em;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

.btn-stampa:hover {
  background-color: #9c27b0;
  color: white;
  transform: translateY(-2px);
}

.btn-valida {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 260px;
  height: 45px;
  background-color: white;
  color: #0277bd;
  text-decoration: none;
  border: 2px solid #0277bd;
  border-radius: 8px;
  font-size: 0.85em;
  font-weight: bold;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.btn-valida:hover {
  background-color: #0277bd;
  color: white;
  transform: translateY(-2px);
}

.btn-nav-bordeaux {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 260px;
  height: 45px;
  padding: 12px 24px;
  background: white;
  color: #7b1f2e;
  border: 2px solid #7b1f2e;
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
  font-size: 0.95em;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  box-sizing: border-box;
}

.btn-nav-bordeaux:hover {
  background: #7b1f2e;
  color: white;
  transform: translateY(-2px);
}

/* FEEDBACK */
.feedback-box {
  background: #c8e6c9;
  padding: 25px;
  border-radius: 8px;
  margin: 40px 0;
  border-left: 5px solid #ff9800;
  text-align: center;
}

/* CONTATORE FISSO */
#progress-box {
  position: fixed;
  top: 15px;
  right: 15px;
  background: #e3f2fd;
  border-left: 6px solid #0277bd;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 1.05em;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1000;
  white-space: nowrap;
  font-family: Arial, Verdana, sans-serif;
}

#progress-count {
  font-size: 1.25em;
  font-weight: 700;
  color: #0277bd;
}

.progress-container {
  width: 100%;
  height: 14px;
  background: #e0e0e0;
  border-radius: 8px;
  margin: 10px 0 0 0;
  overflow: hidden;
}

#progress-bar {
  height: 100%;
  width: 0%;
  background: #28a745;
  transition: width 0.4s ease, background 0.6s ease;
}

.gold-complete {
  background: linear-gradient(270deg, #ffd700, #ffec8b, #ffd700, #ffec8b) !important;
  background-size: 400% 400%;
  animation: goldShine 2s ease infinite;
}

@keyframes goldShine {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ACCESSIBILITÀ */
button:focus, a:focus {
  outline: 3px solid #ff9800;
  outline-offset: 2px;
}

/* STAMPA */
@media print {
  body { background: white; padding: 0; }
  .container { max-width: 100%; box-shadow: none; border: none; }
  .section-button { background: white !important; border: 1px solid #ccc !important; }
  .arrow, .nav-buttons, .btn-ascolta-domanda, #btn-audio, .instruction-box { display: none !important; }
  .section-content { display: block !important; border: none !important; }
  .section { page-break-inside: avoid; margin-bottom: 30px; }
  .step, .formula-box, .solution-box { page-break-inside: avoid; border: 1px solid #eee !important; }
  #progress-box { display: none !important; }
  .feedback-box { display: none !important; }
}

/* RESPONSIVE TABLET */
@media (max-width: 768px) {
  body { padding: 10px; }
  .container { padding: 15px; }
  .question h2 { font-size: 1.1em; flex-direction: column; align-items: flex-start; }
  .section-button { font-size: 1.05em; padding: 14px; }
  #progress-box {
    font-size: 13px;
    padding: 4px 8px;
    top: 6px;
    right: 6px;
  }
  #progress-count { font-size: 15px; }
}

/* RESPONSIVE SMARTPHONE */
@media (max-width: 600px) {
  .header-box {
    flex-direction: column !important;
    gap: 15px !important;
  }
  .btn-nav, .btn-stampa, .btn-valida, .btn-nav-bordeaux {
    width: 100%;
  }
  .formula-box {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}
