/* Wrapper und Grid-Layout */
.dingremien-wrapper,
.dingremien-form,
.dingremien-form-row {
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box;
}

/* Kachel-Links */
.dingremien-kachel .dingremien-kachel-link,
.dingremien-grid .dingremien-kachel-link {
    color: var(--color-primary-text) !important;
    background: var(--color-primary);
    border-radius: 0.7em;
    display: inline-block;
    text-align: center;
    padding: 0.3em 0.8em;
    font-size: 0.95em;
    text-decoration: none;
    transition: background 0.2s;
    border: none;
}
.dingremien-kachel .dingremien-kachel-link:hover,
.dingremien-grid .dingremien-kachel-link:hover,
.dingremien-kachel .dingremien-kachel-link:focus,
.dingremien-grid .dingremien-kachel-link:focus {
    background: var(--color-secondary);
    color: var(--color-secondary-text) !important;
}

/* Grid für Kacheln */
.dingremien-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 25px !important;
    width: 100% !important;
    margin: 0 auto !important;
    box-sizing: border-box;
}
@media (max-width: 992px) {
    .dingremien-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}
@media (max-width: 768px) {
    .dingremien-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Kachel */
.dingremien-kachel {
    border: 1px solid var(--color-primary) !important;
    border-radius: 0.7em !important;
    padding: 1em !important;
    min-height: 110px !important;
    box-sizing: border-box !important;
    background: var(--color-background) !important;
    margin: 0 !important;
}
.dingremien-kachel-content {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.dingremien-kachel-name {
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 0.15em;
}
.dingremien-kachel-funktion {
    font-size: 0.98em;
    color: #444;
    margin-bottom: 0.4em;
}
.dingremien-kachel-link {
    display: inline-block;
    text-align: center;
    padding: 0.3em 0.8em;
    background: var(--color-primary);
    border-radius: 0.7em;
    font-size: 0.95em;
    text-decoration: none;
    color: var(--color-primary-text) !important;
    transition: background 0.2s;
}
.dingremien-kachel-link:hover,
.dingremien-kachel-link:focus {
    background: var(--color-secondary);
    color: var(--color-secondary-text) !important;
}
.dingremien-kachel a {
    color: var(--color-primary-text);
}
.dingremien-kachel a:hover {
    color: var(--color-secondary-text);
}

/* Formular-Design */
.dingremien-form {
    width: 100%;
    max-width: 100%;
    margin-bottom: 2.5em;
    background: #fff;
    padding: 1rem;
    border-radius: 0.7em;
}
.dingremien-form-row {
    width: 100% !important;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5em;
    box-sizing: border-box;
}
.dingremien-form-group {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.dingremien-form-group.adresse {
    flex: 5 1 0;
    min-width: 180px;
}
.dingremien-form-group.hausnummer {
    flex: 2 1 0;
    min-width: 60px;
}
.dingremien-form-group.plz {
    flex: 3 1 0;
    min-width: 90px;
}
.dingremien-form-group label {
    font-weight: 600;
    margin-bottom: 0.4em;
    color: #222;
    font-size: 1em;
    letter-spacing: 0.01em;
}
.dingremien-form-group input[type="text"],
.dingremien-form-group input[type="number"],
.dingremien-form-group input[type="email"],
.dingremien-form-group textarea,
.dingremien-form-group select {
    padding: 0.65em 1em;
    border: 1.5px solid #b9b9b9;
    border-radius: 0.6em;
    font-size: 1em;
    background: #f6f7fb;
    color: #18181b;
    outline: none;
    transition: border-color 0.2s;
    appearance: none;
    box-sizing: border-box;
}
.dingremien-form-group input:focus,
.dingremien-form-group select:focus,
.dingremien-form-group textarea:focus {
    border-color: #2c68fa;
    background: #e9f0fd;
}
.dingremien-form-group input[type="text"]:disabled {
    color: #aaa;
    background: #ececec;
}
#dingremien-gebietsuche-form button[type="submit"] {
    width: 100%;
    margin-top: 1.5em;
    padding: 0.75em 2em;
    border: none;
    border-radius: 0.7em;
    background: var(--color-primary);
    color: var(--color-primary-text);
    font-size: 1.07em;
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: pointer;
    display: block;
    box-shadow: none;
    transition: background 0.16s;
}
#dingremien-gebietsuche-form button[type="submit"]:hover,
#dingremien-gebietsuche-form button[type="submit"]:focus {
    background: var(--color-secondary);
    color: var(--color-secondary-text);
    outline: 2px solid #2245b8;
}

/* ------------------------
   Responsive Dingremien-Tabelle
   ------------------------ */
@media (max-width: 768px) {
  .dingremien-table thead {
    display: none !important;
  }
  .dingremien-table, 
  .dingremien-table tbody, 
  .dingremien-table tr, 
  .dingremien-table td {
    display: block !important;
    width: 100% !important;
  }
  .dingremien-table tr {
    margin-bottom: 1.2em !important;
    border-bottom: 1px solid #e2e5ec !important;
    padding-bottom: 0.6em !important;
  }
  .dingremien-table td {
    padding: 0.4em 0 !important;
    text-align: left !important;
    border: none !important;
    position: relative !important;
  }
  .dingremien-table td:before {
    content: attr(data-label) ": " !important;
    font-weight: 600 !important;
    display: inline-block !important;
    width: 30% !important;
    box-sizing: border-box !important;
  }
}

/* Gremien-Filter */
fieldset.dingremien-gremien-filter {
    margin-top: 1.3em;
    margin-bottom: 0.5em;
    width: 100%;
    padding: 0;
    border: none;
}
legend {
    font-weight: 600;
    margin-bottom: 0.2em;
    color: #222;
}
.dingremien-gremien-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 1em 2em;
    margin-top: 0.3em;
}
.dingremien-checkbox-label {
    display: flex;
    align-items: center;
    font-size: 1em;
    background: #f6f7fb;
    border-radius: 0.7em;
    padding: 0.45em 1.1em 0.45em 0.7em;
    margin-bottom: 0.2em;
    cursor: pointer;
    transition: background 0.16s;
    border: 1.5px solid #e5e7eb;
}
.dingremien-checkbox-label:focus-within {
    outline: 2px solid #2c68fa;
    outline-offset: 1px;
    background: #e9f0fd;
    border-color: #2c68fa;
}
.dingremien-checkbox-label input[type="checkbox"] {
    margin-right: 0.7em;
    accent-color: #326efb;
    width: 1.2em;
    height: 1.2em;
    flex-shrink: 0;
}

/* Responsive Formular */
@media (max-width: 600px) {
    .dingremien-form-row {
        flex-direction: column;
        gap: 0.8em;
    }
    .dingremien-form-group.adresse,
    .dingremien-form-group.hausnummer,
    .dingremien-form-group.plz {
        min-width: 0;
        flex: 1 1 100%;
    }
    #dingremien-gebietsuche-form button[type="submit"] {
        margin-top: 1em;
    }
    .dingremien-gremien-checkboxes {
        flex-direction: column;
        gap: 0.2em;
    }
    .dingremien-checkbox-label {
        width: 100%;
    }
}

.dingremien-form-group input:focus-visible,
.dingremien-form-group select:focus-visible {
    outline: 3px solid #2245b8;
    outline-offset: 1px;
}

/* Ergebnisbereich */
#dingremien-gebietsergebnis {
    background-color: var(--color-background);
    padding: 1em;
    border-radius: 0.7em;
    margin-bottom: 2em;
}
#dingremien-gebietsergebnis:empty {
    display: none !important;
}

/* View-Switcher Buttons */
#dingremien-view-switcher,
.dingremien-view-switcher {
    display: flex;
    justify-content: center;
    gap: 0.7em;
    margin-bottom: 1.2em;
}
.dingremien-view-btn,
.dingremien-switch-btn {
    background: var(--color-background);
    color: var(--color-background-text);
    border: 1.5px solid var(--color-primary);
    border-radius: 0.7em;
    padding: 0.5em 1.3em;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
    margin: 0 0.15em;
}
.dingremien-view-btn[aria-pressed="true"],
.dingremien-switch-btn.active {
    background: var(--color-primary);
    color: var(--color-primary-text) !important;
    border-color: #fff;
}
.dingremien-view-btn:focus,
.dingremien-switch-btn:focus {
    outline: 2.5px solid #2c68fa;
    outline-offset: 1px;
}

/* Tabelle */
.dingremien-table-wrap {
    width: 100%;
    overflow-x: auto;
    margin: 0 auto;
}
.dingremien-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}
.dingremien-table th,
.dingremien-table td {
    padding: 0.7em 1em;
    border: 1px solid #e2e5ec;
    text-align: left;
    font-size: 1em;
}
.dingremien-table th {
    background: #f3f7fb;
    font-weight: 700;
}
.dingremien-table tr:nth-child(even) {
    background: #f8fafd;
}
@media (max-width: 700px) {
    .dingremien-table th,
    .dingremien-table td {
        padding: 0.5em 0.3em;
        font-size: 0.97em;
        white-space: normal;
        word-break: break-word;
    }
}

/* Kachelansicht auf Mobile */
@media (max-width: 700px) {
    .dingremien-grid {
        grid-template-columns: 1fr !important;
    }
    .dingremien-kachel {
        flex-direction: column;
        align-items: flex-start;
        min-height: 0;
        max-width: 100%;
    }
    .dingremien-kachel-content {
        width: 100%;
    }
}

/* Ergebnis-Überschrift Abstände */
.dingremien-ergebnisheading.is-first {
    margin-top: 0;
    margin-bottom: 0.5em;
}
.dingremien-ergebnisheading:not(.is-first) {
    margin-top: 1em;
    margin-bottom: 0.5em;
}

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

/* ------------------------------------
   Kontakt-Formular: gleiche Form-Klassen
   ------------------------------------ */
.contact-form .dingremien-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5em;
    margin-bottom: 1em;
}
.contact-form .dingremien-form-group {
    flex: 1 1 0;
    min-width: 180px;
}
.contact-form .dingremien-form-group.full {
    flex: 1 1 100%;
}
.contact-form .checkbox-row {
    display: flex;
    align-items: center;
}
.contact-form .privacy {
    display: flex;
    align-items: center;
    gap: 0.6em;
}
.contact-form textarea {
    min-height: 8em;
    resize: vertical;
}
.contact-form .dingremien-submit {
    width: 100%;
    margin-top: 1em;
}

/* Mobile für Kontakt-Formular */
@media (max-width: 600px) {
    .contact-form .dingremien-form-row {
        flex-direction: column;
        gap: 0.8em;
    }
    .contact-form .dingremien-form-group {
        flex: 1 1 100%;
    }
    .contact-form .dingremien-submit {
        margin-top: 0.5em;
    }
}

/* Kontakt-Formular: Button wie im Such-Formular */
.contact-form button[type="submit"],
.contact-form .dingremien-submit {
  width: 100%;
  margin-top: 1.5em;
  padding: 0.75em 2em;
  border: none;
  border-radius: 0.7em;
  background: var(--color-primary);
  color: var(--color-primary-text);
  font-size: 1.07em;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  display: block;
  box-shadow: none;
  transition: background 0.16s;
}
.contact-form button[type="submit"]:hover,
.contact-form button[type="submit"]:focus,
.contact-form .dingremien-submit:hover,
.contact-form .dingremien-submit:focus {
  background: var(--color-secondary);
  color: var(--color-secondary-text);
  outline: 2px solid #2245b8;
}