/* ==========================================================================
   YHTEINEN CSS-TIEDOSTO työvoimatarpeen ennakoinnille
   Kaikki sivut: index.html, simulointi.html, skenaariot.html, survey.html
   ========================================================================== */

/* ==========================================================================
   Globaalit resetit ja perusasetukset
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  color: #502479;
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
  flex: 1;
}

/* ==========================================================================
   KORJAUS: Grafiikkakorttien korkeus ja venytys - RESPONSIIVISUUS KESKITYKSENÄ
   ========================================================================== */

/* A) Simulointisivun chart-container - TÄYSIN RESPONSIIVINEN */
.chart-container {
  background: white;
  padding: 1.5rem;
  border-radius: 0.75rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  height: auto !important;
  min-height: 350px;
  display: flex;
  flex-direction: column;
  position: relative;
  width: 100%;
}

/* B) Kaavio saa skaalautua täysin responsiivisesti */
.chart-container canvas {
  flex: 1 1 auto;
  min-height: 250px;
  max-height: none !important;
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 16/9; /* Säilyttää kuvasuhteen */
  object-fit: contain;
}

/* C) Etusivun grafiikkakortit */
.chart-card {
  background: white;
  padding: 1.5rem;
  border-radius: 1rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  text-align: center;
  min-height: 350px;
  display: flex;
  flex-direction: column;
  position: relative;
  width: 100%;
}

.chart-card canvas {
  flex: 1;
  min-height: 250px;
  max-height: none !important;
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 16/9;
  object-fit: contain;
}

/* D) Taulukkokortit */
.table-container {
  background: white;
  padding: 1.5rem;
  border-radius: 0.75rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  overflow-x: auto;
  min-height: 350px;
  display: flex;
  flex-direction: column;
}

.table-container table {
  flex: 1;
  min-height: 200px;
}

/* E) MOBIILIOPTIMOINNIT - PARANNETTU RESPONSIIVISUUS */
@media (max-width: 768px) {
  .chart-container,
  .chart-card,
  .table-container {
    min-height: 300px;
    padding: 1.25rem;
  }
  
  .chart-container canvas,
  .chart-card canvas {
    min-height: 200px;
    aspect-ratio: 4/3; /* Mobiilissa hieman korkeammat kaaviot */
  }
}

@media (max-width: 480px) {
  .chart-container,
  .chart-card,
  .table-container {
    min-height: 280px;
    padding: 1rem;
  }
  
  .chart-container canvas,
  .chart-card canvas {
    min-height: 180px;
    aspect-ratio: 1; /* Pienissä näytöissä neliönmuotoinen */
  }
}

/* ==========================================================================
   NAVBAR - KESKITETTY JA RESPONSIIVINEN
   ========================================================================== */
.navbar {
  background: #502479;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  width: 100%;
  position: relative;
  z-index: 1000;
}

.navbar-brand {
  color: #f8fafc;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  white-space: nowrap;
  margin-bottom: 0.75rem;
  text-align: center;
  padding: 0 1rem;
}

.navbar-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  align-items: center;
  max-width: 100%;
  padding: 0 1rem;
}

.navbar-link {
  color: #ffffff;
  font-size: 1rem;
  font-weight: 400;
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  position: relative;
  transition: all 0.2s;
  white-space: nowrap;
  text-align: center;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
}

.navbar-link:hover {
  color: #f0f0f0;
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

/* ==========================================================================
   RESPONSIIVISUUS NAVBARILLE
   ========================================================================== */
@media (max-width: 768px) {
  .navbar {
    padding: 0.75rem;
  }
  
  .navbar-brand {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
  }
  
  .navbar-links {
    gap: 0.5rem;
  }
  
  .navbar-link {
    font-size: 0.9rem;
    padding: 0.4rem 0.6rem;
  }
}

@media (max-width: 480px) {
  .navbar-links {
    gap: 0.4rem;
  }
  
  .navbar-link {
    font-size: 0.85rem;
    padding: 0.35rem 0.5rem;
    min-width: auto;
    flex: 1;
    max-width: 45%;
  }
  
  .navbar-brand {
    font-size: 1rem;
  }
}

@media (max-width: 360px) {
  .navbar-link {
    font-size: 0.8rem;
    padding: 0.3rem 0.4rem;
  }
  
  .navbar-links {
    gap: 0.3rem;
  }
}

/* ==========================================================================
   Otsikko ja kuvaus
   ========================================================================== */
h1 {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 800;
  background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 1rem;
  text-align: center;
}

.description {
  font-size: 1rem;
  color: #000;
  max-width: 800px;
  margin: 0 auto 2.5rem;
  line-height: 1.7;
  text-align: center;
}

.data-last-updated {
  font-size: 0.75rem;
  color: #9ca3af;
  margin: -0.5rem auto 0;
  text-align: center;
  display: none;
}

/* ==========================================================================
   Kortit
   ========================================================================== */
.hero-card,
.form-card,
#result,
#charts,
.main-result,
.scenario-card,
.modules-card,
.preview-card,
.portlet-bank,
.survey-builder,
.results-card,
.survey-builder,
.portlet-bank {
  width: 100%;
  max-width: 100%;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  padding: 1.5rem;
  border-radius: 1rem;
  box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

/* ==========================================================================
   Lomake
   ========================================================================== */
.form-row {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  width: 100%;
}

@media (min-width: 480px) {
  .form-row {
    flex-direction: row;
    flex-wrap: wrap;
  }
  
  .form-row > div {
    flex: 1;
    min-width: 200px;
  }
}

label {
  display: block;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 0.75rem;
  font-size: clamp(0.9rem, 3.5vw, 0.95rem);
}

select {
  width: 100%;
  max-width: 100%;
  padding: 1rem 1.25rem;
  font-size: clamp(0.95rem, 3.5vw, 1rem);
  border: 2px solid #e5e7eb;
  border-radius: 0.75rem;
  background: white;
  transition: all 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.75rem center;
  background-repeat: no-repeat;
  background-size: 1.5em;
  padding-right: 3rem;
  box-sizing: border-box;
}

select:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
  transform: translateY(-1px);
}

/* ==========================================================================
   Painikkeet - KAIKKI VIOLETIT (#502479)
   ========================================================================== */
.button-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  justify-content: center;
  align-items: center;
  margin: 1.5rem 0;
  width: 100%;
}

@media (min-width: 480px) {
  .button-group {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1rem;
  }
  
  .button-group button {
    flex: 1;
    min-width: 200px;
    max-width: 300px;
  }
}

/* Kaikki painikkeet samalla violetilla värillä */
button {
  width: 100%;
  max-width: 100%;
  padding: 1rem;
  font-size: 1rem;
  font-weight: 400;
  border: none;
  border-radius: 0.75rem;
  color: white;
  cursor: pointer;
  transition: all 0.2s;
  flex: none;
  min-width: 0;
  background: #502479;
}

button:hover {
  background: #3a1a57;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(80, 36, 121, 0.3);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(80, 36, 121, 0.2);
}

@media (min-width: 480px) {
  button {
    width: auto;
    min-width: 160px;
    flex: 1;
  }
}

/* PDF-vientipainike */
#pdfExport {
  width: 100%;
  max-width: 100%;
  background: #502479;
  display: none;
  margin: 1.5rem 0;
  padding: 1rem;
  border-radius: 0.75rem;
}

#pdfExport:hover {
  background: #3a1a57;
}

/* ==========================================================================
   Tulokset (index.html)
   ========================================================================== */
#result,
#charts {
  display: none;
}

.main-result {
  width: 100%;
  max-width: 100%;
  background: #ffffff;
  border: 2px solid #502479;
  padding: 1.5rem;
  border-radius: 1rem;
  text-align: center;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.main-number {
  font-size: clamp(2rem, 10vw, 3.5rem);
  font-weight: 800;
  color: #502479;
  display: block;
  margin-bottom: 0.5rem;
  line-height: 1.1;
}

.main-label {
  font-size: clamp(1rem, 4vw, 1.2rem);
  font-weight: 600;
  color: #502479;
}

.confidence-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 1.5rem 0;
  width: 100%;
}

@media (min-width: 480px) {
  .confidence-row {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }
}

.confidence-card,
.retirement-card {
  width: 100%;
  max-width: 100%;
  background: white;
  padding: 1.25rem;
  border-radius: 0.75rem;
  text-align: center;
  border-left: 4px solid #4d9e04;
  box-sizing: border-box;
  overflow: hidden;
}

.retirement-card {
  border-left-color: #ef4444;
  grid-column: 1 / -1;
}

@media (min-width: 480px) {
  .retirement-card {
    grid-column: auto;
  }
}

.components-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
  width: 100%;
}

.component-card {
  width: 100%;
  max-width: 100%;
  background: white;
  padding: 1rem;
  border-radius: 0.75rem;
  border: 1px solid #e5e7eb;
  text-align: center;
  transition: all 0.2s;
  box-sizing: border-box;
  overflow: hidden;
}

.component-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.component-number {
  font-size: clamp(1.25rem, 6vw, 1.5rem);
  font-weight: 700;
  color: #502479;
  display: block;
  margin-bottom: 0.5rem;
}

.component-label {
  font-size: clamp(0.8rem, 3.5vw, 0.9rem);
  color: #502479;
  font-weight: 500;
}

.supply-card {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  border: 2px solid #10b981;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 1.5rem 0;
  width: 100%;
}

@media (min-width: 480px) {
  .summary-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.summary-card {
  width: 100%;
  max-width: 100%;
  background: white;
  padding: 1.25rem;
  border-radius: 0.75rem;
  border-left: 4px solid #502479;
  box-sizing: border-box;
  overflow: hidden;
}

.summary-label {
  display: block;
  font-weight: 600;
  color: #502479;
  margin-bottom: 0.5rem;
  font-size: clamp(0.85rem, 3.5vw, 0.95rem);
}

.summary-value {
  font-size: clamp(1.1rem, 5vw, 1.2rem);
  font-weight: 700;
  color: #1f2937;
}

.explanation {
  width: 100%;
  max-width: 100%;
  background: #f8fafc;
  padding: 1.5rem;
  border-radius: 0.75rem;
  border-left: 4px solid #502479;
  font-size: clamp(0.9rem, 3.5vw, 0.95rem);
  line-height: 1.6;
  white-space: pre-line;
  margin: 1.5rem 0;
  box-sizing: border-box;
  overflow: hidden;
}

/* ==========================================================================
   Graafit - RESPONSIIVINEN LAYOUT
   ========================================================================== */
.chart-row {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

@media (min-width: 768px) {
  .chart-row {
    flex-direction: row;
  }
  
  .chart-card {
    flex: 1;
  }
}

.chart-card h3 {
  margin-bottom: 1rem;
  color: #502479;
  font-size: 1.1rem;
}

/* LISÄTTY: Chart-canvas responsiivisuus */
.chart-card canvas {
  max-height: none !important;
  height: auto !important;
  width: 100% !important;
  aspect-ratio: 16/9;
}

/* ==========================================================================
   Latausanimointi
   ========================================================================== */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #10b981;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 0.5rem;
}

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

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

/* ==========================================================================
   Pulan värit
   ========================================================================== */
.shortage-korkea {
  color: #dc2626 !important;
}

.shortage-keskitaso {
  color: #f59e0b !important;
}

.shortage-matala {
  color: #10b981 !important;
}

/* ==========================================================================
   Indikaattorit
   ========================================================================== */
.survey-indicator {
  margin: 0.75rem 0;
  padding: 0.5rem 1rem;
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  color: #065f46;
  text-align: center;
  font-weight: 600;
}

.scenario-indicator {
  margin: 0.75rem 0;
  padding: 0.5rem 1rem;
  background: #e0e7ff;
  border: 1px solid #6366f1;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  color: #3730a3;
  text-align: center;
  font-weight: 600;
}

/* ==========================================================================
   Skenaariosivun tyylit (skenaariot.html)
   ========================================================================== */
.scenario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.scenario-option {
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: .75rem;
  padding: 1.25rem;
  cursor: pointer;
  transition: all .2s;
  text-align: center;
}

.scenario-option:hover {
  border-color: #502479;
  transform: translateY(-2px);
}

.scenario-option.selected {
  border-color: #502479;
  background: #f8f7ff;
}

.scenario-icon {
  font-size: 2rem;
  margin-bottom: .5rem;
}

.scenario-title {
  font-weight: 600;
  margin-bottom: .5rem;
}

.scenario-desc {
  font-size: .9rem;
}

.scenario-details {
  font-size: 0.8rem;
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: #f8fafc;
  border-radius: 0.5rem;
  line-height: 1.4;
}

/* Skenaariot: otsikko omalla rivillään, sen alla moduulit järjestyksessä */
.module-section-block {
  display: block;
  width: 100%;
  background: #fafafa;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.module-section-block:last-child {
  margin-bottom: 0;
}
/* Otsikko aina omalla rivillään, koko leveys */
.modules-section-title {
  display: block;
  width: 100%;
  font-size: 1.05rem;
  font-weight: 700;
  color: #502479;
  margin: 0 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e5e7eb;
  grid-column: 1 / -1;
}
.modules-section-subtitle {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: #6b7280;
  margin-top: 0.25rem;
}
/* Otsikon alla moduulit yhdessä sarakkeessa järjestyksessä */
.module-section-block .modules-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-bottom: 0;
}
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.module-item {
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: .75rem;
  padding: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  cursor: pointer;
  transition: all .2s;
  position: relative;
}

.module-item:hover {
  border-color: #502479;
  transform: translateY(-2px);
}

.module-item.selected {
  border-color: #502479;
  background: #fdf2f8;
}

.module-item.expanded {
  padding-bottom: 1.25rem;
}

.module-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  margin-top: 0.25rem;
}

.module-content {
  flex: 1;
  min-width: 0;
}

.module-name {
  font-weight: 600;
  color: #1f2937;
  margin-bottom: .25rem;
}

.module-desc {
  font-size: .8rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
}

.module-details {
  font-size: 0.75rem;
  color: #6b7280;
  line-height: 1.4;
  display: none;
}

.module-item.expanded .module-details {
  display: block;
}

.module-weight {
  font-size: .75rem;
  color: #502479;
  font-weight: 600;
  background: #f3f4f6;
  padding: .25rem .5rem;
  border-radius: .5rem;
  align-self: flex-start;
}

.expand-toggle {
  color: #502479;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  transition: all 0.2s;
  align-self: flex-start;
}

.expand-toggle:hover {
  background: #f3f4f6;
}

.preview-content {
  text-align: center;
  padding: 1rem 0;
}

.preview-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: #502479;
}

.preview-impact {
  font-size: 1.5rem;
  font-weight: 700;
  color: #502479;
  margin-bottom: .5rem;
}

.preview-text {
  font-size: 1rem;
  color: #6b7280;
  margin-bottom: 1.5rem;
}

/* ==========================================================================
   Simuloinnin sivun tyylit (simulointi.html)
   ========================================================================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 600px;
  margin: 0 auto 2.5rem;
}

.form-group label {
  text-align: center;
  margin-bottom: 0.75rem;
}

.status-badge {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  margin: 0.5rem;
  text-align: center;
  margin-left: auto;
  margin-right: auto;
  display: block;
  width: fit-content;
}

.status-running {
  background: #fef3c7;
  color: #d97706;
  border: 1px solid #fde68a;
  animation: pulse 2s infinite;
}

.status-complete {
  color: #166534;
  border: 1px solid #502479;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.progress-container {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  padding: 1.5rem;
  border-radius: 1rem;
  box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
  display: none;
}

.progress-bar {
  height: 12px;
  background: linear-gradient(90deg, #10b981, #34d399);
  border-radius: 9999px;
  width: 0;
  transition: width 0.3s ease;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.progress-bg {
  height: 12px;
  background: #e5e7eb;
  border-radius: 9999px;
  overflow: hidden;
}

.progress-text {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
  color: #374151;
  margin-top: 1rem;
}

/* Simulointitulosten tyylit */
.summary-number {
  font-size: clamp(1.5rem, 5vw, 2rem);
  font-weight: 800;
  color: #1f2937;
  display: block;
}

.charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

@media (min-width: 768px) {
  .charts-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* KORJATTU: Chart-container korkeus responsiiviseksi */
.chart-container {
  background: white;
  padding: 1rem;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  height: auto !important;
  min-height: 300px;
  position: relative;
}

.table-container {
  background: white;
  padding: 1.5rem;
  border-radius: 0.75rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 600px;
}

th, td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

th {
  background: #f9fafb;
  font-weight: 600;
  color: #374151;
}

tr:hover {
  background: #f9fafb;
}

.kunta-badge {
  background: #e0f2fe;
  color: #0369a1;
  padding: 0.25rem 0.5rem;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.shortage-ei-pulaa {
  color: #16a34a;
}

/* CSV-latauspainike */
#downloadCsv {
  margin-top: 1rem;
  padding: 0.75rem 1.5rem;
  background: #502479;
  color: white;
  border: none;
  border-radius: 0.75rem;
  cursor: pointer;
  font-weight: 600;
  width: 100%;
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
  display: block;
}

#downloadCsv:hover {
  background: #3a1a57;
  transform: translateY(-2px);
}

/* ==========================================================================
   Kyselysivun tyylit (survey.html)
   ========================================================================== */
.survey-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-top: 2rem;
}

@media (min-width: 992px) {
  .survey-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.question-group {
  margin-bottom: 1.5rem;
}

.group-title {
  font-weight: 600;
  color: #1f2937;
  margin-bottom: .75rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid #e5e7eb;
}

.question-item {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: .75rem;
  padding: .75rem;
  margin-bottom: .5rem;
  cursor: pointer;
  transition: all .2s;
}

.question-item:hover {
  background: #e5e7eb;
}

.question-item.selected {
  background: #502479;
  color: #fff;
}

.question {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: .75rem;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .05);
}

.question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .75rem;
}

.question-title {
  font-weight: 600;
  color: #1f2937;
}

.remove-question {
  color: #dc2626;
  cursor: pointer;
  font-weight: bold;
}

.answer-options {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.answer-option {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.answer-option input[type=radio] {
  accent-color: #502479;
}

.buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
}

@media (min-width: 480px) {
  .buttons {
    flex-direction: row;
  }
  
  .buttons button {
    flex: 1;
    min-width: 200px;
    max-width: 300px;
  }
}

/* ==========================================================================
   Pop-up
   ========================================================================== */
#popupOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, .5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.popup {
  background: #fff;
  padding: 1.5rem;
  border-radius: 1rem;
  text-align: center;
  box-shadow: 0 10px 20px rgba(0, 0, 0, .2);
  max-width: 400px;
  width: 90%;
}

.popup h3 {
  margin-bottom: .5rem;
}

.popup.success h3 {
  color: #10b981;
}

.popup.reset h3 {
  color: #f59e0b;
}

.popup button {
  margin-top: 1rem;
  background: #502479;
  color: #fff;
  width: 100%;
}

.popup button:hover {
  background: #3a1a57;
}

/* ==========================================================================
   Salasanapainike
   ========================================================================== */
#submitPassword {
  width: 100%;
  padding: 0.875rem;
  background: #502479;
  color: white;
  border: none;
  border-radius: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

#submitPassword:hover {
  background: #3a1a57;
}

/* ==========================================================================
   Footer – sama tyyli kaikilla sivuilla (etusivu)
   ========================================================================== */
footer,
.site-footer {
  background: #502479;
  color: #d1d5db;
  text-align: center;
  padding: 1rem;
  width: 100%;
  position: sticky;
  bottom: 0;
  line-height: 1.4;
  z-index: 1000;
}

.footer-text,
footerin_fontti {
  font-size: 0.65rem;
  color: #ffffff;
  text-align: center;
}

/* ==========================================================================
   Pienet näytöt - TÄYDENNETTY RESPONSIIVISUUS
   ========================================================================== */
@media (max-width: 479px) {
  .container {
    padding: 0.75rem !important;
  }

  .hero-card,
  .form-card,
  #result,
  #charts,
  .scenario-card,
  .modules-card,
  .preview-card,
  .survey-builder,
  .portlet-bank {
    padding: 1.25rem !important;
    margin-bottom: 1rem !important;
  }

  .main-number {
    font-size: 2.25rem !important;
  }

  .components-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)) !important;
    gap: 0.75rem !important;
  }

  .chart-row,
  .scenario-grid,
  .modules-grid,
  .survey-grid {
    grid-template-columns: 1fr !important;
  }

  .chart-card h3 {
    font-size: 1rem;
  }

  .summary-grid {
    grid-template-columns: 1fr !important;
  }

  .summary-number {
    font-size: 1.75rem !important;
  }
  
  /* Chartit mobiilissa */
  .chart-container,
  .chart-card {
    min-height: 250px !important;
    padding: 1rem !important;
  }
  
  .chart-container canvas,
  .chart-card canvas {
    min-height: 180px !important;
    aspect-ratio: 1 !important;
  }
}

/* ==========================================================================
   VIOLETIT MURTEET - MOBIILIVERSION VÄRIT
   ========================================================================== */
.violet-dark { background-color: #482A77; color: white; }
.violet-medium { background-color: #9A337A; color: white; }
.violet-light { background-color: #FB805D; color: #333333; }
.violet-pale { background-color: #FFBB56; color: #333333; }
.violet-warm { background-color: #D74F6E; color: white; }
.violet-cool { background-color: #5AB57A; color: #333333; }

/* Kaavioiden legendit samoilla väreillä */
.chart-legend-item {
  display: inline-flex;
  align-items: center;
  margin-right: 10px;
  font-size: 12px;
}

.chart-legend-color {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  margin-right: 5px;
  display: inline-block;
}

/* ==========================================================================
   Tulostus
   ========================================================================== */
@media print {
  body {
    background: white !important;
  }

  .button-group,
  #pdfExport,
  .navbar,
  footer,
  .site-footer {
    display: none !important;
  }

  .hero-card,
  .form-card,
  #result,
  .scenario-card,
  .modules-card,
  .preview-card,
  .survey-builder,
  .portlet-bank,
  .results-card {
    break-inside: avoid;
    box-shadow: none !important;
    margin-bottom: 1rem !important;
  }
  
  /* Chartit tulostettaessa */
  .chart-container canvas,
  .chart-card canvas {
    max-height: 400px !important;
    width: 100% !important;
  }
}

/* ==========================================================================
   Debug ja lisätiedot
   ========================================================================== */
.debug-info {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: .75rem;
  padding: 1rem;
  margin-top: 1rem;
  font-size: .85rem;
  color: #6b7280;
}