/* Elias PrivacyCheck - Elegantes, ruhiges Navy-Design (Refined) */
:root {
  --bg-primary: #0a0f1e;
  --bg-card: #111827;
  /* Subtile Aufhellung für Formular-Elemente, ohne den Navy-Look zu stören */
  --bg-input: rgba(30, 41, 59, 0.8); 
  
  --accent-blue: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --border-subtle: rgba(148, 163, 184, 0.2);
  --shadow-card: 0 20px 40px rgba(0,0,0,0.3);
  --radius: 16px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #0a0f1e 0%, #1e1b4b 100%);
  min-height: 100vh;
  color: var(--text-primary);
}

/* Container */
.app-container {
  max-width: 900px;
  margin: 2rem auto;
  padding: 2rem;
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(20px);
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-card);
}

/* Header */
header h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  background: var(--accent-blue);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
  text-align: center;
}

header p {
  text-align: center;
  color: var(--text-secondary);
  font-size: 1.1rem;
}

.subtitle {
  margin-top: 0.25rem;
}

/* Steps Indicator */
.steps-indicator {
  display: flex;
  gap: 1rem;
  margin: 2rem 0;
  justify-content: center;
}

.step-indicator {
  flex: 1;
  min-width: 120px;
  padding: 1rem;
  background: rgba(59, 130, 246, 0.1);
  border: 2px solid rgba(59, 130, 246, 0.3);
  border-radius: 50px;
  text-align: center;
  font-weight: 500;
  transition: all 0.3s ease;
  color: var(--text-secondary);
}

.step-indicator.active {
  background: var(--accent-blue);
  border-color: #3b82f6;
  color: white;
  transform: scale(1.05);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3);
}

/* Steps */
.step {
  display: none;
  animation: slideIn 0.4s ease;
}

.step.active {
  display: block;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Form Elements */
.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-primary);
}

input[type="text"], select {
  width: 100%;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--bg-input) !important; 
  color: #f8fafc !important;
  font-size: 1rem;
  transition: all 0.3s ease;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

input[type="text"]:focus, select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15), inset 0 2px 4px rgba(0,0,0,0.1);
  background: #0f172a !important; /* Wird beim Tippen etwas dunkler */
}

/* Checkbox-Karten (Schritt 2) */
.checkbox-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  padding: 1.5rem;
  background: rgba(255,255,255,0.03);
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  margin: 1rem 0;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg-input); 
  border: 1px solid transparent;
}

.checkbox-group label:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  transform: translateY(-1px);
}

.checkbox-group label input[type="checkbox"] {
  accent-color: #3b82f6;
  width: 16px;
  height: 16px;
}

/* Question Cards (Schritt 3) */
.question-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid #3b82f6; /* Subtiler blauer Streifen */
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  transition: all 0.3s ease;
}

.question-card:hover {
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.question-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.question-meta {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.question-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.question-options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: normal;
  font-size: 0.95rem;
}

/* Header + Info-Button in Fragekarte */
.question-header-line {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
}

.info-btn {
  border: none;
  background: rgba(59, 130, 246, 0.1);
  color: #bfdbfe;
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.info-btn:hover {
  background: rgba(59, 130, 246, 0.25);
}

/* Info-Panel unter Fragen */
.question-info-panel {
  display: none;
  margin: 0.75rem 0 0.5rem;
  padding: 0.75rem 0.9rem;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.5);
  font-size: 0.85rem;
  color: #e5e7eb;
}

.question-info-panel.open {
  display: block;
}

.question-info-panel h4 {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  color: #38bdf8;
}

/* Buttons */
.nav-footer {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
}

.primary-btn, .secondary-btn {
  padding: 1rem 2rem;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 140px;
}

.primary-btn {
  background: var(--accent-blue);
  color: white;
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3);
}

.primary-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 35px rgba(59, 130, 246, 0.4);
}

.secondary-btn {
  background: transparent;
  color: var(--text-secondary);
  border: 2px solid var(--border-subtle);
}

.secondary-btn:hover:not(:disabled) {
  border-color: rgba(59, 130, 246, 0.5);
  color: #3b82f6;
}

.primary-btn:disabled,
.secondary-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Results */
.result-summary {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(34, 197, 94, 0.1));
  border: 2px solid rgba(16, 185, 129, 0.3);
  padding: 2rem;
  border-radius: var(--radius);
  text-align: center;
  margin-bottom: 2rem;
}

.score-badge {
  font-size: 3.5rem;
  font-weight: 800;
  margin: 1rem 0;
  background: var(--accent-blue);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.score-badge .unit {
  font-size: 1rem;
  margin-left: 0.25rem;
}

.result-details {
  display: grid;
  gap: 1.5rem;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1rem;
}

.tag {
  padding: 0.25rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid transparent;
}

.tag.critical { background: rgba(239, 68, 68, 0.15); border-color: #ef4444; color: #fecaca; }
.tag.warning { background: rgba(245, 158, 11, 0.15); border-color: #f59e0b; color: #fef9c3; }

/* SVG Chart Container & Legende */
.chart-container {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(148,163,184,0.2);
  border-radius: 16px;
  padding: 2rem;
  margin: 2rem 0;
  text-align: center;
  min-height: 300px;
}

.chart-container h3 {
  color: #3b82f6;
  margin-bottom: 1.5rem;
  font-size: 1.2rem;
}

#svgChartContainer {
  display: flex;
  justify-content: center;
}

.chart-legende {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  justify-content: center;
  margin-top: 1rem;
  font-size: 13px;
  color: #e5e7eb;
}

.legende-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legende-farbe {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: inline-block;
  flex-shrink: 0;
}

/* Detail-Auswertung */
.result-section h3 {
  font-size: 1.1rem;
  color: #3b82f6;
  margin: 1.5rem 0 0.75rem;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(59, 130, 246, 0.2);
}

.result-section ul {
  padding: 0;
  margin: 0;
}

.detail-item {
  list-style: none;
  margin-bottom: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  border-left: 4px solid transparent;
}

.detail-bad {
  background: rgba(239, 68, 68, 0.08);
  border-left-color: #ef4444;
}

.detail-partial {
  background: rgba(245, 158, 11, 0.08);
  border-left-color: #f59e0b;
}

.detail-good {
  background: rgba(16, 185, 129, 0.08);
  border-left-color: #10b981;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.detail-icon {
  font-size: 16px;
}

.detail-status {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-status.bad     { color: #ef4444; }
.detail-status.partial { color: #f59e0b; }
.detail-status.good    { color: #10b981; }

.detail-answer {
  font-size: 12px;
  color: #94a3b8;
  margin-left: auto;
}

.detail-frage {
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.5;
}

/* Mapping-Badge unter jeder Frage */
.detail-mapping {
  margin-top: 8px;
  font-size: 11px;
  color: #64748b;
  background: rgba(255, 255, 255, 0.05);
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  font-family: monospace;
}

/* KLICKBARE MAPPING-BUTTONS (REPORT) */
button.detail-mapping.clickable {
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease-in-out;
  padding-right: 12px; 
}

button.detail-mapping.clickable:hover {
  background: rgba(59, 130, 246, 0.15); 
  border-color: rgba(59, 130, 246, 0.5); 
  transform: translateY(-1px); 
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
  color: #e2e8f0; 
}

button.detail-mapping.clickable span {
  color: #60a5fa; 
  font-size: 11px;
  margin-left: 8px;
  font-weight: 500;
  opacity: 0.9;
  transition: color 0.2s ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

button.detail-mapping.clickable:hover span {
  color: #93c5fd; 
  opacity: 1;
}

/* Das geöffnete Info-Panel im Report */
.result-info-panel {
  display: none;
  margin-top: 12px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-left: 4px solid #3b82f6; 
  border-radius: 6px;
  padding: 16px;
  font-size: 13px;
  color: #e5e7eb;
}

.result-info-panel.open {
  display: block;
  animation: slideIn 0.3s ease;
}

.result-info-panel h4 {
  color: #38bdf8; 
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 14px;
}

/* =========================================
   SHOWSTOPPER / KRITISCHER ALARM
   ========================================= */
.critical-alert-box {
  background: rgba(239, 68, 68, 0.15);
  border: 2px solid #ef4444;
  padding: 20px;
  border-radius: 12px;
  margin: 20px 0;
  text-align: left;
  animation: pulseRed 2s infinite;
}

.critical-alert-box h4 {
  color: #f87171;
  margin: 0 0 10px 0;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.critical-alert-box p {
  color: #fca5a5;
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
}

@keyframes pulseRed {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* =========================================
   AKTIONSPLAN (TO-DO-LISTE)
   ========================================= */
.action-plan-container {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0 30px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.action-plan-container h3 {
  color: var(--text-primary);
  margin-bottom: 15px;
  font-size: 1.2rem;
}

.action-plan-empty {
  color: var(--success);
  font-weight: 600;
  text-align: center;
  padding: 15px;
}

/* Fortschrittsbalken */
.progress-bar-container {
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar-fill {
  height: 100%;
  background: var(--success);
  transition: width 0.4s ease-out;
}

.progress-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: right;
  margin-bottom: 20px;
}

/* Checkliste */
.action-task-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.action-task-item {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  background: rgba(255, 255, 255, 0.03);
  padding: 15px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.2s;
}

.action-task-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(59, 130, 246, 0.3);
}

.action-task-item.done {
  opacity: 0.6;
  background: rgba(16, 185, 129, 0.05);
  border-color: rgba(16, 185, 129, 0.2);
}

.action-task-item.done .action-task-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.action-checkbox {
  margin-top: 4px;
  width: 18px;
  height: 18px;
  accent-color: var(--success);
  cursor: pointer;
}

.action-task-content {
  flex: 1;
}

.action-task-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.action-task-cat {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.action-task-text {
  font-size: 0.95rem;
  color: #cbd5e1;
  line-height: 1.4;
  margin: 0;
  transition: color 0.2s;
}

/* Auto-Save Indicator */
.save-indicator {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: rgba(16, 185, 129, 0.9);
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 9999;
}

.save-indicator.show {
  opacity: 1;
  transform: translateY(0);
}

/* Footer */
.legal-footer {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
  .app-container { margin: 1rem; padding: 1.5rem; }
  .steps-indicator { flex-direction: column; }
  .nav-footer { flex-direction: column; }
}

/* =========================================
   PROFESSIONELLER PDF / PRINT REPORT
   ========================================= */
/* Im Browser verstecken wir den Print-Header */
.print-only-header {
  display: none;
}
/* =========================================
   SIDE-BY-SIDE CHARTS
   ========================================= */
.charts-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin: 2rem 0;
  justify-content: center;
}

.chart-box {
  flex: 1;
  min-width: 300px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(148,163,184,0.15);
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.chart-box h3 {
  color: #3b82f6;
  margin-top: 0;
  margin-bottom: 1.5rem;
  font-size: 1.1rem;
}

/* Anpassung für den Druck, damit sie im PDF nebeneinander bleiben */
@media print {
  .charts-wrapper { 
    flex-wrap: nowrap !important; 
    gap: 10px !important; 
  }
  .chart-box { 
    border: none !important; 
    background: transparent !important; 
    padding: 0 !important; 
  }
  .chart-box h3 { color: #0f172a !important; }
}

@media print {
  @page {
    size: A4;
    margin: 20mm 15mm;
  }

  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body {
    background: white;
    color: #1e293b;
    font-size: 11pt;
    line-height: 1.5;
  }

  /* Verstecke alles Unnötige */
  .nav-footer, .steps-indicator, .save-indicator, .info-btn, 
  .progress-bar-container, .progress-text, #step1, #step2, #step3 {
    display: none !important;
  }

  /* Nur Schritt 4 im Druck anzeigen */
  #step4 {
    display: block !important;
  }

  .app-container {
    box-shadow: none;
    border: none;
    margin: 0;
    padding: 0;
    max-width: 100%;
    background: transparent;
  }

  /* === NEUER BRIEFKOPF === */
  .print-only-header {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #0f172a;
    padding-bottom: 15px;
    margin-bottom: 30px;
  }
  
  .print-logo-placeholder {
    font-size: 16pt;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: 1px;
  }

  .print-meta {
    text-align: right;
    font-size: 9pt;
    color: #475569;
  }

  /* Web-Header ausblenden, da wir jetzt den Print-Header haben */
  header {
    display: none !important;
  }

  /* === ZUSAMMENFASSUNG & SCORES === */
  .result-summary {
    background: white !important;
    border: 1px solid #cbd5e1 !important;
    padding: 20px;
    border-radius: 8px;
    page-break-inside: avoid;
    page-break-after: avoid;
  }

  .score-badge {
    color: #0f172a !important;
    -webkit-text-fill-color: #0f172a;
    font-size: 28pt;
    margin: 10px 0;
  }

  /* Showstopper Box im Druck */
  .critical-alert-box {
    background: #fee2e2 !important;
    border: 2px solid #ef4444 !important;
    color: #991b1b !important;
    animation: none !important;
    page-break-inside: avoid;
  }
  .critical-alert-box h4 { color: #b91c1c !important; }
  .critical-alert-box p { color: #7f1d1d !important; }

  /* Labels / Tags */
  .tag {
    border: 1px solid #94a3b8 !important;
    background: #f1f5f9 !important;
    color: #0f172a !important; 
    font-size: 9pt;
    padding: 2px 8px;
    font-weight: bold;
  }

  .tag.critical { background: #fee2e2 !important; border-color: #ef4444 !important; color: #991b1b !important; }
  .tag.warning { background: #fef3c7 !important; border-color: #f59e0b !important; color: #92400e !important; }

  /* === CHART === */
  .chart-container {
    border: none;
    background: white;
    padding: 0;
    margin: 30px 0;
    page-break-inside: avoid;
  }

  .chart-container h3 {
    color: #0f172a;
    text-align: center;
    border: none;
  }

  #svgChartContainer svg text { fill: #0f172a !important; }

  /* === DETAIL-AUSWERTUNG === */
  .result-section {
    page-break-inside: avoid;
    margin-bottom: 20px;
  }

  .result-section h3 {
    color: #0f172a;
    border-bottom: 1px solid #cbd5e1;
    font-size: 14pt;
    padding-bottom: 5px;
    page-break-after: avoid;
  }

  .detail-item {
    border: 1px solid #e2e8f0;
    background: white;
    margin-bottom: 8px;
    padding: 10px 15px;
    border-left-width: 6px;
    page-break-inside: avoid;
  }

  .detail-frage { color: #334155; }
  .detail-answer { color: #64748b; }

  .detail-bad    { border-left-color: #ef4444 !important; background-color: rgba(239, 68, 68, 0.08) !important; }
  .detail-partial{ border-left-color: #f59e0b !important; background-color: rgba(245, 158, 11, 0.08) !important; }
  .detail-good   { border-left-color: #10b981 !important; background-color: rgba(16, 185, 129, 0.08) !important; }

  button.detail-mapping {
    display: inline-block !important;
    color: #475569 !important;
    border: 1px solid #cbd5e1 !important;
    background: #f8fafc !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
  }

  button.detail-mapping.clickable span { display: none !important; }

  /* Geöffnete Info-Panels beim Drucken anzeigen */
  .result-info-panel.open, .question-info-panel.open {
    display: block !important;
    background: #f8f9fa !important;
    border: 1px solid #cbd5e1 !important;
    border-left: 4px solid #94a3b8 !important;
    color: #334155 !important;
    page-break-inside: avoid;
    margin-top: 10px !important;
  }

  .result-info-panel:not(.open), .question-info-panel:not(.open) { display: none !important; }
  .result-info-panel h4, .question-info-panel h4 { color: #0f172a !important; }

  /* === AKTIONSPLAN === */
  .action-plan-container {
    background: white !important;
    border: none !important;
    border-top: 2px solid #0f172a !important;
    padding: 20px 0;
    box-shadow: none;
    page-break-before: always; /* Zwingt den Aktionsplan auf eine neue Seite! */
  }

  .action-plan-container h3 {
    color: #0f172a;
    padding-bottom: 10px;
    font-size: 16pt;
    margin-top: 0;
  }

  .action-task-item {
    background: white !important;
    border: 1px solid #e2e8f0 !important;
    margin-bottom: 10px;
    color: #334155;
    page-break-inside: avoid;
  }
  
  .action-task-text { color: #334155; font-weight: 500; }

  .legal-footer {
    display: block !important;
    margin-top: 40px;
    padding-top: 15px;
    border-top: 1px solid #cbd5e1;
    color: #64748b;
    font-size: 8pt;
    text-align: center;
    page-break-inside: avoid;
  }
}
