/* ============================
   QualiUmfrage – Stylesheet
   ============================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: #f5f6f8;
  color: #1a1a2e;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 700px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

/* ── Header ── */
.survey-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.survey-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 0.5rem;
}

.survey-intro {
  color: #666;
  font-size: 0.95rem;
  margin-top: 0.5rem;
}

.token-badge {
  display: inline-block;
  background: #fff0f7;
  color: #d9006a;
  font-size: 0.8rem;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-family: monospace;
}

/* ── Token-Eingabe ── */
.token-form {
  background: #fff;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  max-width: 420px;
  margin: 4rem auto;
  text-align: center;
}

.token-form h2 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
}

.token-form p {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.token-form input[type="text"] {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  margin-bottom: 1rem;
  transition: border-color 0.2s;
}

.token-form input[type="text"]:focus {
  outline: none;
  border-color: #ff007b;
}

.btn-primary {
  background: #ff007b;
  color: #fff;
  border: none;
  padding: 0.75rem 2rem;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
  width: 100%;
}

.btn-primary:hover {
  background: #d9006a;
}

/* ── Fragenblock ── */
.question-block {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
  position: relative;
}

.question-number {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #ff007b;
  margin-bottom: 0.4rem;
}

.question-text {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.question-hint {
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 1rem;
}

/* ── Toggle-Switch ── */
.input-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.input-toggle span {
  color: #555;
  user-select: none;
}

.input-toggle span.active {
  color: #1a1a2e;
  font-weight: 600;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #0077cc;
  border-radius: 26px;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
  background: #ff007b;
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

/* ── Texteingabe ── */
.text-input-area textarea {
  width: 100%;
  min-height: 120px;
  padding: 0.75rem 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.2s;
  color: #1a1a2e;
}

.text-input-area textarea:focus {
  outline: none;
  border-color: #0077cc;
}

/* ── Spracheingabe ── */
.voice-input-area {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.record-controls {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.btn-record {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #ff007b;
  color: #fff;
  border: none;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn-record:hover {
  background: #d9006a;
}

.btn-record.recording {
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 0, 123, 0.5); }
  50%       { transform: scale(1.03); box-shadow: 0 0 0 8px rgba(255, 0, 123, 0); }
}

.btn-record .rec-dot {
  width: 10px;
  height: 10px;
  background: #fff;
  border-radius: 50%;
  display: inline-block;
}

.btn-record.recording .rec-dot {
  animation: blink 0.8s step-end infinite;
}

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

.record-hint {
  font-size: 0.78rem;
  color: #bbb;
  margin-top: 0.25rem;
}

.record-timer {
  font-size: 0.9rem;
  color: #ff007b;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  min-width: 3rem;
}


audio.playback {
  display: none;
}

.btn-play {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #2ecc71;
  color: #fff;
  border: none;
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  margin-top: 0.75rem;
  transition: background 0.2s;
}

.btn-play:hover {
  background: #27ae60;
}

.btn-play .play-icon {
  font-size: 0.85rem;
  line-height: 1;
}

.transcription-box {
  background: #f0f7ff;
  border: 1px solid #bee3f8;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  color: #2c5f8a;
  white-space: pre-wrap;
}

.transcribing-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #888;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #ddd;
  border-top-color: #ff007b;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Speicher-Status ── */
.save-status {
  text-align: right;
  font-size: 0.78rem;
  height: 1.2em;
  margin-top: 0.5rem;
  transition: color 0.3s;
}

.save-status.saving {
  color: #aaa;
}

.save-status.saved {
  color: #27ae60;
}

.save-status.error {
  color: #e74c3c;
}

/* ── Abschliessen-Button ── */
.submit-area {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e8e8e8;
}

.btn-submit {
  background: #2c3e50;
  color: #fff;
  border: none;
  padding: 0.85rem 2.5rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  letter-spacing: 0.02em;
}

.btn-submit:hover {
  background: #1a252f;
}

/* ── Bestätigungsbildschirm ── */
.thankyou-box {
  background: #fff;
  border-radius: 12px;
  padding: 3rem 2rem;
  text-align: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
  max-width: 480px;
  margin: 3rem auto;
}

.thankyou-icon {
  font-size: 3rem;
  color: #2ecc71;
  margin-bottom: 1rem;
  line-height: 1;
}

.thankyou-box h2 {
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
}

.thankyou-box p {
  color: #666;
  font-size: 1rem;
}

.thankyou-contact {
  margin-top: 1rem;
  font-size: 0.9rem;
}

.thankyou-contact a {
  color: #ff007b;
  text-decoration: none;
}

.thankyou-contact a:hover {
  text-decoration: underline;
}

/* ── Token-Fehler ── */
.token-error-box {
  border-top: 3px solid #e74c3c;
}

.token-error-msg {
  color: #c0392b;
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

.token-error-contact {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.token-error-contact a {
  color: #ff007b;
  text-decoration: none;
}

.token-error-contact a:hover {
  text-decoration: underline;
}

.btn-back {
  display: inline-block;
  text-decoration: none;
  text-align: center;
}

/* ── Fortschrittsleiste ── */
.progress-bar-wrap {
  background: #e0e0e0;
  border-radius: 4px;
  height: 4px;
  margin-bottom: 2rem;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: #ff007b;
  border-radius: 4px;
  transition: width 0.4s ease;
}

/* ── Fusszeile ── */
.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 700px;
  margin: 2rem auto 0;
  padding: 1.25rem 1rem 2rem;
  border-top: 1px solid #e8e8e8;
  gap: 1.5rem;
}

.footer-left {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.78rem;
  color: #999;
  line-height: 1.5;
}

.footer-left a {
  color: #ff007b;
  text-decoration: none;
}

.footer-left a:hover {
  text-decoration: underline;
}

.footer-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 6px;
  flex-shrink: 0;
}

/* ── Responsiv ── */
@media (max-width: 500px) {
  .survey-header h1 {
    font-size: 1.4rem;
  }
  .question-block {
    padding: 1.2rem;
  }
  .record-controls {
    flex-direction: column;
    align-items: flex-start;
  }
  .btn-record {
    width: 100%;
    justify-content: center;
  }
  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
}
