/* Reset & Typografie */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f3f5f8;
    color: #1f2937;
    line-height: 1.65;
    font-size: 16px;
}

a {
    color: #1d4ed8;
}

#survey-container {
    max-width: 820px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3.5rem;
}

.card {
    background: #ffffff;
    border: 1px solid #dfe4ec;
    border-radius: 10px;
    padding: 2rem 2.25rem;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.survey-page {
    display: none;
}

.survey-page.active {
    display: block;
}

.survey-start-footer {
    margin-top: 1rem;
    text-align: center;
}

#page-1:not(.active) ~ .survey-start-footer {
    display: none;
}

/* Vorschau-Banner */
#preview-banner {
    background: #1e293b;
    color: #f8fafc;
    padding: 0.65rem 1rem;
    font-size: 0.875rem;
    border-bottom: 3px solid #f59e0b;
}

.preview-banner-inner {
    max-width: 1020px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    align-items: center;
    justify-content: space-between;
}

.preview-badge {
    background: #f59e0b;
    color: #111827;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    font-size: 0.78rem;
    letter-spacing: 0.03em;
}

.preview-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.preview-controls select {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    border: 1px solid #64748b;
    background: #0f172a;
    color: #f8fafc;
    font-size: 0.85rem;
}

.btn-mini {
    padding: 0.28rem 0.65rem;
    border-radius: 4px;
    border: 1px solid #94a3b8;
    background: #334155;
    color: #ffffff;
    font-size: 0.82rem;
    cursor: pointer;
}

.btn-mini:hover {
    background: #475569;
}

/* Fortschrittsanzeige */
#progress-bar-wrap {
    margin-bottom: 1rem;
}

.progress-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    font-size: 0.88rem;
    color: #4b5563;
    margin-bottom: 0.35rem;
    font-weight: 500;
}

#progress-percent {
    white-space: nowrap;
    flex-shrink: 0;
}

.progress-track {
    height: 7px;
    background: #dce3ec;
    border-radius: 999px;
    overflow: hidden;
}

#progress-fill {
    height: 100%;
    background: #1d4ed8;
    transition: width 0.25s ease;
}

/* Überschriften & Fließtext */
.page-header-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

h1 {
    font-size: 1.48rem;
    line-height: 1.32;
    color: #111827;
    margin-bottom: 1rem;
}

.page-header-row h1 {
    flex: 1 1 420px;
    margin-bottom: 0;
}

h2 {
    font-size: 1.16rem;
    color: #111827;
    margin: 1.35rem 0 0.55rem;
}

h3 {
    font-size: 1.02rem;
    color: #1f2937;
    margin: 1.1rem 0 0.4rem;
}

.sub-hint {
    font-weight: 400;
    font-size: 0.9rem;
    color: #4b5563;
}

p {
    margin-bottom: 0.85rem;
}

ul, ol {
    padding-left: 1.35rem;
    margin-bottom: 0.95rem;
}

li {
    margin-bottom: 0.4rem;
}

.section-divider {
    border: 0;
    border-top: 1px solid #e5e7eb;
    margin: 1.6rem 0;
}

.muted-note {
    color: #4b5563;
    font-size: 0.93rem;
}

/* Kompakte Kurzübersicht & ausklappbare Detail-Sektionen auf Seite 1 */
.quick-facts {
    background: #f8fafc;
    border: 1px solid #dbe4f0;
    border-left: 4px solid #1d4ed8;
    border-radius: 8px;
    padding: 0.95rem 1.15rem;
    margin: 0.95rem 0 1.1rem;
}

.quick-facts-title {
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.45rem;
    font-size: 0.98rem;
}

.quick-facts ul {
    margin-bottom: 0;
    padding-left: 1.2rem;
}

.quick-facts li {
    margin-bottom: 0.35rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.quick-facts li:last-child {
    margin-bottom: 0;
}

.details-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    margin: 1rem 0 0.55rem;
}

.details-hint {
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
}

.info-accordion {
    border: 1px solid #d5dde8;
    border-radius: 8px;
    background: #ffffff;
    margin-bottom: 0.65rem;
    overflow: hidden;
}

.info-accordion summary {
    list-style: none;
    cursor: pointer;
    padding: 0.78rem 1rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: #1e3a8a;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    user-select: none;
    transition: background-color 0.15s ease;
}

.info-accordion summary::-webkit-details-marker {
    display: none;
}

.info-accordion summary::after {
    content: "Aufklappen \25BE";
    font-size: 0.82rem;
    font-weight: 600;
    color: #1d4ed8;
    white-space: nowrap;
    flex-shrink: 0;
}

.info-accordion[open] summary {
    border-bottom: 1px solid #e2e8f0;
    background: #eff6ff;
}

.info-accordion[open] summary::after {
    content: "Einklappen \25B4";
}

.info-accordion summary:hover {
    background: #eff6ff;
}

.accordion-body {
    padding: 0.95rem 1.15rem 1.05rem;
    font-size: 0.94rem;
    line-height: 1.6;
}

.accordion-body h3:first-child {
    margin-top: 0;
}

.accordion-body p:last-child {
    margin-bottom: 0;
}

.study-agreement-compact {
    margin-top: 1.15rem;
}

/* Kontaktblöcke */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.contact-block {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.9rem 1rem;
    font-size: 0.92rem;
}

/* Fallvignette & neutral eingerahmter Entschuldigungsbrief */
.case-box {
    background: #fafbfc;
    border: 1px solid #dfe4ec;
    border-radius: 8px;
    padding: 1.25rem 1.4rem;
    margin-bottom: 1.35rem;
}

.case-box h2 {
    margin-top: 0;
}

.case-box p:last-child {
    margin-bottom: 0;
}

.letter-section {
    margin: 1.35rem 0;
}

.letter-heading {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #111827;
}

.letter-box {
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 6px;
    padding: 1.35rem 1.5rem;
}

.letter-signoff {
    margin-bottom: 0;
}

/* Fragen, Radio-Listen & 7-stufige Skalen */
.question-block {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.15rem 1.25rem;
    margin-bottom: 1.15rem;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.question-block.has-error {
    border-color: #dc2626;
    background: #fef2f2;
}

.section-subtitle,
.question-title {
    display: block;
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.55rem;
}

.question-hint {
    font-size: 0.92rem;
    color: #4b5563;
    margin-bottom: 0.65rem;
}

.req-badge {
    display: inline-block;
    font-size: 0.76rem;
    font-weight: 600;
    color: #374151;
    background: #e5e7eb;
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    margin-left: 0.35rem;
    vertical-align: middle;
}

.radio-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.radio-option {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.55rem 0.75rem;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
}

.radio-option:hover {
    border-color: #93c5fd;
    background: #f8fafc;
}

.radio-option input[type="radio"] {
    margin-top: 0.28rem;
    width: 1.05rem;
    height: 1.05rem;
    flex-shrink: 0;
    accent-color: #1d4ed8;
}

/* Horizontale 7er-Skala */
.likert-scale {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.4rem;
    margin-top: 0.65rem;
}

.likert-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.65rem 0.35rem;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
}

.likert-cell:hover {
    border-color: #93c5fd;
    background: #f8fafc;
}

.likert-num {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.35rem;
    color: #111827;
}

.likert-cell input[type="radio"] {
    width: 1.15rem;
    height: 1.15rem;
    accent-color: #1d4ed8;
    cursor: pointer;
}

.likert-anchor {
    margin-top: 0.45rem;
    font-size: 0.78rem;
    line-height: 1.25;
    font-weight: 600;
    color: #374151;
    min-height: 2rem;
}

.likert-compact .likert-anchor {
    display: none;
}

.likert-mobile-anchors {
    display: none;
}

/* Alterseingabe */
.age-input-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.age-input-row input[type="number"] {
    width: 120px;
    padding: 0.55rem 0.7rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 1rem;
}

#deletion-code {
    display: block;
    box-sizing: border-box;
    width: min(100%, 44ch);
    margin: 0.4rem 0 1rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid #94a3b8;
    border-radius: 6px;
    font: 1rem monospace;
}

/* Einwilligungsbox */
.study-agreement-box {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    padding: 0.85rem 0.95rem;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
}

.study-agreement-box input[type="checkbox"] {
    margin-top: 0.25rem;
    width: 1.2rem;
    height: 1.2rem;
    flex-shrink: 0;
    accent-color: #1d4ed8;
}

/* Hinweise & Fehlermeldungen */
.field-error {
    color: #b91c1c;
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 0.6rem;
    margin-bottom: 0;
}

.notice-box {
    background: #f8fafc;
    border-left: 4px solid #1d4ed8;
    padding: 0.95rem 1.15rem;
    border-radius: 6px;
    margin: 1.1rem 0;
}

.notice-box p:last-child {
    margin-bottom: 0;
}

.alert-box {
    padding: 0.9rem 1.1rem;
    border-radius: 6px;
    margin: 1rem 0;
    font-weight: 500;
}

.alert-success {
    background: #ecfdf5;
    border: 1px solid #6ee7b7;
    color: #065f46;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #991b1b;
}

/* Buttons */
.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-top: 1.35rem;
}

.btn {
    display: inline-block;
    padding: 0.78rem 1.35rem;
    font-size: 0.98rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid transparent;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

.btn-primary {
    background: #1d4ed8;
    color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
    background: #1e40af;
}

.btn-secondary {
    background: #ffffff;
    color: #374151;
    border-color: #cbd5e1;
}

.btn-secondary:hover:not(:disabled) {
    background: #f1f5f9;
}

.btn-outline {
    background: #f8fafc;
    color: #1d4ed8;
    border-color: #93c5fd;
    font-size: 0.86rem;
    padding: 0.5rem 0.85rem;
}

.btn-outline:hover {
    background: #eff6ff;
}

.btn-danger {
    background: #dc2626;
    color: #ffffff;
}

.btn-danger:hover {
    background: #b91c1c;
}

/* Export-Dashboard Statistik-Karten */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.85rem;
    margin: 1.25rem 0;
}

.stat-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.9rem 1rem;
}

.stat-label {
    font-size: 0.82rem;
    color: #4b5563;
}

.stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: #111827;
    margin-top: 0.2rem;
}

#outcome-questions {
    overflow-anchor: none;
    transition: opacity 220ms ease, transform 220ms ease;
}

#outcome-questions.outcome-leaving {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

#outcome-questions.outcome-entering {
    animation: outcomeEnter 380ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

#outcome-questions.outcome-entering .question-block {
    animation: questionHighlight 1050ms ease-out;
}

#outcome-questions .question-title:focus {
    outline: none;
}

#outcome-questions .question-title:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 3px;
    border-radius: 4px;
}

@keyframes outcomeEnter {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes questionHighlight {
    0% {
        border-color: #2563eb;
        background: #eff6ff;
        box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
    }
    45% {
        border-color: #60a5fa;
        background: #f5f9ff;
        box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
    }
    100% {
        border-color: #e5e7eb;
        background: #f9fafb;
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    }
}

@media (prefers-reduced-motion: reduce) {
    #outcome-questions,
    #outcome-questions.outcome-leaving,
    #outcome-questions.outcome-entering,
    #outcome-questions.outcome-entering .question-block {
        transition: none;
        animation: none;
        transform: none;
    }
}

.closing-line {
    margin-top: 1.25rem;
    font-weight: 500;
}

.code-action-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem 0.75rem;
    margin: 0.6rem 0 0.85rem;
}

.code-action-row > strong {
    min-width: 0;
    max-width: 100%;
}

.code-action-row code,
.platform-code {
    display: inline-block;
    max-width: 100%;
    box-sizing: border-box;
    user-select: all;
    overflow-wrap: anywhere;
    padding: 0.22rem 0.5rem;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 5px;
    color: #1e1b4b;
    font-size: 0.95rem;
}

.btn-copy {
    box-sizing: border-box;
    min-height: 36px;
    padding: 0.35rem 0.75rem;
    border: 1px solid #64748b;
    border-radius: 6px;
    background: #ffffff;
    color: #1f2937;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-copy:hover {
    background: #f1f5f9;
}

.btn-copy:focus-visible,
.platform-link:focus-visible {
    outline: 3px solid #1d4ed8;
    outline-offset: 2px;
}

.btn-copy.copied {
    background: #ecfdf5;
    border-color: #047857;
    color: #065f46;
}

.completion-platforms {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0 0;
    display: grid;
    gap: 0.75rem;
}

.completion-platform-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #f9fafb;
}

.platform-name {
    min-width: 7.5rem;
}

.platform-code-group {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}

.platform-link {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    min-height: 38px;
    padding: 0.35rem 0.75rem;
    border: 1px solid #1d4ed8;
    border-radius: 6px;
    color: #1d4ed8;
    text-decoration: none;
    font-weight: 500;
    overflow-wrap: break-word;
}

.platform-link:hover {
    background: #eff6ff;
}

/* Mobile Darstellung */
@media (max-width: 680px) {
    .card {
        padding: 1.35rem 1.1rem;
        overflow-wrap: anywhere;
    }

    .contact-grid {
        grid-template-columns: 1fr;
    }

    .likert-anchor {
        display: none;
    }

    .likert-mobile-anchors {
        display: flex;
        justify-content: space-between;
        gap: 0.75rem;
        font-size: 0.82rem;
        color: #374151;
        margin-top: 0.45rem;
    }

    .likert-mobile-anchors > :last-child {
        text-align: right;
    }

    .btn-row .btn {
        width: 100%;
        text-align: center;
    }

    .btn-copy {
        min-height: 44px;
    }

    .completion-platform-item {
        flex-direction: column;
        align-items: stretch;
    }

    .platform-code-group {
        justify-content: space-between;
    }

    .platform-link {
        width: 100%;
        min-height: 44px;
        justify-content: center;
        text-align: center;
    }
}

@media (max-width: 375px) {
    #survey-container {
        padding-inline: 0.75rem;
    }

    .card {
        padding-inline: 0.8rem;
    }

    h1 {
        font-size: clamp(1.25rem, 6.4vw, 1.35rem);
        hyphens: auto;
    }

    .question-block {
        padding-inline: 0.7rem;
    }

    .likert-scale {
        grid-template-columns: repeat(7, minmax(0, 1fr));
        column-gap: 0.25rem;
    }

    .likert-cell {
        padding-inline: 0;
    }
}

/* Saubere Druck-/PDF-Ausgabe auf Seite 1 (@media print) */
@media print {
    body {
        background: #ffffff;
        color: #000000;
        font-size: 11pt;
    }

    .no-print,
    .btn-copy,
    #preview-banner,
    #progress-bar-wrap {
        display: none !important;
    }

    #survey-container {
        max-width: 100%;
        padding: 0;
        margin: 0;
    }

    .card {
        border: none;
        box-shadow: none;
        padding: 0;
    }

    .info-accordion summary::after {
        display: none !important;
    }
}

