/* Grundlayout */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.5;
}

header {
    background: #1a3a5c;
    color: white;
    padding: 1.5rem 2rem;
    text-align: center;
}

header h1 { font-size: 1.6rem; margin-bottom: 0.3rem; }
.untertitel { font-size: 0.9rem; opacity: 0.85; }

main { max-width: 1100px; margin: 1.5rem auto; padding: 0 1rem; }

a { color: #1a3a5c; }
code {
    font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
    background: #eef2f7;
    padding: 0.05rem 0.3rem;
    border-radius: 3px;
    font-size: 0.9em;
}

/* Schritt-Container */
.schritt {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
    border-left: 4px solid #ccc;
    transition: border-color 0.2s;
}
.schritt.aktiv { border-left-color: #1a3a5c; }
.schritt.erledigt { border-left-color: #2a7d4f; }

.schritt h2 {
    color: #1a3a5c;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.8rem;
}

.schritt-nr {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    background: #1a3a5c;
    color: white;
    border-radius: 50%;
    font-size: 0.9rem;
}
.schritt.erledigt .schritt-nr { background: #2a7d4f; }

.hinweis {
    background: #f0f7ff;
    border-left: 3px solid #1a3a5c;
    padding: 0.6rem 0.9rem;
    margin-bottom: 1rem;
    font-size: 0.88rem;
    color: #455;
}

.erklaerung {
    font-size: 0.88rem;
    color: #555;
    margin: 0.6rem 0 1rem;
    line-height: 1.55;
}

.status {
    margin-top: 0.6rem;
    padding: 0.5rem 0.8rem;
    background: #ecf8ed;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #1e5e3b;
}

/* Tabs */
.quelle-tabs, .modus-tabs {
    display: flex;
    margin-bottom: 1rem;
}
.tab {
    flex: 1;
    padding: 0.55rem;
    border: 2px solid #1a3a5c;
    background: white;
    color: #1a3a5c;
    cursor: pointer;
    font-size: 0.88rem;
    transition: background 0.15s;
}
.tab:not(:first-child) { border-left-width: 1px; }
.tab:not(:last-child)  { border-right-width: 1px; }
.tab:first-child { border-radius: 6px 0 0 6px; }
.tab:last-child  { border-radius: 0 6px 6px 0; }
.tab.aktiv { background: #1a3a5c; color: white; }
.tab:hover:not(.aktiv) { background: #f0f4fa; }

/* Quelle-Bereich */
.quelle-bereich, .modus-bereich {
    margin-bottom: 0.5rem;
}
label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}
input[type="file"], textarea, input[type="text"] {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: inherit;
}
textarea { resize: vertical; }

.aktionen, .aktionen-zeile {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
    align-items: center;
    margin-top: 1rem;
}

/* Buttons */
.btn-primary, .btn-sekundaer, .btn-mini {
    padding: 0.55rem 1.1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.92rem;
    cursor: pointer;
    transition: background 0.2s;
    display: inline-block;
}
.btn-primary { background: #2a7d4f; color: white; }
.btn-primary:hover { background: #1e5e3b; }
.btn-primary:disabled { background: #aaa; cursor: not-allowed; }

.btn-sekundaer { background: #e0e0e0; color: #333; }
.btn-sekundaer:hover { background: #c8c8c8; }

.btn-mini { padding: 0.3rem 0.7rem; font-size: 0.78rem; background: #1a3a5c; color: white; }

.datei-label { cursor: pointer; }

/* Prompt-Vorschlag */
.prompt-vorschlag {
    margin-top: 0.7rem;
    background: #fffbe6;
    padding: 0.7rem;
    border-radius: 6px;
    font-size: 0.85rem;
}
.prompt-vorschlag summary {
    cursor: pointer;
    color: #8a6d00;
    font-weight: 600;
}
.prompt-vorschlag p { margin: 0.5rem 0; }
.prompt-vorschlag pre {
    background: white;
    padding: 0.6rem;
    border-radius: 4px;
    border: 1px solid #e0d088;
    font-size: 0.8rem;
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: 0.5rem;
}

/* Chat */
.chat {
    min-height: 180px;
    max-height: 380px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0.7rem;
    margin-bottom: 0.6rem;
    background: #fafafa;
}
.nachricht {
    padding: 0.5rem 0.85rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    max-width: 85%;
    white-space: pre-wrap;
    word-break: break-word;
}
.nachricht.ki   { background: #e8f0fa; margin-right: auto; }
.nachricht.user { background: #2a7d4f; color: white; margin-left: auto; }

.chat-eingabe {
    display: flex;
    gap: 0.5rem;
}
.chat-eingabe textarea { flex: 1; }

/* Regelwerk-Box */
.regelwerk-box {
    background: #f0f7ff;
    border-radius: 6px;
    padding: 1rem;
    margin-top: 1rem;
}
.regelwerk-box h3 {
    color: #1a3a5c;
    font-size: 1rem;
    margin-bottom: 0.6rem;
}
.regelwerk-zeile {
    padding: 0.3rem 0;
    border-bottom: 1px solid #d0e0f0;
    font-size: 0.88rem;
}
.regelwerk-zeile:last-child { border-bottom: none; }
.regelwerk-name { font-weight: 600; color: #1a3a5c; }
.regelwerk-wert {
    font-family: ui-monospace, monospace;
    background: white;
    padding: 0.05rem 0.4rem;
    border-radius: 3px;
    font-size: 0.85rem;
}

.json-details { margin: 0.7rem 0; }
.json-details summary {
    cursor: pointer;
    color: #1a3a5c;
    font-size: 0.85rem;
}
.json-details pre {
    background: #2d2d2d;
    color: #f0f0f0;
    padding: 0.7rem;
    border-radius: 4px;
    font-size: 0.78rem;
    overflow-x: auto;
    margin-top: 0.4rem;
}

/* Tabelle */
.tabellen-rahmen {
    overflow-x: auto;
    max-height: 60vh;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}
#metadaten-tabelle {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
#metadaten-tabelle th {
    background: #1a3a5c;
    color: white;
    padding: 0.5rem;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 1;
}
#metadaten-tabelle td {
    padding: 0.3rem 0.4rem;
    border-bottom: 1px solid #eee;
    vertical-align: top;
}
#metadaten-tabelle .bildname {
    font-family: ui-monospace, monospace;
    font-size: 0.78rem;
    color: #555;
    min-width: 9rem;
    white-space: nowrap;
}
#metadaten-tabelle input,
#metadaten-tabelle textarea {
    width: 100%;
    padding: 0.3rem;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 0.8rem;
    background: #fff;
}
#metadaten-tabelle input:focus,
#metadaten-tabelle textarea:focus {
    border-color: #1a3a5c;
    outline: none;
    background: #f0fff5;
}
#metadaten-tabelle textarea { min-height: 2.4rem; resize: vertical; }
#metadaten-tabelle tr:hover td { background: #fafcff; }

.hinweise-liste {
    background: #fff8e0;
    border: 1px solid #ecd07a;
    border-radius: 4px;
    padding: 0.6rem 0.9rem;
    margin-bottom: 0.7rem;
    font-size: 0.85rem;
}
.hinweise-liste ul { margin: 0.3rem 0 0 1.2rem; }

/* Ladebalken */
#laden {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid #ddd;
    border-top-color: #1a3a5c;
    border-radius: 50%;
    margin-bottom: 1rem;
    animation: drehen 0.8s linear infinite;
}
@keyframes drehen { to { transform: rotate(360deg); } }

.versteckt { display: none !important; }

/* Footer */
footer {
    max-width: 1100px;
    margin: 2rem auto;
    padding: 1rem;
    text-align: center;
    font-size: 0.8rem;
    color: #666;
}

@media (max-width: 700px) {
    .aktionen, .aktionen-zeile { flex-direction: column; align-items: stretch; }
    .aktionen button, .aktionen-zeile button, .aktionen-zeile label {
        width: 100%;
        text-align: center;
    }
    #metadaten-tabelle { font-size: 0.75rem; }
}
