/* =========================================================================
   meinhandwerker.team – Globales Stylesheet
   Responsive One-Pager: Desktop / Tablet / Mobil
   Hintergrundfarbe (vorgeschrieben): #dff2fd
   ========================================================================= */

:root {
    /* Primärschrift: lokal hinterlegter Inter (self-hosted, s. fonts.css).
       System-Stack bleibt als Fallback, falls der Font nicht lädt. */
    --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --bg: #dff2fd;                 /* Vorgeschriebene Hintergrundfarbe */
    --card-bg: #ffffff;
    --ink: #0f2233;                /* Primärtext */
    --ink-soft: #3d5468;           /* Sekundärtext */
    --brand: #0a66b2;              /* Akzent (Links) */
    --footer-bg: #0f2233;
    --footer-ink: #eaf4fb;
    --footer-ink-soft: #a9c8e0;
    --radius: 12px;
    --shadow: 0 2px 10px rgba(15, 34, 51, 0.08);
    --shadow-hover: 0 10px 24px rgba(15, 34, 51, 0.16);
    --maxw: 1120px;
}

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-sans);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

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

:focus-visible {
    outline: 3px solid var(--brand);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---------- Layout-Helfer ---------- */
.container {
    width: 100%;
    max-width: var(--maxw);
    margin-inline: auto;
    padding-inline: 16px;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- Kopfbereich (Logo oben) ---------- */
.site-header {
    padding: clamp(22px, 4vw, 48px) 0 10px;
}

.brand {
    display: block;
    text-align: center;
}

.brand img {
    width: min(460px, 88%);
    margin-inline: auto;
}

/* ---------- Hauptinhalt ---------- */
.main-content {
    flex: 1 0 auto;
    padding-block: clamp(18px, 3vw, 34px) 0;
}

/* ---------- Innungen-Grid ---------- */
.innungen__title {
    font-size: clamp(1.5rem, 3.5vw, 2.1rem);
    line-height: 1.2;
    margin: 0 0 0.4em;
    text-align: center;
    color: var(--ink);
}

.innungen__lead {
    text-align: center;
    color: var(--ink-soft);
    max-width: 62ch;
    margin: 0 auto 1.7em;
    font-size: 1.02rem;
}

.innungen-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)); /* Desktop: 4 Spalten */
    gap: clamp(14px, 2vw, 22px);
}

.innung-card {
    background: var(--card-bg);
    border: 1px solid rgba(15, 34, 51, 0.06);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: clamp(16px, 2vw, 22px) 14px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.innung-card:hover,
.innung-card:focus-within {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.innung-card figure {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.innung-card img {
    width: min(150px, 72%);
    height: auto;
}

.innung-card figcaption {
    font-weight: 600;
    font-size: 0.98rem;
    color: var(--ink);
    text-align: center;
}

.innungen__empty {
    text-align: center;
    color: var(--ink-soft);
    padding: 32px 0;
}

/* ---------- Fußbereich ---------- */
.site-footer {
    background: var(--footer-bg);
    color: var(--footer-ink);
    padding: clamp(22px, 3.5vw, 34px) 0;
    text-align: center;
    margin-top: clamp(30px, 5vw, 60px);
}

.copyright {
    margin: 0 0 10px;
    font-size: 0.95rem;
}

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px 14px;
}

.footer-nav__item {
    color: var(--footer-ink-soft);
    text-decoration: none;
    font-size: 0.95rem;
}

a.footer-nav__item:hover,
a.footer-nav__item:focus-visible {
    color: #ffffff;
    text-decoration: underline;
}

.footer-nav__item--current {
    color: var(--footer-ink);
    font-weight: 600;
}

.footer-nav__sep {
    color: rgba(234, 244, 251, 0.35);
}

/* ---------- Rechtstexte (Impressum, Datenschutz) ---------- */
.page {
    max-width: 760px;
    margin-inline: auto;
    padding-block: 8px 24px;
}

.page__title {
    font-size: clamp(1.7rem, 4vw, 2.3rem);
    line-height: 1.2;
    margin: 0 0 0.8em;
    color: var(--ink);
}

.page__section {
    margin-bottom: 1.5em;
}

.page__subtitle {
    font-size: 1.15rem;
    margin: 0 0 0.5em;
    color: var(--ink);
}

.page__section p {
    margin: 0 0 0.8em;
    color: var(--ink-soft);
}

.page__address {
    font-style: normal;
    color: var(--ink-soft);
    line-height: 1.7;
}

.page__list {
    margin: 0 0 0.8em;
    padding-left: 1.2em;
    color: var(--ink-soft);
}

.page__list li {
    margin-bottom: 0.35em;
}

/* ---------- Kachel als Button (öffnet Kontakt-Modal) ---------- */
.innung-card__tile {
    appearance: none;
    -webkit-appearance: none;
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    font: inherit;
    color: inherit;
    text-align: center;
    cursor: pointer;
}

/* ---------- Kontakt-Modal (HTML5 <dialog>) ---------- */
/* KEIN "position: relative" hier: Das UA-Standardregel für :modal
   ("position: fixed; inset: 0; margin: auto") zentriert das Modal im
   Viewport. Eine position: relative-Überschreibung würde die Modal in
   den Dokumentfluss schieben (erscheint dann oben/außer Sicht). */
.innung-modal {
    border: 0;
    padding: 0;
    margin: auto;
    width: min(640px, calc(100vw - 32px));
    max-height: calc(100vh - 64px);
    border-radius: var(--radius);
    background: var(--card-bg);
    box-shadow: var(--shadow-hover);
    overflow: hidden;
}

.innung-modal::backdrop {
    background: rgba(15, 34, 51, 0.55);
}

.innung-modal__backdrop {
    /* Platzhalter hinter dem Inhalt; Klick-Erkennung läuft über das Dialog-Element. */
    position: absolute;
    inset: 0;
    z-index: 0;
}

.innung-modal__content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 64px);
}

.innung-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 22px;
    border-bottom: 1px solid rgba(15, 34, 51, 0.08);
}

.innung-modal__title {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.3;
    color: var(--ink);
    overflow-wrap: anywhere;
}

.innung-modal__close {
    appearance: none;
    -webkit-appearance: none;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    font-size: 1.9rem;
    line-height: 1;
    color: var(--ink-soft);
    cursor: pointer;
}

.innung-modal__close:hover,
.innung-modal__close:focus-visible {
    background: rgba(15, 34, 51, 0.06);
    color: var(--ink);
}

.innung-modal__body {
    padding: 20px 22px;
    overflow: auto;
    color: var(--ink-soft);
}

.innung-modal__body a {
    color: var(--brand);
}

/* ---------- Formular-Bausteine (Login, Admin) ---------- */
.main-content--narrow {
    max-width: 440px;
    margin-inline: auto;
}

.signin__title {
    font-size: clamp(1.6rem, 4vw, 2.1rem);
    line-height: 1.2;
    margin: 0 0 0.3em;
}

.signin__lead {
    margin: 0 0 1.2em;
    color: var(--ink-soft);
}

.signin__form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 18px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field label {
    font-weight: 600;
    font-size: 0.95rem;
}

.field input[type="text"],
.field input[type="password"] {
    padding: 10px 12px;
    border: 1px solid rgba(15, 34, 51, 0.2);
    border-radius: 8px;
    font: inherit;
    background: #fff;
    color: var(--ink);
    width: 100%;
}

.field--check {
    flex-direction: row;
    align-items: center;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    cursor: pointer;
}

.checkbox input {
    width: 18px;
    height: 18px;
    accent-color: var(--brand);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: 8px;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.btn--primary {
    background: var(--brand);
    color: #fff;
}

.btn--primary:hover {
    background: #08529a;
}

.btn--ghost {
    background: transparent;
    color: var(--brand);
    border-color: rgba(10, 102, 178, 0.4);
}

.btn--ghost:hover {
    background: rgba(10, 102, 178, 0.08);
}

.btn--small {
    padding: 6px 12px;
    font-size: 0.9rem;
}

.signin__back {
    margin: 0;
}

/* ---------- Hinweise / Alerts ---------- */
.alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.95rem;
    margin: 0 0 14px;
    border: 1px solid transparent;
}

.alert--success {
    background: #e6f6ec;
    border-color: #b6e2c6;
    color: #1f5e34;
}

.alert--error {
    background: #fdecec;
    border-color: #f3c1c1;
    color: #8a2626;
}

/* ---------- Verwaltung: Topbar ---------- */
.admin__topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}

.admin__title {
    font-size: clamp(1.4rem, 3.5vw, 1.9rem);
    margin: 0;
}

.admin__logout {
    margin: 0;
}

/* ---------- Verwaltung: Liste ---------- */
.admin__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin__item {
    display: grid;
    grid-template-columns: auto auto 1fr auto auto auto;
    align-items: center;
    gap: 14px;
    background: var(--card-bg);
    border: 1px solid rgba(15, 34, 51, 0.06);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 12px 16px;
}

.admin__no {
    color: var(--ink-soft);
    font-variant-numeric: tabular-nums;
    min-width: 2ch;
    text-align: right;
}

.admin__thumb {
    width: 40px;
    height: 40px;
    object-fit: contain;
    background: #fff;
    border-radius: 8px;
}

.admin__name {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.admin__slug {
    color: var(--ink-soft);
    font-size: 0.9rem;
}

.badge {
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge--active {
    background: #e6f6ec;
    color: #1f5e34;
}

.badge--inactive {
    background: #eef1f4;
    color: var(--ink-soft);
}

/* ---------- Verwaltung: Edit-Formular ---------- */
.admin__edit {
    display: flex;
    flex-direction: column;
    gap: 18px;
    background: var(--card-bg);
    border: 1px solid rgba(15, 34, 51, 0.06);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: clamp(16px, 3vw, 26px);
    max-width: 820px;
}

.admin__edit-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 22px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(15, 34, 51, 0.08);
    font-size: 0.9rem;
    color: var(--ink-soft);
}

.admin__meta-item code {
    background: rgba(15, 34, 51, 0.05);
    padding: 1px 6px;
    border-radius: 5px;
}

.field__label--block {
    font-weight: 600;
    display: block;
    margin-bottom: 6px;
}

.quill-editor {
    border: 1px solid rgba(15, 34, 51, 0.2);
    border-radius: 8px;
    min-height: 220px;
    background: #fff;
}

/* Quill: eigene Toolbar-Rundung an das Design angleichen. */
.quill-editor .ql-toolbar {
    border-radius: 8px 8px 0 0;
    border-bottom: 1px solid rgba(15, 34, 51, 0.12);
}

.quill-editor .ql-container {
    border-radius: 0 0 8px 8px;
    font-family: inherit;
}

.admin__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.admin__empty {
    color: var(--ink-soft);
    padding: 20px 0;
}

/* ---------- Verwaltung: Bild-Upload ---------- */
.admin__image {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    background: var(--card-bg);
    border: 1px solid rgba(15, 34, 51, 0.06);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: clamp(16px, 3vw, 26px);
    max-width: 820px;
    margin-top: 18px;
}

.admin__image-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.admin__image-preview img {
    width: 160px;
    height: 160px;
    object-fit: contain;
    background: #fff;
    border: 1px solid rgba(15, 34, 51, 0.1);
    border-radius: 8px;
}

.admin__image-filename {
    margin: 0;
    font-size: 0.85rem;
    color: var(--ink-soft);
    font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
}

.admin__image-actions {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    min-width: 0;
}

.admin__image-status {
    margin: 0 0 10px;
}

/* ---------- Verwaltung: Bild-Dialog ---------- */
.admin__image-dialog {
    position: relative;
    border: 0;
    padding: 0;
    margin: auto;
    width: min(560px, calc(100vw - 32px));
    max-height: calc(100vh - 64px);
    border-radius: var(--radius);
    background: var(--card-bg);
    box-shadow: var(--shadow-hover);
}

.admin__image-dialog::backdrop {
    background: rgba(15, 34, 51, 0.55);
}

.admin__dialog-body {
    display: flex;
    flex-direction: column;
    padding: 24px;
    gap: 14px;
    max-height: calc(100vh - 64px);
    overflow: auto;
}

.admin__dialog-title {
    margin: 0;
    font-size: 1.15rem;
    color: var(--ink);
}

.admin__dialog-hint {
    margin: 0;
    font-size: 0.9rem;
    color: var(--ink-soft);
}

.admin__dialog-hint code {
    background: rgba(15, 34, 51, 0.05);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.admin__dialog-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 4px;
}

/* ---------- Dropzone: Anpassungen an das Design ---------- */
.dz-dropzone {
    border: 2px dashed rgba(15, 34, 51, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.6);
    min-height: 180px;
    padding: 20px;
}

.dz-dropzone.dz-drag-hover {
    border-color: var(--brand);
    background: rgba(10, 102, 178, 0.04);
}

.dz-dropzone .dz-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--ink-soft);
    font-size: 0.95rem;
    margin: 0 auto;
    padding: 20px 0;
}

.dz-dropzone .dz-message__icon {
    color: rgba(15, 34, 51, 0.3);
}

.dz-dropzone .dz-file-browser {
    color: var(--brand);
    font-weight: 600;
}

.dz-dropzone .dz-selected-files {
    margin-top: 12px;
}

.dz-dropzone .dz-file {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(15, 34, 51, 0.1);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.dz-dropzone .dz-progress {
    border: 0;
    background: rgba(15, 34, 51, 0.1);
    border-radius: 4px;
}

.dz-dropzone .dz-progress .dz-upload {
    background: var(--brand);
}

.dz-dropzone .dz-remove {
    margin-left: 10px;
    font-size: 0.85rem;
    color: var(--ink-soft);
    text-decoration: underline;
    cursor: pointer;
}

.dz-dropzone .dz-remove:hover {
    color: #8a2626;
}

/* ---------- Responsive Breakpoints ---------- */
/* Tablet: 2 Spalten */
@media (max-width: 1024px) {
    .innungen-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Mobil: 1 Spalte */
@media (max-width: 600px) {
    .innungen-grid {
        grid-template-columns: 1fr;
    }

    .brand img {
        width: min(360px, 92%);
    }

    /* Admin-Liste: auf schmalen Screens zweireihig umbrechen. */
    .admin__item {
        grid-template-columns: auto auto 1fr auto;
        grid-template-areas:
            "no thumb name badge"
            "no thumb slug  btn";
        row-gap: 6px;
    }

    .admin__no     { grid-area: no; }
    .admin__thumb  { grid-area: thumb; }
    .admin__name   { grid-area: name; }
    .admin__slug   { grid-area: slug; }
    .admin__item .badge { grid-area: badge; justify-self: end; }
    .admin__item .btn   { grid-area: btn;  justify-self: end; }
}

/* ---------- Reduzierte Bewegung ---------- */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .innung-card,
    .innung-card:hover,
    .innung-card:focus-within {
        transition: none;
        transform: none;
    }
}
