/*
 * Grundlayout HouseholdKraken.
 * Mobile first: Die Grundregeln gelten für schmale Bildschirme, breitere Ansichten ergänzen sie.
 */

:root {
    --color-bg: #f6f7f9;
    --color-surface: #ffffff;
    --color-text: #1d232b;
    --color-muted: #5b6573;
    --color-border: #dde1e6;
    --color-accent: #1f6feb;
    --color-test: #b45309;
    --color-test-text: #ffffff;
    --radius: 10px;
    --space: 1rem;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #12161b;
        --color-surface: #1b2128;
        --color-text: #e6e9ed;
        --color-muted: #9aa4b1;
        --color-border: #2c343d;
        --color-accent: #58a6ff;
    }
}

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

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font);
    line-height: 1.5;
}

a {
    color: var(--color-accent);
}

/* Kennzeichnung der Testinstallation: auffälliger Balken und farbiger Rand. */
.test-banner {
    background: var(--color-test);
    color: var(--color-test-text);
    text-align: center;
    font-weight: 600;
    padding: 0.4rem var(--space);
    font-size: 0.9rem;
}

body.is-test-installation {
    border-top: 4px solid var(--color-test);
}

.site-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.75rem var(--space);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--color-text);
    text-decoration: none;
}

.language-switch {
    display: flex;
    gap: 0.75rem;
}

.language-switch a[aria-current="true"] {
    font-weight: 700;
    text-decoration: none;
    color: var(--color-text);
}

.site-main {
    flex: 1;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: var(--space);
}

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: var(--space);
}

.card h1 {
    margin-top: 0;
    font-size: 1.5rem;
}

.facts {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.25rem;
}

.facts dt {
    color: var(--color-muted);
    font-size: 0.875rem;
}

.facts dd {
    margin: 0 0 0.5rem;
}

.error-id {
    font-family: ui-monospace, monospace;
    color: var(--color-muted);
}

.debug-details {
    overflow-x: auto;
    padding: 0.75rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.8rem;
}

.site-footer {
    padding: 0.75rem var(--space);
    color: var(--color-muted);
    font-size: 0.8rem;
    text-align: center;
}

@media (min-width: 640px) {
    .site-main {
        padding: calc(var(--space) * 2);
    }

    .facts {
        grid-template-columns: max-content 1fr;
        column-gap: 1.5rem;
    }

    .facts dd {
        margin: 0;
    }
}

/* ---- Formulare ---------------------------------------------------------------------------- */

.form {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-width: 32rem;
}

.form fieldset {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin: 0.5rem 0;
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.form label {
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 0.4rem;
}

.form label.checkbox {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    font-weight: 400;
}

.form input:not([type="checkbox"]),
.form select {
    width: 100%;
    padding: 0.55rem 0.65rem;
    font: inherit;
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 6px;
}

.form input:focus,
.form select:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 1px;
}

.form button {
    margin-top: 0.75rem;
    align-self: flex-start;
    padding: 0.6rem 1.1rem;
    font: inherit;
    font-weight: 600;
    color: #fff;
    background: var(--color-accent);
    border: 0;
    border-radius: 6px;
    cursor: pointer;
}

.hint {
    margin: 0;
    font-size: 0.8rem;
    color: var(--color-muted);
}

/* ---- Hinweise ----------------------------------------------------------------------------- */

.alert {
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    border: 1px solid var(--color-border);
    background: var(--color-bg);
}

.alert ul {
    margin: 0;
    padding-left: 1.2rem;
}

.alert-error {
    border-color: #d1242f;
    background: color-mix(in srgb, #d1242f 10%, var(--color-surface));
}

.alert-success {
    border-color: #1a7f37;
    background: color-mix(in srgb, #1a7f37 10%, var(--color-surface));
}

/* ---- Installationsschritte und Checklisten ------------------------------------------------ */

.steps {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    padding: 0;
    margin: 0 0 1rem;
    list-style: none;
    font-size: 0.85rem;
    color: var(--color-muted);
    counter-reset: step;
}

.steps li::before {
    counter-increment: step;
    content: counter(step) ". ";
}

.steps li[aria-current="step"] {
    color: var(--color-text);
    font-weight: 700;
}

.checklist {
    padding-left: 0;
    list-style: none;
}

.checklist li {
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--color-border);
}

.check-state {
    display: inline-block;
    min-width: 4.5rem;
    font-weight: 700;
}

.checklist .ok .check-state { color: #1a7f37; }
.checklist .fail .check-state { color: #d1242f; }
.checklist .warn .check-state { color: var(--color-muted); }

/* ---- Navigation im Kopf ------------------------------------------------------------------- */

.site-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.inline-form {
    display: inline;
    margin: 0;
}

.link-button {
    padding: 0;
    font: inherit;
    color: var(--color-accent);
    background: none;
    border: 0;
    text-decoration: underline;
    cursor: pointer;
}

.language-switch .link-button[aria-current="true"] {
    font-weight: 700;
    text-decoration: none;
    color: var(--color-text);
}

.card + .card {
    margin-top: var(--space);
}

.card h2 {
    margin-top: 0;
    font-size: 1.15rem;
}

/* ---- Rechtstexte und Fußzeile ------------------------------------------------------------- */

.legal-text p {
    max-width: 70ch;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 1rem;
    margin-bottom: 0.4rem;
}

/* ---- Tabellen und breite Formulare -------------------------------------------------------- */

.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th,
.table td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    vertical-align: top;
}

.form-wide {
    max-width: 60rem;
}

.form textarea {
    width: 100%;
    padding: 0.55rem 0.65rem;
    font: inherit;
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    resize: vertical;
}

.search-form {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    max-width: none;
    margin-bottom: 1rem;
}

.search-form label {
    width: 100%;
}

.search-form input {
    flex: 1;
    min-width: 12rem;
}

.search-form button {
    margin-top: 0;
}
