/* =========================================================
   FAMILIENÜBERSICHT – FRONTEND
   ========================================================= */

.family-page {
    max-width: 1100px;
    margin: 30px auto;
    padding: 0 15px;
    box-sizing: border-box;
}

.family-page h1 {
    margin-bottom: 12px;
}

.family-page h2 {
    margin-top: 0;
}

/* Navigation */

.family-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 15px 0 28px;
}

.family-nav a {
    padding: 7px 10px;
    border: 1px solid #ddd;
    text-decoration: none;
}

.family-edit-link {
    font-weight: bold;
}

/* Einleitung */

.family-intro {
    border: 1px solid #ddd;
    padding: 22px;
    margin: 0 0 22px;
    line-height: 1.75;
	text-align:justify;
}

.family-intro h1,
.family-intro h2 {
    margin-top: 0;
}

/* Filter */

.family-filter-panel {
    border: 1px solid #ddd;
    padding: 18px;
    margin: 0 0 22px;
}

.family-filter-tools {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(180px, 260px) auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 18px;
}

.family-filter-tools label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
}

.family-filter-tools input,
.family-filter-tools select {
    width: 100%;
    box-sizing: border-box;
}

.family-filter-reset {
    white-space: nowrap;
}

.family-type-filters {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.family-type-filter {
    display: grid;
    grid-template-columns: 170px 1fr;
    gap: 12px;
    align-items: start;
}

.family-type-filter-title {
    font-weight: bold;
    padding-top: 7px;
}

.family-type-filter-values {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.family-filter-chip {
    border: 1px solid #ccc;
    background: transparent;
    padding: 6px 9px;
    cursor: pointer;
    font: inherit;
}

.family-filter-chip:hover,
.family-filter-chip.active {
    background: #eee;
}

.family-filter-chip.active {
    font-weight: bold;
}

.family-filter-summary {
    margin-top: 14px;
    font-size: 12px;
    opacity: .7;
}

.family-no-results {
    border: 1px dashed #ccc;
    padding: 18px;
    text-align: center;
    display: none;
}

.family-muted {
    opacity: .65;
}

/* Familienübersicht */

.family-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 18px;
    align-items: start;
}

.family-card,
.family-box {
    border: 1px solid #ddd;
    padding: 18px;
    box-sizing: border-box;
}

.family-card {
    min-width: 0;
}

.family-card[hidden] {
    display: none !important;
}

.family-card h3 {
    margin: 0 0 10px;
    padding: 8px 10px;
    border-top: 1px solid currentColor;
    border-bottom: 1px solid currentColor;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-size: 14px;
}

.family-card h3 a {
    text-decoration: none;
}

.family-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 12px;
}

.family-tag {
    display: inline-block;
    padding: 4px 7px;
    border: 1px solid #ddd;
    font-size: 12px;
}

.family-card-members {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 12px 0 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e7e7e7;
    font-size: 12px;
}

.family-card-members i {
    opacity: .7;
}

.family-card-fields {
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.family-card-field {
    min-width: 0;
}

.family-card-field-title {
    margin-bottom: 3px;
    font-weight: 700;
    font-size: 12px;
}

.family-card-field-content {
    line-height: 1.58;
    overflow-wrap: anywhere;
    word-break: normal;
}

.family-card-field-content br {
    content: "";
    display: block;
    margin-bottom: .35em;
}

/* Detailansicht */

.family-detail-stack {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.family-classification-box,
.family-information-box,
.family-members-box {
    width: 100%;
}

.family-box h2 {
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #ddd;
}

.family-field {
    margin: 0;
    padding: 0 0 18px;
}

.family-field + .family-field {
    padding-top: 18px;
    border-top: 1px solid #eee;
}

.family-field:last-child {
    padding-bottom: 0;
}

.family-field-title {
    font-weight: 700;
    margin-bottom: 6px;
}

.family-field-content {
    max-width: 90ch;
    line-height: 1.72;
    overflow-wrap: anywhere;
    word-break: normal;
}

.family-field-content br {
    content: "";
    display: block;
    margin-bottom: .4em;
}

/* Mitglieder */

.family-member-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

.family-member {
    border: 1px solid #ddd;
    padding: 12px;
}

.family-responsible {
    margin-top: 5px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    opacity: .65;
}

/* Frontend-Bearbeitung */

.family-form-section {
    border: 1px solid #ddd;
    padding: 18px;
    margin: 0 0 18px;
}

.family-form-section h2 {
    margin-top: 0;
}

.family-form-row {
    margin-bottom: 16px;
}

.family-form-row > label,
.family-form-label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
}

.family-form-row input[type="text"],
.family-form-row textarea,
.family-form-row select,
.family-form-control {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.family-form-textarea {
    line-height: 1.55;
    resize: vertical;
}

.family-form-multiselect {
    min-height: 130px;
}

.family-option-label {
    display: block;
    margin: 4px 0;
}

.family-error {
    border: 1px solid #b44;
    padding: 12px;
    margin-bottom: 16px;
}

.family-success {
    border: 1px solid #4a4;
    padding: 12px;
    margin-bottom: 16px;
}

/* Mitglieder-Autocomplete */

.family-member-picker {
    position: relative;
}

.family-member-search-input {
    width: 100%;
    box-sizing: border-box;
}

.family-member-results {
    position: absolute;
    z-index: 100;
    background: #fff;
    border: 1px solid #ccc;
    left: 0;
    right: 0;
    max-height: 230px;
    overflow: auto;
    display: none;
}

.family-member-result {
    padding: 8px 10px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

.family-member-result:hover {
    background: #f3f3f3;
}

.family-selected-members {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
}

.family-member-chip {
    display: flex;
    gap: 8px;
    align-items: center;
    border: 1px solid #ddd;
    padding: 7px 9px;
}

.family-member-chip button {
    margin-left: auto;
}

.family-self-lock {
    font-size: 11px;
    opacity: .65;
}

/* Beziehungen */

.family-relations-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 12px;
    margin-bottom: 30px;
}

.family-relation {
    border: 1px solid #ddd;
    border-top: 3px solid var(--relation-color, #999);
    padding: 14px;
}

.family-relation-type {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    opacity: .65;
}

.family-relation-type i {
    margin-right: 5px;
}

.family-relation-name {
    display: block;
    margin: 4px 0 8px;
    font-size: 17px;
    font-weight: bold;
}

.family-relation-description {
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.family-network {
    border: 1px solid #ddd;
    overflow: hidden;
    min-height: 620px;
}

.family-network svg {
    display: block;
    width: 100%;
    height: 620px;
}

.family-network-edge {
    stroke: #aaa;
    stroke-width: 2;
    opacity: .75;
}

.family-network-edge-labelbox {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 3px 6px;
    background: rgba(255,255,255,.92);
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 11px;
    white-space: nowrap;
    box-sizing: border-box;
}

.family-network-edge-labelbox i {
    font-size: 12px;
}

.family-network-node {
    cursor: pointer;
}

.family-network-node circle {
    fill: #fff;
    stroke: #777;
    stroke-width: 2;
}

.family-network-node.center circle {
    stroke-width: 4;
}

.family-network-node text {
    text-anchor: middle;
    dominant-baseline: middle;
    font-size: 12px;
    font-weight: bold;
    pointer-events: none;
}

/* Responsive */

@media (max-width: 700px) {
    .family-filter-tools {
        grid-template-columns: 1fr;
    }

    .family-type-filter {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .family-type-filter-title {
        padding-top: 0;
    }

    .family-grid {
        grid-template-columns: 1fr;
    }
}
