/* =============================================================
   Dienstleistungsboard – Frontend CSS v0.3
   ============================================================= */

/* ---- Basis -------------------------------------------------- */
.dlb-message        { padding: .75rem 1rem; border-radius: 4px; margin-bottom: 1rem; }
.dlb-success        { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.dlb-error          { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.dlb-required       { color: #c00; }
.dlb-hint           { font-size: .8em; color: #666; display: block; margin-top: .25rem; }
.dlb-empty          { color: #666; font-style: italic; }
.dlb-loading        { opacity: .5; pointer-events: none; transition: opacity .2s; }
.dlb-inline-form    { display: inline; }

/* ---- Buttons ----------------------------------------------- */
.dlb-btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: .5rem 1.1rem; border-radius: 4px; font-size: .9rem;
    font-weight: 600; text-decoration: none; cursor: pointer;
    border: 2px solid transparent; transition: background .15s, color .15s, border-color .15s;
    line-height: 1.3;
}
.dlb-btn--primary    { background: #1F4E5F; color: #fff; border-color: #1F4E5F; }
.dlb-btn--primary:hover { background: #163c4a; border-color: #163c4a; color: #fff; }
.dlb-btn--secondary  { background: #e0e0e0; color: #333; border-color: #e0e0e0; }
.dlb-btn--secondary:hover { background: #c8c8c8; border-color: #c8c8c8; }
.dlb-btn--outline    { background: transparent; color: #1F4E5F; border-color: #1F4E5F; }
.dlb-btn--outline:hover { background: #1F4E5F; color: #fff; }
.dlb-btn--danger     { background: #dc3545; color: #fff; border-color: #dc3545; }
.dlb-btn--danger:hover { background: #b02a37; border-color: #b02a37; }
.dlb-btn--small      { padding: .3rem .7rem; font-size: .8rem; }
.dlb-btn[disabled]   { opacity: .5; cursor: not-allowed; }

/* ---- Badges ----------------------------------------------- */
.dlb-badge {
    display: inline-block; padding: .2rem .6rem; border-radius: 20px;
    font-size: .75rem; font-weight: 700; letter-spacing: .03em;
}
.dlb-badge--success { background: #d4edda; color: #155724; }
.dlb-badge--warning { background: #fff3cd; color: #856404; }
.dlb-badge--muted   { background: #e2e3e5; color: #383d41; }

/* ---- Formulare -------------------------------------------- */
.dlb-form           { max-width: 720px; }
.dlb-form-section   { margin-bottom: 2rem; }
.dlb-form-section h3 { font-size: 1.1rem; border-bottom: 2px solid #1F4E5F; padding-bottom: .4rem; margin-bottom: 1rem; }
.dlb-form-row       { margin-bottom: 1rem; }
.dlb-form-row label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .25rem; }
.dlb-form-row input[type="text"],
.dlb-form-row input[type="email"],
.dlb-form-row input[type="url"],
.dlb-form-row input[type="password"],
.dlb-form-row input[type="search"],
.dlb-form-row textarea,
.dlb-form-row select {
    width: 100%; padding: .5rem .75rem; border: 1px solid #ccc;
    border-radius: 4px; font-size: 1rem; box-sizing: border-box;
}
.dlb-form-row textarea       { resize: vertical; }
.dlb-form-row input[readonly] { background: #f5f5f5; }
.dlb-form-submit             { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }

/* ---- Filterleiste ----------------------------------------- */
.dlb-filters        { margin-bottom: 1.5rem; }
.dlb-filters__row   { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.dlb-filters__field { flex: 1 1 160px; min-width: 140px; }
.dlb-filters__field label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .25rem; }
.dlb-filters__field input,
.dlb-filters__field select { width: 100%; padding: .4rem .6rem; border: 1px solid #ccc; border-radius: 4px; font-size: .9rem; }
.dlb-filter-actions { display: flex; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; }

/* ---- Ergebnisse ------------------------------------------- */
.dlb-results-head p { font-size: .9rem; color: #555; margin: .5rem 0 1rem; }

/* ---- Karten ----------------------------------------------- */
/* Desktop: mehr, eher quadratische Karten. Je enger der Viewport,
   desto weniger Spalten – bis hin zu einer vollen Spalte (Hochformat) auf Mobile. */
.dlb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
}
.dlb-card {
    position: relative; border: 1px solid #ddd; border-radius: 8px;
    padding: 1.2rem; background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
    display: flex; flex-direction: column; gap: .5rem;
    overflow: visible;           /* nichts wird abgeschnitten */
    min-width: 0;                /* verhindert Overflow durch lange Wörter im Flex-Container */
}

/* Kopfzeile: Gemeinde + „Freiwilliges Engagement"-Badge nebeneinander,
   rutschen bei wenig Platz automatisch untereinander (statt zu überlappen) */
.dlb-card__header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: .5rem;
}
.dlb-card__ribbon {
    flex-shrink: 0;
    background: #f0a500; color: #fff;
    font-size: .7rem; font-weight: 700; padding: .3rem .7rem;
    border-radius: 20px; letter-spacing: .03em;
    white-space: nowrap;
}
.dlb-card__gemeinde {
    font-size: .78rem; color: #888; font-weight: 600;
    text-transform: uppercase; letter-spacing: .05em; margin: 0;
    overflow-wrap: break-word;
}
.dlb-card__title {
    margin: 0; font-size: 1.05rem;
    overflow-wrap: break-word;    /* lange Wörter/Klammern brechen um statt abgeschnitten zu werden */
    hyphens: auto;
}
.dlb-card__title a  { color: #1F4E5F; text-decoration: none; }
.dlb-card__title a:hover { text-decoration: underline; }
.dlb-card__tags     { display: flex; flex-wrap: wrap; gap: .35rem; }
.dlb-card__tag      { background: #EEF2F5; color: #1F4E5F; border-radius: 3px; font-size: .75rem; padding: .15rem .5rem; font-weight: 600; }
.dlb-card__tag--haupt { background: #1F4E5F; color: #fff; }
.dlb-card__tag--zg  { background: #e0f0f5; color: #136; }
.dlb-card__desc     { font-size: .88rem; color: #444; margin: 0; overflow-wrap: break-word; }
.dlb-card__meta     { font-size: .82rem; color: #555; margin: 0; overflow-wrap: break-word; }
.dlb-card__footer   { margin-top: auto; padding-top: .5rem; border-top: 1px solid #f0f0f0; }
.dlb-card__logo     { max-height: 40px; width: auto; object-fit: contain; }

/* Große Bildschirme: mehr Spalten, Karten wirken kompakter/quadratischer */
@media (min-width: 1200px) {
    .dlb-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}

/* Tablet: zwei Spalten */
@media (max-width: 900px) and (min-width: 601px) {
    .dlb-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Mobile: eine volle Spalte, Karten wachsen natürlich ins Hochformat */
@media (max-width: 600px) {
    .dlb-grid { grid-template-columns: 1fr; }
    .dlb-card__header { flex-direction: column; align-items: flex-start; }
    .dlb-card__ribbon { align-self: flex-start; }
}


/* ---- Pagination ------------------------------------------- */
.dlb-pagination     { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1.5rem; }
.dlb-pagination a   {
    display: inline-block; padding: .35rem .75rem; border: 1px solid #ccc;
    border-radius: 4px; text-decoration: none; color: #1F4E5F; font-size: .9rem;
}
.dlb-pagination a.is-active,
.dlb-pagination a:hover { background: #1F4E5F; color: #fff; border-color: #1F4E5F; }

/* ---- Dashboard -------------------------------------------- */
.dlb-dashboard__header  { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; flex-wrap: wrap; gap: .5rem; }
.dlb-dashboard__header h2 { margin: 0; font-size: 1.3rem; }

/* ---- Tabelle (Dashboard + Benutzerverwaltung) ------------- */
.dlb-table              { width: 100%; border-collapse: collapse; font-size: .9rem; }
.dlb-table th,
.dlb-table td           { padding: .6rem .8rem; border: 1px solid #ddd; text-align: left; vertical-align: middle; }
.dlb-table th           { background: #f5f7fa; font-weight: 700; color: #1F4E5F; }
.dlb-table tr:nth-child(even) td { background: #fafbfc; }
.dlb-table__actions     { display: flex; flex-wrap: wrap; gap: .4rem; }

/* ---- Benutzerverwaltung ----------------------------------- */
.dlb-user-management h2 { margin-bottom: 1rem; }

/* ---- Responsive ------------------------------------------- */
@media (max-width: 600px) {
    .dlb-grid           { grid-template-columns: 1fr; }
    .dlb-filters__row   { flex-direction: column; }
    .dlb-filters__field { flex: 1 1 100%; }
    .dlb-table          { font-size: .78rem; }
    .dlb-table__actions { flex-direction: column; }
    .dlb-dashboard__header { flex-direction: column; align-items: flex-start; }
}

/* ---- Modal ------------------------------------------------- */
.dlb-modal-open     { overflow: hidden; }
.dlb-modal__overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9998;
}
.dlb-modal {
    position: fixed; inset: 0; z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    pointer-events: none;
}
.dlb-modal[style*="display: block"],
.dlb-modal[style*="display:block"] { pointer-events: auto; }
.dlb-modal__box {
    background: #fff; border-radius: 8px; width: 100%; max-width: 520px;
    max-height: 90vh; overflow-y: auto;
    padding: 1.75rem; box-shadow: 0 8px 32px rgba(0,0,0,.18);
    pointer-events: auto; position: relative; z-index: 10000;
}
.dlb-modal__header  { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.dlb-modal__header h3 { margin: 0; font-size: 1.15rem; color: #1F4E5F; }
.dlb-modal__close   {
    background: none; border: none; font-size: 1.5rem; cursor: pointer;
    color: #888; line-height: 1; padding: 0 .25rem;
}
.dlb-modal__close:hover { color: #c00; }

@media (max-width: 600px) {
    .dlb-modal__box { margin: 1rem; max-width: calc(100% - 2rem); }
}

/* ================================================================
   FILTER v2 – neue Such-Maske
   ================================================================ */

/* ---- Layout der Filterleiste ---------------------------------- */
.dlb-filters__row--top {
    display: flex;
    flex-direction: column;   /* gestapelt, jedes Feld 100% */
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.dlb-filters__field--full {
    width: 100%;
}
.dlb-filters__section {
    margin-bottom: 1.25rem;
}
.dlb-filter-label {
    display: block;
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #1F4E5F;
    margin-bottom: .5rem;
}

/* ---- Input mit Icon ------------------------------------------ */
.dlb-input-wrap {
    position: relative;
}
.dlb-input-wrap--icon .dlb-input-icon {
    position: absolute;
    left: .75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
}
.dlb-input-wrap--icon input {
    width: 100%;
    padding: .6rem .75rem .6rem 2.4rem;
    border: 1.5px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    box-sizing: border-box;
    transition: border-color .15s;
}
.dlb-input-wrap--icon input:focus {
    outline: none;
    border-color: #1F4E5F;
    box-shadow: 0 0 0 3px rgba(31,78,95,.12);
}

/* ---- Chip-Buttons (Handlungsfeld / Thema) -------------------- */
.dlb-chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}
.dlb-chip {
    /* Alle Chips gleich breit: feste min-width, kein flex-grow auf Text */
    min-width: 140px;
    padding: .5rem .9rem;
    border: 1.5px solid #ccd6da;
    border-radius: 6px;
    background: #f5f8f9;
    color: #1F4E5F;
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background .12s, border-color .12s, color .12s;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dlb-chip:hover {
    border-color: #1F4E5F;
    background: #e6eff2;
}
.dlb-chip.is-active {
    background: #1F4E5F;
    border-color: #1F4E5F;
    color: #fff;
}
.dlb-chip--thema {
    min-width: 120px;
    font-weight: 500;
    background: #edf4f7;
    border-color: #b0cdd6;
}
.dlb-chip--thema.is-active {
    background: #2d7a8c;
    border-color: #2d7a8c;
    color: #fff;
}
.dlb-thema-section {
    padding-top: .25rem;
    border-top: 1px dashed #dde;
    margin-top: .25rem;
}

/* ---- 3-Zustand Toggle (Freiwilliges Engagement) -------------- */
.dlb-toggle3 {
    display: inline-flex;
    border: 1.5px solid #ccd6da;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f8f9;
}
.dlb-toggle3__btn {
    padding: .45rem 1.25rem;
    border: none;
    background: transparent;
    color: #555;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .12s, color .12s;
    border-right: 1px solid #dde;
}
.dlb-toggle3__btn:last-child { border-right: none; }
.dlb-toggle3__btn.is-active {
    background: #1F4E5F;
    color: #fff;
}
.dlb-toggle3__btn--mid.is-active {
    background: #8aacb5;
    color: #fff;
}
.dlb-toggle3__btn:hover:not(.is-active) {
    background: #e6eff2;
}

/* ---- Tag-Selektor (Zielgruppe) ------------------------------- */
.dlb-tag-selector {
    border: 1.5px solid #ddd;
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
}
.dlb-tag-selector__chosen {
    min-height: 42px;
    padding: .5rem .6rem;
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    align-items: center;
    border-bottom: 1px solid #eee;
}
.dlb-tag-selector__placeholder {
    color: #aaa;
    font-size: .9rem;
}
.dlb-tag-selector__options {
    padding: .5rem .6rem;
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    background: #f9fafb;
}
.dlb-tag {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .25rem .6rem;
    border-radius: 20px;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background .12s;
}
.dlb-tag--chosen {
    background: #1F4E5F;
    color: #fff;
}
.dlb-tag__remove {
    background: none;
    border: none;
    color: rgba(255,255,255,.8);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}
.dlb-tag__remove:hover { color: #fff; }
.dlb-tag--option {
    background: #edf4f7;
    color: #1F4E5F;
    border: 1px solid #b0cdd6;
}
.dlb-tag--option:hover { background: #d0e8ef; }

/* ---- Filter Aktionen ----------------------------------------- */
.dlb-filter-actions {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: .75rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
    margin-top: .5rem;
}
.dlb-filter-sort {
    display: flex;
    flex-direction: column;
    gap: .3rem;
}
.dlb-filter-sort select {
    padding: .4rem .7rem;
    border: 1.5px solid #ddd;
    border-radius: 6px;
    font-size: .9rem;
}
.dlb-filter-btns {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

/* ---- Responsive ---------------------------------------------- */
@media (max-width: 700px) {
    .dlb-filters__row--top { grid-template-columns: 1fr; }
    .dlb-chip { min-width: calc(50% - .25rem); }
    .dlb-filter-actions { flex-direction: column; align-items: stretch; }
    .dlb-filter-btns { flex-direction: column; }
}

/* ---- Status-Badge (nur für Admins/Superuser sichtbar) ------- */
.dlb-card--unpublished {
    opacity: .75;
    border-style: dashed;
}
.dlb-card__status-badge {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .04em;
    margin-bottom: .4rem;
}

/* ---- Formular: Mehrfachauswahl-Select (Zielgruppe) ----------- */
.dlb-form-row select[multiple] {
    min-height: 160px;
    padding: .4rem;
}
.dlb-form-row select[multiple] option {
    padding: .3rem .5rem;
}

/* ================================================================
   Single-Template: Dienstleistung Detailansicht
   ================================================================ */
.dlb-single-wrap {
    /* Keine feste max-width/margin mehr: die Breite soll sich ganz normal
       über die umgebenden Editor-Blöcke (Gruppe, Ausrichtung, Spalten)
       steuern lassen, statt von hier aus fest vorgegeben zu werden. */
    box-sizing: border-box;
}
.dlb-single-wrap * {
    box-sizing: border-box;
}
.dlb-single__box a,
.dlb-single-wrap a {
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Sicherheitsnetz gegen horizontales Scrollen: reines Clipping auf
   Wurzelebene, OHNE die Navigation selbst anzufassen oder umzupositionieren
   (frühere Version hier hat versehentlich auch die funktionierende
   Desktop-Navigation und das Öffnen des mobilen Menüs blockiert).
   overflow-x:hidden auf html UND body ist nötig, da manche Browser sonst
   trotzdem eine horizontale Scrollleiste durch position:fixed-Elemente
   zulassen, wenn nur body betroffen ist. */
html:has(body.single-dienstleistung) {
    overflow-x: hidden;
}
body.single-dienstleistung {
    overflow-x: hidden;
    max-width: 100%;
}
.dlb-single__back {
    margin-bottom: 1.5rem;
}
.dlb-single__back a {
    color: #1F4E5F;
    text-decoration: none;
    font-weight: 600;
    font-size: .9rem;
}
.dlb-single__back a:hover { text-decoration: underline; }

.dlb-single__header { margin-bottom: 2rem; }
.dlb-single__gemeinde {
    font-size: .82rem; color: #888; font-weight: 600;
    text-transform: uppercase; letter-spacing: .05em; margin: 0 0 .4rem;
}
.dlb-single__gemeinde a { color: inherit; text-decoration: none; }
.dlb-single__gemeinde a:hover { text-decoration: underline; }
.dlb-single__title {
    margin: 0 0 .9rem;
    font-size: 1.9rem;
    line-height: 1.2;
    color: #1F4E5F;
    overflow-wrap: break-word;
}
.dlb-single__tags {
    display: flex; flex-wrap: wrap; gap: .4rem;
}

/* Der eigentliche Inhalt kommt jetzt aus der frei editierbaren Board-Vorlage
   (siehe Einstellungen -> Allgemein -> "Vorlage im Block-Editor bearbeiten").
   Kein festes Spalten-Layout mehr – wer eine Spalten-Aufteilung möchte,
   nutzt dafür einfach den Standard-Block "Spalten" innerhalb der Vorlage. */
.dlb-single__body-flow > * + * {
    margin-top: 1.25rem;
}
/* Abstand zwischen den einzelnen Blöcken INNERHALB einer Spalte
   (Überschrift, Feld, nächste Überschrift, Feld, ...) */
.dlb-single__body-flow .wp-block-column > * + * {
    margin-top: 1rem;
}
.dlb-single__body-flow .wp-block-column > :first-child {
    margin-top: 0;
}
/* Garantiertes Stapeln auf schmalen Bildschirmen, unabhängig vom Theme */
@media (max-width: 782px) {
    .dlb-single__body-flow .wp-block-columns { flex-wrap: wrap; }
    .dlb-single__body-flow .wp-block-column {
        flex-basis: 100% !important;
        width: 100% !important;
    }
}
.dlb-single__description {
    font-size: 1rem; line-height: 1.65; color: #333;
}
.dlb-single__description p:first-child { margin-top: 0; }
.dlb-single__meta-row {
    font-size: .95rem; color: #444; margin: 0;
}

.dlb-single__box {
    background: #f7f9fa;
    border: 1px solid #e3e8ea;
    border-radius: 8px;
    padding: 1.1rem 1.25rem;
}
.dlb-single__box h2 {
    margin: 0 0 .6rem;
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #1F4E5F;
}
.dlb-single__box p { margin: 0 0 .4rem; font-size: .92rem; }
.dlb-single__box p:last-child { margin-bottom: 0; }
.dlb-single__box a { color: #1F4E5F; }
.dlb-single__box address { font-style: normal; font-size: .92rem; line-height: 1.5; }
.dlb-single__box--logo { text-align: center; padding: 1.5rem; }
.dlb-single__logo { max-width: 100%; max-height: 90px; width: auto; height: auto; object-fit: contain; }

@media (max-width: 800px) {
    .dlb-single__title { font-size: 1.5rem; }
}

/* ---- Block-Editor: Live-Vorschau unserer eigenen Blocks ------- */
.dlb-block-editor-preview {
    border: 1px dashed #c3d9ef;
    border-radius: 6px;
    padding: .75rem 1rem;
}

/* ---- Info-Icon mit Tooltip im Angebots-Formular --------------- */
.dlb-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.1rem;
    height: 1.1rem;
    margin-left: .35rem;
    border-radius: 50%;
    background: #1F4E5F;
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    font-style: italic;
    font-family: Georgia, 'Times New Roman', serif;
    cursor: help;
    position: relative;
    vertical-align: middle;
}
.dlb-info-icon:focus {
    outline: 2px solid #1F4E5F;
    outline-offset: 2px;
}
.dlb-info-icon__tooltip {
    position: absolute;
    bottom: 140%;
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: #1a1a1a;
    color: #fff;
    font-style: normal;
    font-weight: 400;
    font-size: .8rem;
    line-height: 1.4;
    padding: .5rem .75rem;
    border-radius: 6px;
    width: max-content;
    max-width: 260px;
    white-space: normal;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .15s ease, transform .15s ease;
    z-index: 20;
}
.dlb-info-icon__tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1a1a1a;
}
/* Erscheint bei Maus-Hover UND bei Tastatur-Fokus (Tab-Taste) –
   funktioniert dadurch auch ohne Maus und auf Touch-Geräten beim Antippen. */
.dlb-info-icon:hover .dlb-info-icon__tooltip,
.dlb-info-icon:focus .dlb-info-icon__tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}
