/* ------------------------------
   Grundlayout & Reset
------------------------------ */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #e5e7eb; /* etwas dunkleres Grau */
    color: #222;
    line-height: 1.5;
}

.page {
    max-width: 1100px;
    margin: 2rem auto;
    padding: 2rem 1.8rem 2.4rem;
    background: #ffffff;
    border-radius: 1.25rem;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

/* ------------------------------
   Header / Logo / Subtitle
------------------------------ */

.main-header {
    text-align: center;
    margin-bottom: 2.5rem;
    padding-bottom: 1.4rem;
    border-bottom: 1px solid #e2e2e2;
}

.logo {
    font-size: 2.1rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    display: inline-flex;
    align-items: center;
}

/* Papierflieger-Icon */
.logo-icon {
    height: 2.1rem;
    width: auto;
    margin-right: 0.4rem;
    vertical-align: middle;
}

.logo span {
    color: #1a73e8;
}

.welcome {
    font-size: 1.2rem;
    margin-top: 0.5rem;
    color: #333;
}

.subtitle-short {
    font-size: 1rem;
    max-width: 32rem;
    margin: 0.4rem auto 0;
    color: #666;
}

/* ------------------------------
   Sektionen / Überschriften
------------------------------ */

.section-title {
    font-size: 1.6rem;
    margin: 1rem 0 1.5rem;
    font-weight: 600;
    text-align: left;
}

/* ------------------------------
   TILE-GRID
------------------------------ */

.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.2rem;
    margin-bottom: 2.5rem;
}

/* ------------------------------
   TILE-BASIS
------------------------------ */

.tile {
    text-decoration: none;
    color: #222;
    background: #ffffff;
    padding: 1.4rem 1.6rem;
    border-radius: 0.9rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    cursor: pointer;
    overflow: hidden;

    border: 2px solid transparent;

    transition:
        transform 0.16s ease,
        box-shadow 0.16s ease,
        border-color 0.16s ease,
        background-color 0.16s ease;
}

.tile-title {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Erklärung verborgen */
.tile-text {
    margin-top: 0.6rem;
    font-size: 0.95rem;
    opacity: 0;
    max-height: 0;
    transition: opacity 0.22s ease, max-height 0.22s ease;
}

/* Hover-Effekt */
.tile:hover,
.tile:focus-within {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

/* Erklärung erscheint */
.tile:hover .tile-text,
.tile:focus-within .tile-text {
    opacity: 1;
    max-height: 200px;
}

/* Badge im Schüler-Modus */
.badge {
    background: #fff;
    color: #000;
    padding: 0.15rem 0.4rem;
    font-size: 0.75rem;
    border-radius: 0.4rem;
    margin-left: 0.3rem;
}

/* ------------------------------
   FARBEN nach Bereich (Startseite)
------------------------------ */

.tile-jobcenter              { border-color: #7a94e8; background: #f5f6ff; }
.tile-agentur                { border-color: #d8a24a; background: #fff7e8; }
.tile-jugendamt              { border-color: #d66a7a; background: #fff2f4; }
.tile-gericht                { border-color: #6bb4c5; background: #ecf7fa; }
.tile-finanzamt              { border-color: #7fc27f; background: #f3fbf3; }
.tile-krankenkasse           { border-color: #a68ad6; background: #f5f0ff; }
.tile-rentenversicherung     { border-color: #d3a468; background: #fff8ec; }
.tile-stadt                  { border-color: #7aa87c; background: #f0f7f0; }

.tile-arzt                   { border-color: #5fa8d6; background: #edf6ff; }
.tile-erbschaft              { border-color: #d3857a; background: #fff2ee; }
.tile-kinder                 { border-color: #b9c96b; background: #f8fde9; }
.tile-besondere              { border-color: #d66b6b; background: #fff0f0; }
.tile-schueler               { border-color: #67a8d6; background: #e8f4ff; }

/* Hover-Farben Startseite */
.tile-jobcenter:hover              { background: #ecf0ff; }
.tile-agentur:hover                { background: #ffeecf; }
.tile-jugendamt:hover              { background: #ffe1e7; }
.tile-gericht:hover                { background: #e0f1f7; }
.tile-finanzamt:hover              { background: #e7f8e7; }
.tile-krankenkasse:hover           { background: #ece3ff; }
.tile-rentenversicherung:hover     { background: #ffefd9; }
.tile-stadt:hover                  { background: #e3f0e3; }

.tile-arzt:hover                   { background: #e0efff; }
.tile-erbschaft:hover              { background: #ffe4dd; }
.tile-kinder:hover                 { background: #f1fad5; }
.tile-besondere:hover              { background: #ffdcdc; }
.tile-schueler:hover               { background: #d9ecff; }

/* ------------------------------
   KI-Suche
------------------------------ */

.ki-section {
    margin-top: 1rem;
}

.ki-box {
    background: #f9fafb;
    border-radius: 0.9rem;
    padding: 1.4rem 1.6rem;
    border: 1px solid #e1e4ea;
}

.ki-box p {
    font-size: 0.96rem;
    color: #444;
    margin-bottom: 0.9rem;
}

.ki-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.ki-input {
    flex: 1 1 240px;
    padding: 0.65rem 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid #cbd0d9;
    font-size: 0.96rem;
}

.ki-input:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.15);
}

.ki-button {
    padding: 0.65rem 1.2rem;
    border-radius: 0.5rem;
    border: none;
    font-size: 0.96rem;
    font-weight: 600;
    cursor: pointer;
    background: #1a73e8;
    color: #fff;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.ki-button:hover {
    background: #155ac0;
    transform: translateY(-1px);
}

/* ------------------------------
   Footer
------------------------------ */

footer {
    margin-top: 3rem;
    padding-top: 1rem;
    border-top: 1px solid #ddd;
    text-align: center;
    font-size: 0.9rem;
    color: #555;
}

/* ========= Analyse-Seiten ========= */

.analysis-container {
    max-width: 960px;
    margin: 0 auto;
    display: grid;
    gap: 1.5rem;
}

@media (min-width: 900px) {
    .analysis-container {
        grid-template-columns: 1.2fr 1.4fr;
        align-items: flex-start;
    }
}

.analysis-info-box {
    background: #ffffff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.05);
    font-size: 0.95rem;
    line-height: 1.5;
}

.analysis-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 1.75rem 1.5rem;
    box-shadow: 0 4px 14px rgba(0,0,0,0.07);
    border: 1px solid rgba(0,0,0,0.06);
}

.analysis-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-label {
    font-weight: 600;
    font-size: 0.95rem;
}

.analysis-card input[type="file"],
.analysis-card textarea {
    font: inherit;
    padding: 0.5rem 0.6rem;
    border-radius: 8px;
    border: 1px solid #ccc;
    background: #fafafa;
}

.analysis-card textarea {
    resize: vertical;
    min-height: 140px;
}

.help-text {
    font-size: 0.8rem;
    color: #666;
}

.form-separator {
    text-align: center;
    font-size: 0.85rem;
    color: #777;
    position: relative;
    margin: 0.5rem 0;
}

.form-separator span {
    background: #fff;
    padding: 0 0.75rem;
    position: relative;
    z-index: 1;
}

.form-separator::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: #ddd;
    z-index: 0;
}

.checkbox-row {
    font-size: 0.9rem;
}

.form-checkbox input {
    margin-right: 0.35rem;
}

/* Form-Actions: Buttons schöner anordnen */

.form-actions {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Buttons */

.button-primary {
    display: inline-block;
    padding: 0.6rem 1.6rem;
    border-radius: 999px; /* Ovale Form */
    border: none;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    background: #005bbb;
    color: #fff;
    text-align: center;
    transition: background-color 0.15s ease, transform 0.1s ease;
    white-space: normal; /* Mehrzeilige Labels erlauben */
}

.button-primary:hover {
    background: #004c9b;
    transform: translateY(-1px);
}

.button-secondary {
    display: inline-block;
    padding: 0.55rem 1.4rem;
    border-radius: 999px; /* Ovale Form */
    border: 1px solid #ccc;
    font: inherit;
    font-size: 0.9rem;
    text-decoration: none;
    color: #333;
    background: #fff;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.1s ease;
    white-space: normal; /* Mehrzeilige Labels erlauben */
}

.button-secondary:hover {
    background: #f5f5f5;
    transform: translateY(-1px);
}

.analysis-small-hint {
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.3rem;
}

/* Ergebnisboxen */

.info-box,
.result-box,
.original-text-box {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 10px;
    background: #fafafa;
    border: 1px solid #e0e0e0;
}

.info-box pre,
.result-box pre,
.original-text-box pre {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.9rem;
    margin: 0;
}

.result-box h2,
.original-text-box h2 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.back-link {
    margin-top: 1.5rem;
}

/* QR-Bereich nur auf größeren Bildschirmen anzeigen */
.qr-desktop-only {
    display: none;
}

@media (min-width: 800px) {
    .qr-desktop-only {
        display: block;
        margin-bottom: 1.5rem;
    }
}

/* QR-Karte */
.qr-card {
    text-align: center;
}

.qr-card h2 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.qr-image-wrapper {
    margin: 1rem 0;
    display: flex;
    justify-content: center;
}

.qr-image-wrapper img {
    max-width: 220px;
    height: auto;
    border-radius: 12px;
    background: #fff;
    padding: 0.5rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

/* ============================
   Mobile-Upload-Auswahl
============================ */

.mobile-file-choices {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.mobile-file-choices .button-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 180px;
    text-align: center;
    white-space: normal;
}

.file-input-direct {
    margin-top: 0.6rem;
}

/* Sehr kleine Screens */
@media (max-width: 640px) {
    .mobile-file-choices {
        flex-direction: column;
    }
    .mobile-file-choices .button-secondary {
        width: 100%;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .button-primary,
    .form-actions .button-secondary {
        width: 100%;
        text-align: center;
    }
}

/* ============================
   Handy/Desktop – Sendebuttons
============================ */

.button-send-photo {
    display: none;
}

html.is-mobile .button-send-photo {
    display: inline-block;
}

html.is-mobile .button-send-file {
    display: none;
}

html.is-desktop .button-send-file {
    display: inline-block;
}

html.is-desktop .button-send-photo {
    display: none;
}

/* Mobile-Auswahl-Buttons: sicher ovale Form */
.mobile-file-choices .button-secondary {
    border-radius: 999px !important;
}

/* ============================
   Lade-Overlay beim Absenden
============================ */

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-box {
    background: #ffffff;
    padding: 1.4rem 1.6rem;
    border-radius: 0.9rem;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.25);
    max-width: 320px;
    text-align: center;
    font-size: 0.96rem;
}

/* ============================
   Nächste Schritte – Kachelbereich
============================ */

.next-steps-grid {
    margin-top: 1rem;
}

/* Kacheln für „Nächste Schritte“: Text zentriert & vertikal mittig */
.next-steps-grid .tile {
    min-height: 150px;
    text-align: center;
    align-items: center;      /* horizontal mittig */
    justify-content: center;  /* vertikal mittig */
}

/* Einzelne Kachel-Farben – alle aus bestehendem Farbspektrum */

/* 1) Zusammenfassung per E-Mail – wie „Arzt“ (blau) */
.tile-next-mail {
    border-color: #5fa8d6;
    background: #edf6ff;
}
.tile-next-mail:hover {
    background: #e0efff;
}

/* 2) Antwort vorbereiten – wie „Agentur“ (gold/gelb) */
.tile-next-antwort {
    border-color: #d8a24a;
    background: #fff7e8;
}
.tile-next-antwort:hover {
    background: #ffeecf;
}

/* 3) Checkliste – wie „Finanzamt“ (grün) */
.tile-next-checkliste {
    border-color: #7fc27f;
    background: #f3fbf3;
}
.tile-next-checkliste:hover {
    background: #e7f8e7;
}

/* 4) Speichern/Löschen – wie „Krankenkasse“ (lila) */
.tile-next-speicher {
    border-color: #a68ad6;
    background: #f5f0ff;
}
.tile-next-speicher:hover {
    background: #ece3ff;
}

/* 5) Neuen Brief hochladen – wie „Besondere“ (rot/rosa) */
.tile-next-neu {
    border-color: #d66b6b;
    background: #fff0f0;
}
.tile-next-neu:hover {
    background: #ffdcdc;
}

/* ===========================
   Buttons – einheitlicher Stil
   =========================== */

/* Grundstil für alle Buttons (Links & echte Buttons) */
.button-primary,
.button-secondary,
button.button-primary,
button.button-secondary,
a.button-primary,
a.button-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0.7rem 1.4rem;
    min-height: 2.6rem;

    border-radius: 999px; /* schöne Pillenform */
    border: 1px solid transparent;

    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;

    cursor: pointer;
    white-space: nowrap;

    transition:
        background-color 0.15s ease,
        color 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

/* Hauptaktion – blauer Button */
.button-primary,
button.button-primary,
a.button-primary {
    background-color: #1465c0;   /* dein BehördenPilot-Blau */
    border-color: #1465c0;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.button-primary:hover,
button.button-primary:hover,
a.button-primary:hover {
    background-color: #0f54a0;
    border-color: #0f54a0;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.20);
}

.button-primary:active,
button.button-primary:active,
a.button-primary:active {
    background-color: #0b3f7a;
    border-color: #0b3f7a;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

/* Nebenaktion – weißer Button mit Rahmen */
.button-secondary,
button.button-secondary,
a.button-secondary {
    background-color: #ffffff;
    border-color: #cfd6e0;
    color: #193043;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.button-secondary:hover,
button.button-secondary:hover,
a.button-secondary:hover {
    background-color: #f5f7fb;
    border-color: #b8c3d4;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.10);
}

.button-secondary:active,
button.button-secondary:active,
a.button-secondary:active {
    background-color: #eef1f7;
    border-color: #a5b2c7;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.10);
}

/* Fokuszustand – gleiche Optik für Tastatur-Nutzer */
.button-primary:focus,
.button-secondary:focus,
button.button-primary:focus,
button.button-secondary:focus,
a.button-primary:focus,
a.button-secondary:focus {
    outline: none;
    box-shadow:
        0 0 0 2px #ffffff,
        0 0 0 4px rgba(20, 101, 192, 0.5);
}

/* Container für Button-Gruppen (Form-Actions & Next-Actions) */
.form-actions,
.next-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

/* Buttons auf kleinen Bildschirmen breiter machen */
@media (max-width: 640px) {
    .form-actions > *:where(a, button),
    .next-actions > *:where(a, button) {
        flex: 1 1 auto;
        justify-content: center;
    }
}

