:root {
    --primary-color: #3498db;
    --primary-color-dark: #2980b9;
    --secondary-color: #2ecc71;
    --background-color: #f4f7f9;
    --text-color: #333;
    --light-gray-color: #ecf0f1;
    --dark-gray-color: #7f8c8d;
    --error-color: #e74c3c;
    --border-radius: 8px;
    --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    --score-low: #a9dfbf;
    --score-medium: #f7dc6f;
    --score-high: #f1948a;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 800px;
    background-color: #fff;
    padding: 30px 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
}

header h1 {
    color: var(--primary-color);
    text-align: center;
    margin: 0;
}

header p {
    text-align: center;
    color: var(--dark-gray-color);
    margin-bottom: 30px;
}

/* Titelzeile mit Logo + H1 */
.title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 30px;
}
.title-row .logo {
    height: 50px;
    width: auto;
    display: block;
}

/* Preview-Toggle-Button als kleiner Textlink */
.preview-toggle {
    background: none;
    border: none;
    color: #ccc;
    font-size: 0.75em;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    margin: 0 0 15px auto;
    display: block;
    width: fit-content;
    transition: color 0.2s;
}
.preview-toggle:hover {
    color: var(--primary-color-dark);
    text-decoration: none;
}

/* Single-Choice Optionen Layout */
.single-choice-option {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0;
}

/* Abschnitts-Navigation */
.section-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 25px;
    justify-content: center;
}
.section-nav button {
    padding: 8px 12px;
    border: 2px solid var(--light-gray-color);
    background-color: transparent;
    color: var(--dark-gray-color);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9em;
}

.section-nav button#result-nav-btn {
    background-color: #ebebeb;
    color: #000;
}

.section-nav button:hover {
    background-color: var(--light-gray-color);
    border-color: var(--dark-gray-color);
}
.section-nav button.active {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    font-weight: 600;
}
#result-nav-btn.active {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

/* Fortschrittsanzeige */
.progress-container {
    margin-bottom: 30px;
}
.progress-bar {
    width: 100%;
    height: 10px;
    background-color: var(--light-gray-color);
    border-radius: 5px;
    overflow: hidden;
}
.progress-bar-inner {
    height: 100%;
    width: 0%;
    background-color: var(--secondary-color);
    transition: width 0.4s ease;
}
.progress-text {
    text-align: center;
    margin-top: 5px;
    font-size: 0.9em;
    color: var(--dark-gray-color);
}

/* Formular-Abschnitte */
.form-step {
    display: none;
}
.form-step.active {
    display: block;
    animation: fadeIn 0.5s ease-in-out;
}
.form-step h2 {
    font-weight: 600;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--light-gray-color);
    padding-bottom: 10px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Fragen-Styling */
.question {
    margin-bottom: 25px;
    padding: 20px;
    background-color: #e4e8ea;
    border: 1px solid var(--light-gray-color);
    border-radius: var(--border-radius);
    transition: background-color 0.3s;
}

.question-header {
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.3s; /* Sanfter Übergang für Hover-Effekt */
}

.question-header:hover {
    background-color: #d5eeff;
}

.question-header label {
    flex-grow: 1;
    font-size: 1.1em;
    cursor: pointer;
}

.custom-checkbox {
    min-width: 20px;
    height: 20px;
    border: 2px solid var(--dark-gray-color);
    border-radius: 4px;
    margin-right: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s;
}

.custom-checkbox svg {
    display: none;
    width: 14px;
    height: 14px;
    stroke: white;
    stroke-width: 3;
}

input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
}

input[type="checkbox"]:focus + .custom-checkbox {
    outline: 3px solid #005fcc;
    outline-offset: 2px;
}

input[type="checkbox"]:checked + .custom-checkbox {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

input[type="checkbox"]:checked + .custom-checkbox svg {
    display: block;
}

input[type="checkbox"]:checked ~ .question-details {
    display: block;
}

.question-details {
    display: none;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px dashed var(--light-gray-color);
    animation: slideDown 0.4s ease;
}

@keyframes slideDown {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 200px; }
}

.detail-group {
    margin-bottom: 20px;
}

.detail-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
}

/* Textarea Styling */
.textarea-label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 1.1em;
}
textarea {
    width: 100%;
    box-sizing: border-box;
    min-height: 100px;
    padding: 10px;
    border: 1px solid var(--light-gray-color);
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 1em;
    resize: vertical;
}
.char-counter {
    text-align: right;
    font-size: 0.8em;
    color: var(--dark-gray-color);
    margin-top: 5px;
}

/* Slider für Intensität */
.slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
}
input[type="range"] {
    appearance: none;
    -webkit-appearance: none;
    flex-grow: 1;
    height: 8px;
    background: #fff;
    border-radius: 5px;
    outline: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    cursor: pointer;
    border-radius: 50%;
}
input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    cursor: pointer;
    border-radius: 50%;
}
.slider-value {
    font-weight: bold;
    color: var(--primary-color);
    min-width: 25px;
    text-align: center;
}

/* Buttons für Häufigkeit */
.frequency-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.frequency-buttons button {
    padding: 8px 15px;
    border: 2px solid var(--light-gray-color);
    background-color: #fff;
    color: var(--text-color);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}
.frequency-buttons button.selected {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* Navigations-Buttons */
.navigation-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
}

.nav-btn {
    padding: 12px 25px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

#prevBtn {
    background-color: var(--dark-gray-color);
    color: #fff;
}
#prevBtn:hover {
    background-color: #95a5a6;
}

#nextBtn {
    background-color: var(--primary-color);
    color: #fff;
}
#nextBtn:hover {
    background-color: #5dade2;
}

.finish-btn {
     background-color: var(--secondary-color);
}
.finish-btn:hover {
     background-color: #58d68d;
}

/* Ergebnis-Ansicht */
#result-view {
    text-align: center;
    animation: fadeIn 0.5s;
}

#result-view h2 {
    color: var(--primary-color);
}

.score-display {
    font-size: 3em;
    font-weight: bold;
    color: var(--secondary-color);
    margin: 20px 0;
}

.score-interpretation {
    font-size: 1.1rem;
    margin-bottom: 30px;
    background-color: #edf8ff;
    padding: 1rem;
    text-align: left;
    border-left: 5px solid #78aaca;
}

/* Erklärungen unter Balkengrafiken */
.graph-expl-title {
    font-weight: 600;
    margin: 8px 0 4px;
    color: var(--text-color);
}
.graph-expl-text {
    font-size: 12px;
    line-height: 1.4;
    color: var(--dark-gray-color);
    margin: 0 0 12px 0;
}

/* Ergebnis-Grafik */
.score-graph-container {
    margin: 40px 0;
    background-color: #eee;
    padding-bottom: 10px;
}

.score-graph {
    position: relative;
    display: flex;
    height: 25px;
    border-radius: 5px;
    background: #eee;
}
.score-segment {
    height: 100%;
}
.score-segment.low { background-color: var(--score-low); }
.score-segment.medium { background-color: var(--score-medium); }
.score-segment.high { background-color: var(--score-high); }

/* Score-Pointer */
.score-pointer {
    position: absolute;
    bottom: 0;
    left: 0;
    transform: translateX(-50%);
    transition: left 0.5s ease-out;
    text-align: center;
}
.score-pointer span:first-child {
    position: relative;
    top: 4px;
    font-size: 2em;
    color: #fff;
}

.score-pointer .score-value {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 25px;
    font-weight: bold;
    color: var(--text-color);
    border-radius: 4px;
}

.score-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    padding: 0 10px;
    font-size: 0.9em;
    color: var(--dark-gray-color);
}
.score-labels span {
    flex: 1;
    text-align: center;
}

/* Result Summary */
#result-summary {
    text-align: left;
    margin-top: 30px;
    border-top: 1px solid var(--light-gray-color);
    padding-top: 20px;
}
#result-summary h3 {
    text-align: center;
    margin-bottom: 20px;
}

#result-summary ul {
    list-style-type: none;
    padding: 0;
}

#result-summary li {
    background: var(--light-gray-color);
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 10px;
}

.disclaimer {
    font-size: 0.9em;
    color: var(--dark-gray-color);
    margin-top: 40px;
    padding: 15px;
    background-color: var(--light-gray-color);
    border-left: 4px solid var(--error-color);
}

/* Responsives Design */
@media (max-width: 600px) {
    .container {
        padding: 20px;
    }
    .frequency-buttons {
        flex-direction: column;
    }
    .section-nav {
        gap: 5px;
    }
    .section-nav button {
        font-size: 0.8em;
        padding: 6px 10px;
    }
}

/* Druck-Stile */
@media print {
    body {
        padding: 0;
        background-color: #fff;
    }
    .container {
        box-shadow: none;
        padding: 0;
    }
    header, .progress-container, .navigation-buttons, .section-nav {
        display: none;
    }
    #form-container {
        display: none !important;
    }
    #result-view {
        display: block !important;
    }
    .disclaimer {
        display: none;
    }

    #printBtn {
        display: none !important;
    }

    /* Balkengrafik in Farbe drucken */
    .score-graph, .score-graph * {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .score-graph { background: #eeeeee !important; }
    .score-segment.low { background-color: #a9dfbf !important; }
    .score-segment.medium { background-color: #f7dc6f !important; }
    .score-segment.high { background-color: #f1948a !important; }
}
