/* ==========================================================================
   style.css
   ==========================================================================
   Zentrale Styles für den öffentlichen Benutzerbereich.

   Bereiche:
   - Reset / Basis
   - Layout
   - Navigation
   - Karten
   - Formulare
   - Buttons
   - Dashboard
   - Testoberfläche
   - Antworten
   - Fortschritt
   - Ergebnisse
   - Meldungen
   - Tabellen
   - Responsive Design
   ========================================================================== */


/* ==========================================================================
   1. RESET
   ========================================================================== */

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

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;

    background: #f4f6f8;
    color: #1f2937;

    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;

    font-size: 16px;
    line-height: 1.5;
}

img {
    display: block;
    max-width: 100%;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: #2563eb;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}


/* ==========================================================================
   2. TYPOGRAFIE
   ========================================================================== */

h1,
h2,
h3,
h4 {
    margin-top: 0;
    color: #111827;
    line-height: 1.25;
}

h1 {
    margin-bottom: 0.75rem;
    font-size: clamp(1.75rem, 4vw, 2.4rem);
}

h2 {
    margin-bottom: 0.75rem;
    font-size: 1.5rem;
}

h3 {
    margin-bottom: 0.5rem;
    font-size: 1.15rem;
}

p {
    margin-top: 0;
}

.text-muted {
    color: #6b7280;
}

.text-success {
    color: #15803d;
}

.text-danger {
    color: #b91c1c;
}

.text-center {
    text-align: center;
}


/* ==========================================================================
   3. SEITENLAYOUT
   ========================================================================== */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;

    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

.site-header-inner {
    width: min(1180px, calc(100% - 32px));
    min-height: 64px;
    margin: 0 auto;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.site-brand {
    color: #111827;
    font-size: 1.15rem;
    font-weight: 700;
    text-decoration: none;
}

.site-brand:hover {
    text-decoration: none;
}

.site-navigation {
    display: flex;
    align-items: center;
    gap: 20px;
}

.site-navigation a {
    color: #4b5563;
    font-weight: 500;
}

.site-navigation a:hover {
    color: #111827;
    text-decoration: none;
}

.site-main {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 40px 0 64px;
}

.site-footer {
    padding: 24px 16px;

    background: #111827;
    color: #d1d5db;

    text-align: center;
    font-size: 0.9rem;
}

.site-footer a {
    color: #ffffff;
}


/* ==========================================================================
   4. CONTAINER
   ========================================================================== */

.container {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

.container-small {
    width: min(640px, calc(100% - 32px));
    margin: 0 auto;
}


/* ==========================================================================
   5. CARDS
   ========================================================================== */

.card {
    padding: 24px;

    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;

    box-shadow:
        0 2px 8px rgba(15, 23, 42, 0.04);
}

.card + .card {
    margin-top: 20px;
}

.card-header {
    margin-bottom: 20px;
}

.card-title {
    margin-bottom: 6px;
}

.card-description {
    margin-bottom: 0;
    color: #6b7280;
}


/* ==========================================================================
   6. GRID
   ========================================================================== */

.grid {
    display: grid;
    gap: 20px;
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}


/* ==========================================================================
   7. FORMULARE
   ========================================================================== */

.form-group {
    margin-bottom: 18px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    margin-bottom: 7px;

    color: #374151;
    font-size: 0.95rem;
    font-weight: 600;
}

.form-help {
    margin-top: 6px;
    color: #6b7280;
    font-size: 0.875rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
select,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;

    color: #111827;
    background: #ffffff;

    border: 1px solid #d1d5db;
    border-radius: 8px;

    outline: none;

    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #2563eb;

    box-shadow:
        0 0 0 3px rgba(37, 99, 235, 0.12);
}

input:disabled,
select:disabled,
textarea:disabled {
    cursor: not-allowed;
    background: #f3f4f6;
}


/* ==========================================================================
   8. BUTTONS
   ========================================================================== */

.button {
    min-height: 44px;
    padding: 10px 18px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border: 1px solid transparent;
    border-radius: 8px;

    font-weight: 600;
    line-height: 1;

    text-decoration: none;

    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.05s ease;
}

.button:hover {
    text-decoration: none;
}

.button:active {
    transform: translateY(1px);
}

.button:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.25);
    outline-offset: 2px;
}

.button-primary {
    color: #ffffff;
    background: #2563eb;
    border-color: #2563eb;
}

.button-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.button-secondary {
    color: #374151;
    background: #ffffff;
    border-color: #d1d5db;
}

.button-secondary:hover {
    background: #f9fafb;
}

.button-success {
    color: #ffffff;
    background: #16a34a;
    border-color: #16a34a;
}

.button-success:hover {
    background: #15803d;
    border-color: #15803d;
}

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

.button-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

.button-large {
    min-height: 50px;
    padding: 13px 24px;
    font-size: 1rem;
}

.button-block {
    width: 100%;
}

.button:disabled,
.button.disabled {
    cursor: not-allowed;
    opacity: 0.55;
}


/* ==========================================================================
   9. BUTTON-GRUPPEN
   ========================================================================== */

.button-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;

    margin-top: 24px;
}


/* ==========================================================================
   10. AUTH / LOGIN
   ========================================================================== */

.auth-page {
    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 24px;

    background:
        linear-gradient(
            135deg,
            #eff6ff 0%,
            #f8fafc 50%,
            #eef2ff 100%
        );
}

.auth-container {
    width: min(440px, 100%);
}

.auth-card {
    padding: 32px;

    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;

    box-shadow:
        0 12px 35px rgba(15, 23, 42, 0.08);
}

.auth-header {
    margin-bottom: 28px;
    text-align: center;
}

.auth-header h1 {
    margin-bottom: 8px;
}

.auth-header p {
    margin-bottom: 0;
    color: #6b7280;
}

.auth-footer {
    margin-top: 20px;

    color: #6b7280;
    font-size: 0.9rem;
    text-align: center;
}


/* ==========================================================================
   11. DASHBOARD
   ========================================================================== */

.dashboard-header {
    margin-bottom: 28px;
}

.dashboard-header p {
    margin-bottom: 0;
    color: #6b7280;
}

.dashboard-grid {
    display: grid;
    grid-template-columns:
        repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.dashboard-card {
    display: flex;
    flex-direction: column;
}

.dashboard-card-content {
    flex: 1;
}

.dashboard-card-actions {
    margin-top: 20px;
}

.dashboard-stat {
    padding: 20px;

    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.dashboard-stat-value {
    margin-bottom: 4px;

    color: #111827;
    font-size: 1.8rem;
    font-weight: 700;
}

.dashboard-stat-label {
    color: #6b7280;
    font-size: 0.9rem;
}


/* ==========================================================================
   12. STATUS-BADGES
   ========================================================================== */

.status-badge {
    display: inline-flex;
    align-items: center;

    min-height: 28px;
    padding: 4px 9px;

    border-radius: 999px;

    font-size: 0.8rem;
    font-weight: 600;
}

.status-success {
    color: #166534;
    background: #dcfce7;
}

.status-warning {
    color: #92400e;
    background: #fef3c7;
}

.status-danger {
    color: #991b1b;
    background: #fee2e2;
}

.status-neutral {
    color: #374151;
    background: #f3f4f6;
}

.status-info {
    color: #1e40af;
    background: #dbeafe;
}


/* ==========================================================================
   13. MELDUNGEN
   ========================================================================== */

.alert {
    margin-bottom: 20px;
    padding: 14px 16px;

    border: 1px solid transparent;
    border-radius: 8px;
}

.alert:last-child {
    margin-bottom: 0;
}

.alert-success {
    color: #166534;
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.alert-error {
    color: #991b1b;
    background: #fef2f2;
    border-color: #fecaca;
}

.alert-warning {
    color: #92400e;
    background: #fffbeb;
    border-color: #fde68a;
}

.alert-info {
    color: #1e40af;
    background: #eff6ff;
    border-color: #bfdbfe;
}


/* ==========================================================================
   14. TESTOBERFLÄCHE
   ========================================================================== */

.test-page {
    background: #f3f4f6;
}

.test-container {
    width: min(900px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 60px;
}

.test-header {
    margin-bottom: 20px;

    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.test-title {
    margin-bottom: 4px;
}

.test-meta {
    margin: 0;
    color: #6b7280;
}

.test-question-card {
    padding: 28px;

    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;

    box-shadow:
        0 3px 12px rgba(15, 23, 42, 0.05);
}

.test-question-number {
    margin-bottom: 12px;

    color: #6b7280;
    font-size: 0.9rem;
    font-weight: 600;
}

.test-question-text {
    margin-bottom: 24px;

    color: #111827;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.45;
}


/* ==========================================================================
   15. ANTWORTOPTIONEN
   ========================================================================== */

.answer-list {
    display: grid;
    gap: 12px;
}

.answer-option {
    position: relative;
}

.answer-option input {
    position: absolute;

    width: 1px;
    height: 1px;

    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);

    white-space: nowrap;
}

.answer-label {
    min-height: 58px;
    padding: 14px 16px;

    display: flex;
    align-items: center;
    gap: 12px;

    color: #374151;
    background: #ffffff;

    border: 2px solid #e5e7eb;
    border-radius: 10px;

    cursor: pointer;

    transition:
        border-color 0.15s ease,
        background 0.15s ease,
        box-shadow 0.15s ease;
}

.answer-label:hover {
    background: #f9fafb;
    border-color: #cbd5e1;
}

.answer-option input:checked + .answer-label {
    color: #1e3a8a;
    background: #eff6ff;
    border-color: #2563eb;

    box-shadow:
        0 0 0 2px rgba(37, 99, 235, 0.08);
}

.answer-option input:focus-visible + .answer-label {
    outline: 3px solid rgba(37, 99, 235, 0.25);
    outline-offset: 2px;
}

.answer-letter {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    color: #4b5563;
    background: #f3f4f6;

    border-radius: 50%;

    font-weight: 700;
}

.answer-option input:checked + .answer-label .answer-letter {
    color: #ffffff;
    background: #2563eb;
}

.answer-text {
    flex: 1;
}


/* ==========================================================================
   16. TEST-NAVIGATION
   ========================================================================== */

.test-navigation {
    margin-top: 20px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.test-navigation-left,
.test-navigation-right {
    display: flex;
    align-items: center;
    gap: 10px;
}


/* ==========================================================================
   17. FORTSCHRITT
   ========================================================================== */

.progress-container {
    margin-bottom: 20px;
}

.progress-header {
    margin-bottom: 8px;

    display: flex;
    justify-content: space-between;
    gap: 12px;

    color: #4b5563;
    font-size: 0.9rem;
    font-weight: 600;
}

.progress-bar {
    width: 100%;
    height: 9px;
    overflow: hidden;

    background: #e5e7eb;

    border-radius: 999px;
}

.progress-value {
    height: 100%;

    background: #2563eb;

    border-radius: inherit;

    transition: width 0.2s ease;
}


/* ==========================================================================
   18. AUTOSAVE-STATUS
   ========================================================================== */

.autosave-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    color: #6b7280;
    font-size: 0.85rem;
}

.autosave-status::before {
    content: "";

    width: 8px;
    height: 8px;

    background: #9ca3af;
    border-radius: 50%;
}

.autosave-status.saved {
    color: #166534;
}

.autosave-status.saved::before {
    background: #22c55e;
}

.autosave-status.saving {
    color: #92400e;
}

.autosave-status.saving::before {
    background: #f59e0b;
}

.autosave-status.error {
    color: #991b1b;
}

.autosave-status.error::before {
    background: #ef4444;
}


/* ==========================================================================
   19. FRAGENÜBERSICHT
   ========================================================================== */

.question-overview {
    margin-top: 24px;
    padding: 20px;

    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.question-overview-grid {
    display: grid;
    grid-template-columns:
        repeat(auto-fill, minmax(42px, 1fr));
    gap: 8px;
}

.question-overview-item {
    width: 42px;
    height: 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    color: #4b5563;
    background: #f3f4f6;

    border: 1px solid #d1d5db;
    border-radius: 8px;

    font-weight: 600;
}

.question-overview-item.answered {
    color: #166534;
    background: #dcfce7;
    border-color: #86efac;
}

.question-overview-item.current {
    color: #ffffff;
    background: #2563eb;
    border-color: #2563eb;
}


/* ==========================================================================
   20. ABSCHLUSS
   ========================================================================== */

.complete-warning {
    margin-top: 20px;
    padding: 16px;

    color: #92400e;
    background: #fffbeb;

    border: 1px solid #fde68a;
    border-radius: 8px;
}

.complete-warning strong {
    display: block;
    margin-bottom: 4px;
}


/* ==========================================================================
   21. ERGEBNIS
   ========================================================================== */

.result-header {
    margin-bottom: 28px;
    text-align: center;
}

.result-score-card {
    padding: 32px;

    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;

    text-align: center;

    box-shadow:
        0 4px 16px rgba(15, 23, 42, 0.05);
}

.result-score {
    margin-bottom: 6px;

    color: #2563eb;
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    font-weight: 800;
    line-height: 1;
}

.result-score-label {
    margin-bottom: 0;
    color: #6b7280;
}

.result-stats {
    margin-top: 20px;

    display: grid;
    grid-template-columns:
        repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.result-stat {
    padding: 16px;

    background: #f9fafb;
    border-radius: 8px;
}

.result-stat-value {
    margin-bottom: 3px;

    color: #111827;
    font-size: 1.4rem;
    font-weight: 700;
}

.result-stat-label {
    color: #6b7280;
    font-size: 0.85rem;
}


/* ==========================================================================
   22. ERGEBNISDETAILS
   ========================================================================== */

.result-question {
    padding: 20px;

    background: #ffffff;

    border: 1px solid #e5e7eb;
    border-radius: 10px;
}

.result-question + .result-question {
    margin-top: 12px;
}

.result-question.correct {
    border-left: 4px solid #22c55e;
}

.result-question.incorrect {
    border-left: 4px solid #ef4444;
}

.result-question.unanswered {
    border-left: 4px solid #f59e0b;
}

.result-question-header {
    margin-bottom: 12px;

    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.result-question-number {
    color: #6b7280;
    font-size: 0.85rem;
    font-weight: 600;
}

.result-question-text {
    margin-bottom: 16px;
    font-weight: 600;
}

.result-answer {
    padding: 10px 12px;

    background: #f9fafb;
    border-radius: 7px;
}

.result-answer + .result-answer {
    margin-top: 8px;
}

.result-answer-label {
    display: block;
    margin-bottom: 2px;

    color: #6b7280;
    font-size: 0.8rem;
    font-weight: 600;
}


/* ==========================================================================
   23. TABELLEN
   ========================================================================== */

.table-wrapper {
    width: 100%;
    overflow-x: auto;

    background: #ffffff;

    border: 1px solid #e5e7eb;
    border-radius: 10px;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 13px 15px;

    border-bottom: 1px solid #e5e7eb;

    text-align: left;
    vertical-align: middle;
}

.table th {
    color: #374151;
    background: #f9fafb;

    font-size: 0.85rem;
    font-weight: 700;
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.table tbody tr:hover {
    background: #fafafa;
}


/* ==========================================================================
   24. LEERZUSTAND
   ========================================================================== */

.empty-state {
    padding: 48px 24px;

    color: #6b7280;

    text-align: center;
}

.empty-state-title {
    margin-bottom: 8px;

    color: #374151;
    font-size: 1.1rem;
    font-weight: 600;
}


/* ==========================================================================
   25. LOADING
   ========================================================================== */

.loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.loading-spinner {
    width: 18px;
    height: 18px;

    border: 2px solid #dbeafe;
    border-top-color: #2563eb;

    border-radius: 50%;

    animation: spin 0.8s linear infinite;
}

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


/* ==========================================================================
   26. MODAL
   ========================================================================== */

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;

    padding: 20px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: rgba(15, 23, 42, 0.55);
}

.modal {
    width: min(520px, 100%);
    max-height: calc(100vh - 40px);
    overflow-y: auto;

    padding: 24px;

    background: #ffffff;
    border-radius: 12px;

    box-shadow:
        0 20px 50px rgba(15, 23, 42, 0.2);
}

.modal-header {
    margin-bottom: 16px;

    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.modal-close {
    padding: 4px;

    color: #6b7280;
    background: transparent;

    border: 0;

    font-size: 1.5rem;
}


/* ==========================================================================
   27. UTILITY-KLASSEN
   ========================================================================== */

.mt-0 {
    margin-top: 0 !important;
}

.mt-1 {
    margin-top: 8px !important;
}

.mt-2 {
    margin-top: 16px !important;
}

.mt-3 {
    margin-top: 24px !important;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.mb-1 {
    margin-bottom: 8px !important;
}

.mb-2 {
    margin-bottom: 16px !important;
}

.mb-3 {
    margin-bottom: 24px !important;
}

.hidden {
    display: none !important;
}

.w-full {
    width: 100%;
}


/* ==========================================================================
   28. RESPONSIVE
   ========================================================================== */

@media (max-width: 900px) {

    .dashboard-grid,
    .grid-3,
    .grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}


@media (max-width: 700px) {

    .site-header-inner {
        min-height: 58px;
    }

    .site-navigation {
        gap: 12px;
    }

    .site-main {
        padding-top: 28px;
    }

    .grid-2,
    .grid-3,
    .grid-4,
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .test-header {
        flex-direction: column;
    }

    .test-question-card {
        padding: 20px;
    }

    .test-question-text {
        font-size: 1.1rem;
    }

    .test-navigation {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .test-navigation-left,
    .test-navigation-right {
        width: 100%;
    }

    .test-navigation .button {
        flex: 1;
    }

    .result-stats {
        grid-template-columns: 1fr;
    }

}


@media (max-width: 520px) {

    body {
        font-size: 15px;
    }

    .site-header-inner {
        width: min(100% - 20px, 1180px);
    }

    .site-navigation {
        gap: 8px;
    }

    .site-navigation a {
        font-size: 0.9rem;
    }

    .site-main {
        width: min(100% - 20px, 1180px);
        padding-top: 20px;
    }

    .container,
    .container-small {
        width: calc(100% - 20px);
    }

    .card,
    .auth-card {
        padding: 20px;
    }

    .button-group,
    .actions {
        flex-direction: column;
        align-items: stretch;
    }

    .button-group .button,
    .actions .button {
        width: 100%;
    }

    .auth-card {
        padding: 24px 18px;
    }

    .answer-label {
        padding: 12px;
    }

    .question-overview-grid {
        grid-template-columns:
            repeat(auto-fill, minmax(38px, 1fr));
    }

    .question-overview-item {
        width: 38px;
        height: 38px;
    }

}


/* ==========================================================================
   29. REDUZIERTE BEWEGUNG
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {

    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}


/* ==========================================================================
   ENDE
   ========================================================================== */
