/* survey-style.css */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f5f7fa;
  color: #333;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px;
}

.container {
  max-width: 800px;   /* Maximale gewünschte Breite */
  min-width: 800px;   /* Minimale Breite festgelegt, damit es nicht schrumpft */
  width: 100%;        /* Füllt maximal den Platz aus */
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  padding: 30px 40px;
  box-sizing: border-box;
}

h1 {
  font-weight: 700;
  font-size: 2.2rem;
  text-align: center;
  color: #004c21;
  margin-bottom: 20px;
}

.progress-bar {
  width: 100%;
  height: 14px;
  background: #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 25px;
}

.info-text {
  font-size: 1.1rem;
  line-height: 1.5;
  padding: 20px;
  color: #222;
}

.progress-fill {
  height: 100%;
  background-color: #006837;
  transition: width 0.3s ease;
}

.page-info {
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 20px;
  color: #333;
}

.question {
  margin-bottom: 30px;
  padding: 20px;
  background: #f9fafb;
  border-radius: 8px;
  border-left: 4px solid #006837;
}

.question-text {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 15px;
  color: #333;
  line-height: 1.4;
}

.required {
  color: #d32f2f;
}

#chat-log p {
  max-width: 75%;
  padding: 10px 15px;
  margin-bottom: 2px;
  border-radius: 20px;
  word-wrap: break-word;
  font-size: 1rem;
  line-height: 1.4;
  clear: both;
}

/* User-Nachrichten rechtsbündig mit grünem Hintergrund */
#chat-log p.user {
  background-color: #d0f0c0;
  color: #004c21;
  float: right;
  text-align: right;
  margin-left: 25%;
  margin-bottom: 0px; /* verkürzter Abstand */
}

#chat-log p.assistant {
  background-color: #e0e0e0;
  color: #333;
  float: left;
  text-align: left;
  margin-right: 25%;
  margin-bottom: 0px; /* verkürzter Abstand */
}

/* Typing Bubble für Chat */
.typing-bubble {
  background-color: #e0e0e0;
  color: #333;
  float: left;
  text-align: left;
  margin-right: 25%;
  max-width: 75%;
  padding: 10px 15px;
  margin-bottom: 0px;
  border-radius: 20px;
  word-wrap: break-word;
  font-size: 1rem;
  line-height: 1.4;
  clear: both;
  display: flex;
  align-items: center;
  gap: 8px;
}

.typing-dots {
  display: flex;
  gap: 3px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #666;
  animation: typing-bounce 1.4s ease-in-out infinite;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-8px); opacity: 1; }
}

/* Likert Scale */
.likert-labels {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 5px;
}

.likert-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  width: 100%;
}

.likert-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.likert-option input[type="radio"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: #006837;
}

.likert-option label {
  font-size: 0.8rem;
  text-align: center;
  margin-top: 5px;
  color: #666;
}

/* Multiple Choice */
.mc-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mc-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: white;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid #e0e0e0;
}

.mc-option:hover {
  background: #f0fdf4;
  border-color: #006837;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.mc-option input[type="radio"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  cursor: pointer;
  accent-color: #006837;
}

.mc-option label {
  cursor: pointer;
  flex: 1;
  font-size: 1rem;
  line-height: 1.4;
}

/* Text Input */
.text-input {
  width: 100%;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.3s ease;
  box-sizing: border-box;
}

.text-input:focus {
  outline: none;
  border-color: #006837;
}

textarea.text-input {
  resize: vertical;
  min-height: 100px;
}

/* Select Dropdown */
.select-input {
  width: 100%;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: white;
  cursor: pointer;
  transition: border-color 0.3s ease;
}

.select-input:focus {
  outline: none;
  border-color: #006837;
}

/* Checkbox Group */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.checkbox-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px;
  cursor: pointer;
}

.checkbox-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  cursor: pointer;
  accent-color: #006837;
}

.checkbox-option label {
  cursor: pointer;
  flex: 1;
  font-size: 1rem;
  line-height: 1.4;
}

/* Rating Scale */
.rating-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin: 15px 0;
}

.rating-labels {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 10px;
}

.rating-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.rating-option input[type="radio"] {
  width: 24px;
  height: 24px;
  cursor: pointer;
  accent-color: #006837;
}

.rating-number {
  font-weight: 600;
  font-size: 1rem;
  color: #333;
}

/* Buttons */
.buttons-row {
  display: flex;
  justify-content: space-between;
  margin-top: 30px;
  gap: 15px;
}

.btn {
  background-color: #006837;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn:hover:enabled {
  background-color: #004c21;
}

.btn:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

.btn-secondary {
  background-color: #f0f0f0;
  color: #333;
}

.btn-secondary:hover:enabled {
  background-color: #e0e0e0;
}

/* Error Message */
.error-message {
  color: #d32f2f;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  margin: 15px 0;
  min-height: 20px;
}

/* ==============================================
   LIKERT MATRIX STYLES - FIXED FOR MIDDLE LABEL
   ============================================== */

/* Likert Matrix Container */
.likert-matrix {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e0e0e0;
  margin-top: 15px;
}

/* Matrix Header mit Zahlen */
.matrix-header {
  display: flex;
  background: #f8f9fa;
  border-bottom: 1px solid #e0e0e0;
}

.matrix-corner {
  flex: 0 0 200px;
  padding: 12px;
}

.matrix-labels {
  display: flex;
  flex: 1;
  justify-content: space-around;
  align-items: center;
  padding: 12px 0;
}

.matrix-header-item {
  flex: 1;
  text-align: center;
  font-weight: 600;
  color: #333;
  font-size: 1.1rem;
}

/* FIXED: Skala-Labels (links/mitte/rechts) ohne Überlappung */
.matrix-scale-labels {
  display: flex;
  background: #f8f9fa;
  border-bottom: 2px solid #006837;
  font-size: 0.85rem;
  color: #666;
}

.matrix-scale-text {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  flex: 1;
  align-items: center;
  padding: 8px 20px;
  min-height: 40px;
}

.scale-left {
  font-weight: 500;
  text-align: left;
  justify-self: start;
}

.scale-middle {
  font-weight: 500;
  text-align: center;
  justify-self: center;
  white-space: nowrap;
  background: #f8f9fa;
  padding: 0 8px;
}

.scale-right {
  font-weight: 500;
  text-align: right;
  justify-self: end;
}

/* Matrix Body - Fragen */
.matrix-body {
  background: white;
}

.matrix-row {
  display: flex;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s ease;
}

.matrix-row:hover {
  background: #f8fffe;
}

.matrix-row:last-child {
  border-bottom: none;
}

/* Fragentext links */
.matrix-question {
  flex: 0 0 200px;
  padding: 16px;
  background: #fafafa;
  border-right: 1px solid #e0e0e0;
  font-size: 0.95rem;
  line-height: 1.4;
  display: flex;
  align-items: center;
}

.matrix-question-content {
  display: inline;  /* Keep text and asterisk together */
}

.matrix-row:nth-child(even) .matrix-question {
  background: #f5f5f5;
}

/* Radio Button Optionen */
.matrix-options {
  display: flex;
  flex: 1;
  justify-content: space-around;
  align-items: center;
  padding: 16px 0;
}

.matrix-option {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.matrix-option input[type="radio"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: #006837;
  margin: 0;
}

.matrix-option input[type="radio"]:hover {
  transform: scale(1.1);
}

.matrix-option input[type="radio"]:focus {
  outline: 2px solid #006837;
  outline-offset: 2px;
}

/* Screen Reader Only Label */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==============================================
   RESPONSIVE DESIGN - MATRIX ALWAYS VISIBLE
   ============================================== */

/* Medium screens - adjust matrix layout */
@media (max-width: 768px) {
  .container {
    min-width: unset;
    max-width: 100%;
    padding: 20px;
  }
  
  .matrix-corner {
    flex: 0 0 150px;
  }
  
  .matrix-question {
    flex: 0 0 150px;
    padding: 12px;
    font-size: 0.85rem;
  }
  
  .matrix-header-item {
    font-size: 0.9rem;
  }
  
  .matrix-scale-text {
    padding: 6px 10px;
    font-size: 0.75rem;
    gap: 5px;
  }

  h1 {
    font-size: 1.8rem;
  }
}

/* Mobile screens - compact matrix design */
@media (max-width: 480px) {
  body {
    padding: 5px !important;
  }
  
  .container {
    min-width: unset !important;
    max-width: 100vw !important;
    width: calc(100vw - 10px) !important;
    padding: 8px !important;
    margin: 5px auto !important;
  }
  
  h1 {
    font-size: 1.5rem;
  }
  
  /* Ultra compact matrix for mobile */
  .matrix-corner {
    flex: 0 0 120px !important;
    padding: 8px !important;
    font-size: 0.7rem;
  }
  
  .matrix-question {
    flex: 0 0 120px !important;
    padding: 8px !important;
    font-size: 0.75rem !important;
    line-height: 1.3;
  }
  
  .matrix-header-item {
    font-size: 0.8rem !important;
  }
  
  .matrix-scale-text {
    font-size: 0.7rem !important;
    padding: 4px 8px !important;
    gap: 2px !important;
  }
  
  .matrix-options {
    padding: 12px 0 !important;
  }
  
  .matrix-option input[type="radio"] {
    width: 16px !important;
    height: 16px !important;
  }
  
  .buttons-row {
    flex-direction: column;
  }
  
  .btn {
    width: 100% !important;
    min-width: unset !important;
  }
  
  .likert-options {
    gap: 1px !important;
  }
  
  .likert-labels {
    font-size: 0.6rem !important;
    padding: 0 !important;
  }
  
  .question-text {
    font-size: 0.8rem !important;
  }
}

/* Remove the old responsive logic that hid the matrix */
.matrix-individual-questions {
  display: none !important;
}

/* Question Group Styles */
.question-group-container {
  display: flex;
  flex-direction: column;
  gap: 25px;
  margin-top: 10px;
}

.sub-question {
  background: white;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  transition: border-color 0.3s ease;
}

.sub-question:hover {
  border-color: #006837;
}

.sub-question-text {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: #333;
  line-height: 1.4;
}

/* Responsive adjustments for question groups */
@media (max-width: 480px) {
  .question-group-container {
    gap: 15px;
  }
  
  .sub-question {
    padding: 12px;
  }
  
  .sub-question-text {
    font-size: 0.9rem;
  }
}

/* Checkbox with text input styling */
.checkbox-with-text {
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 8px !important;
}

.checkbox-with-text > div:first-child {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
}

.checkbox-text-input {
  width: 100%;
  padding: 8px 12px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
  transition: all 0.3s ease;
  background-color: #f8f9fa;
  margin-top: 5px;
}

.checkbox-text-input:enabled {
  background-color: white;
  border-color: #006837;
}

.checkbox-text-input:focus {
  outline: none;
  border-color: #006837;
  box-shadow: 0 0 0 2px rgba(0, 104, 55, 0.1);
}

.checkbox-text-input:disabled {
  cursor: not-allowed;
  color: #999;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .checkbox-text-input {
    font-size: 0.85rem;
    padding: 6px 10px;
  }
}

/* Text input within checkbox group */
.checkbox-group .text-input {
  margin-top: 10px;
  width: 100%;
}