/* ==========================================================================
   Personendatenbank – Frontend Styles
   ========================================================================== */

/* ---------- Layout ---------- */

#afpdb-person,
#afpdb-family,
#afpdb-person-index,
#afpdb-family-index {
    max-width: 800px;
    margin: 0 auto;
    padding: 1.5em 1em;
}

#afpdb-person h1,
#afpdb-family h1,
#afpdb-person-index h1,
#afpdb-family-index h1 {
    margin-bottom: 0.75em;
}

/* ---------- Sections (person/family detail) ---------- */

#afpdb-person section,
#afpdb-family section {
    margin-bottom: 2em;
}

#afpdb-person section h2,
#afpdb-family section h2 {
    font-size: 1.25em;
    margin-bottom: 0.5em;
    border-bottom: 1px solid #ddd;
    padding-bottom: 0.3em;
}

#afpdb-person section ul,
#afpdb-family section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#afpdb-person section ul li,
#afpdb-family section ul li {
    padding: 0.35em 0;
}

/* ---------- Media gallery ---------- */

#afpdb-person section ul li img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* ---------- Citations (nested) ---------- */

#afpdb-person section ul ul,
#afpdb-family section ul ul {
    margin-left: 1.5em;
    margin-top: 0.25em;
    list-style: disc;
    color: #666;
    font-size: 0.9em;
}

/* ---------- Search form ---------- */

#afpdb-person-index form,
#afpdb-family-index form,
.afpdb-person-index-shortcode form,
.afpdb-family-index-shortcode form {
    margin-bottom: 1.5em;
    display: flex;
    align-items: center;
    gap: 0.5em;
    flex-wrap: wrap;
}

#afpdb-person-index form input[type="text"],
#afpdb-family-index form input[type="text"],
.afpdb-person-index-shortcode form input[type="text"],
.afpdb-family-index-shortcode form input[type="text"] {
    padding: 0.4em 0.6em;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 1em;
    min-width: 200px;
}

#afpdb-person-index form button,
#afpdb-family-index form button,
.afpdb-person-index-shortcode form button,
.afpdb-family-index-shortcode form button {
    padding: 0.4em 1em;
    border: 1px solid #0073aa;
    background: #0073aa;
    color: #fff;
    border-radius: 3px;
    font-size: 1em;
    cursor: pointer;
}

#afpdb-person-index form button:hover,
#afpdb-family-index form button:hover,
.afpdb-person-index-shortcode form button:hover,
.afpdb-family-index-shortcode form button:hover {
    background: #005f8d;
    border-color: #005f8d;
}

/* ---------- Index lists ---------- */

#afpdb-person-index ul,
#afpdb-family-index ul,
.afpdb-person-index-shortcode ul,
.afpdb-family-index-shortcode ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#afpdb-person-index ul li,
#afpdb-family-index ul li,
.afpdb-person-index-shortcode ul li,
.afpdb-family-index-shortcode ul li {
    padding: 0.4em 0;
    border-bottom: 1px solid #f0f0f0;
}

#afpdb-person-index ul li:last-child,
#afpdb-family-index ul li:last-child,
.afpdb-person-index-shortcode ul li:last-child,
.afpdb-family-index-shortcode ul li:last-child {
    border-bottom: none;
}

#afpdb-person-index ul li a,
#afpdb-family-index ul li a,
.afpdb-person-index-shortcode ul li a,
.afpdb-family-index-shortcode ul li a {
    text-decoration: none;
    color: #0073aa;
}

#afpdb-person-index ul li a:hover,
#afpdb-family-index ul li a:hover,
.afpdb-person-index-shortcode ul li a:hover,
.afpdb-family-index-shortcode ul li a:hover {
    text-decoration: underline;
    color: #005f8d;
}

/* ---------- Pagination ---------- */

.afpdb-pagination {
    margin-top: 1.5em;
    display: flex;
    gap: 0.35em;
    flex-wrap: wrap;
    align-items: center;
}

.afpdb-pagination a,
.afpdb-pagination strong {
    display: inline-block;
    padding: 0.3em 0.7em;
    border: 1px solid #ddd;
    border-radius: 3px;
    text-decoration: none;
    font-size: 0.9em;
    color: #0073aa;
}

.afpdb-pagination strong {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

.afpdb-pagination a:hover {
    background: #f5f5f5;
    border-color: #bbb;
}

/* ---------- Shortcode cards ---------- */

.afpdb-person-shortcode,
.afpdb-family-shortcode {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 1em 1.25em;
    margin-bottom: 1em;
    background: #fafafa;
}

.afpdb-person-shortcode h2,
.afpdb-family-shortcode h2 {
    margin: 0 0 0.5em;
    font-size: 1.15em;
}

.afpdb-person-shortcode a,
.afpdb-family-shortcode a {
    color: #0073aa;
    text-decoration: none;
}

.afpdb-person-shortcode a:hover,
.afpdb-family-shortcode a:hover {
    text-decoration: underline;
}

/* ---------- Shared button ---------- */

.afpdb-btn {
    display: inline-block;
    padding: 0.45em 1.2em;
    border: 1px solid #0073aa;
    background: #0073aa;
    color: #fff;
    border-radius: 3px;
    font-size: 1em;
    cursor: pointer;
    text-decoration: none;
}

.afpdb-btn:hover {
    background: #005f8d;
    border-color: #005f8d;
    color: #fff;
}

/* ==========================================================================
   Family Tree
   ========================================================================== */

#afpdb-tree-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5em 1em;
}

.afpdb-tree-container {
    width: 100%;
    height: 600px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fdfdfd;
    overflow: hidden;
    position: relative;
}

.afpdb-tree-svg {
    display: block;
}

.afpdb-tree-link {
    fill: none;
    stroke: #aaa;
    stroke-width: 1.5px;
}

.afpdb-tree-node rect {
    fill: #fff;
    stroke: #0073aa;
    stroke-width: 1.5px;
}

.afpdb-tree-node.afpdb-tree-root rect {
    fill: #e8f4fd;
    stroke-width: 2.5px;
}

.afpdb-tree-node:hover rect {
    fill: #e8f4fd;
    stroke: #005f8d;
}

.afpdb-tree-name {
    font-size: 12px;
    font-weight: 600;
    fill: #222;
}

.afpdb-tree-dates {
    font-size: 10px;
    fill: #666;
}

/* ==========================================================================
   Timeline
   ========================================================================== */

#afpdb-timeline-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 1.5em 1em;
}

.afpdb-timeline {
    position: relative;
    padding-left: 32px;
    margin-top: 1em;
}

.afpdb-timeline::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #ddd;
}

.afpdb-tl-item {
    position: relative;
    padding-bottom: 1.8em;
}

.afpdb-tl-marker {
    position: absolute;
    left: -32px;
    top: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #0073aa;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px #0073aa;
}

.afpdb-tl-content {
    padding: 0.75em 1em;
    background: #fafafa;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
}

.afpdb-tl-badge {
    display: inline-block;
    padding: 0.15em 0.6em;
    font-size: 0.78em;
    font-weight: 600;
    background: #0073aa;
    color: #fff;
    border-radius: 3px;
    text-transform: capitalize;
}

.afpdb-tl-date {
    font-weight: 600;
    margin-left: 0.5em;
}

.afpdb-tl-place {
    color: #666;
    margin-left: 0.4em;
}

.afpdb-tl-place::before {
    content: '\1F4CD ';
}

.afpdb-tl-family {
    color: #888;
    font-style: italic;
    margin-left: 0.3em;
}

.afpdb-tl-desc {
    margin: 0.5em 0 0;
    color: #444;
}

.afpdb-tl-cit {
    margin: 0.4em 0 0 1.2em;
    font-size: 0.85em;
    color: #777;
    list-style: disc;
}

/* ==========================================================================
   Advanced Search
   ========================================================================== */

#afpdb-search-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 1.5em 1em;
}

.afpdb-adv-search-form .afpdb-search-row {
    margin-bottom: 1em;
}

.afpdb-adv-search-form .afpdb-search-row label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.3em;
}

.afpdb-adv-search-form .afpdb-search-input {
    width: 100%;
    max-width: 500px;
    padding: 0.5em 0.7em;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 1em;
}

.afpdb-search-filters {
    display: flex;
    gap: 1em;
    flex-wrap: wrap;
    margin-bottom: 1em;
}

.afpdb-filter-group {
    flex: 1 1 160px;
    max-width: 220px;
}

.afpdb-filter-group label {
    display: block;
    font-size: 0.85em;
    font-weight: 600;
    margin-bottom: 0.25em;
}

.afpdb-filter-group select,
.afpdb-filter-group .afpdb-filter-input {
    width: 100%;
    padding: 0.35em 0.5em;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 0.95em;
}

.afpdb-search-summary {
    font-weight: 600;
    margin: 1.5em 0 0.5em;
}

.afpdb-search-section {
    margin-bottom: 2em;
}

.afpdb-search-section h3 {
    border-bottom: 1px solid #ddd;
    padding-bottom: 0.3em;
    margin-bottom: 0.5em;
}

.afpdb-result-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.afpdb-result-list li {
    padding: 0.35em 0;
    border-bottom: 1px solid #f0f0f0;
}

.afpdb-result-list li:last-child {
    border-bottom: none;
}

.afpdb-result-table {
    width: 100%;
    border-collapse: collapse;
}

.afpdb-result-table th,
.afpdb-result-table td {
    padding: 0.4em 0.7em;
    border-bottom: 1px solid #eee;
    text-align: left;
}

.afpdb-result-table th {
    background: #f5f5f5;
    font-size: 0.85em;
    font-weight: 600;
}

/* ==========================================================================
   Map
   ========================================================================== */

#afpdb-map-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5em 1em;
}

.afpdb-map-container {
    width: 100%;
    height: 550px;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
}

/* ==========================================================================
   Profile Actions
   ========================================================================== */

.afpdb-profile-actions {
    display: flex;
    gap: 0.4em;
    flex-wrap: wrap;
    margin-bottom: 1.5em;
}

.afpdb-profile-actions .afpdb-btn {
    font-size: 0.85em;
    padding: 0.35em 0.9em;
}

/* ==========================================================================
   Change Request Form
   ========================================================================== */

.afpdb-cr-details {
    margin-top: 2em;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 0.75em 1em;
    background: #fafafa;
}

.afpdb-cr-details summary {
    cursor: pointer;
    font-weight: 600;
    color: #0073aa;
}

.afpdb-cr-form {
    margin-top: 0.75em;
}

.afpdb-cr-field {
    margin-bottom: 0.65em;
}

.afpdb-cr-field label {
    display: block;
    font-size: 0.85em;
    font-weight: 600;
    margin-bottom: 0.2em;
}

.afpdb-cr-field input[type="text"] {
    width: 100%;
    max-width: 400px;
    padding: 0.35em 0.5em;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 0.95em;
}

.afpdb-notice {
    padding: 0.6em 1em;
    border-radius: 4px;
    margin-bottom: 1em;
    font-size: 0.9em;
}

.afpdb-notice-success {
    background: #ecfdf5;
    border: 1px solid #6ee7b7;
    color: #065f46;
}
