/* ═══════════════════════════════════════════
   Family Genealogy Plugin — Front-end CSS
   ═══════════════════════════════════════════ */

:root {
    --fg-primary:   #2c5f2e;
    --fg-primary-h: #1e4220;
    --fg-accent:    #97bc62;
    --fg-danger:    #c0392b;
    --fg-bg:        #f9f6f0;
    --fg-card:      #ffffff;
    --fg-border:    #e0d8c8;
    --fg-text:      #2d2d2d;
    --fg-muted:     #7a7a7a;
    --fg-radius:    12px;
    --fg-shadow:    0 2px 12px rgba(0,0,0,.08);
}

/* ── Base ── */
.fg-container { max-width: 900px; margin: 2rem auto; padding: 0 1rem; }
.fg-card { background: var(--fg-card); border: 1px solid var(--fg-border); border-radius: var(--fg-radius); padding: 2rem; box-shadow: var(--fg-shadow); }
.fg-card-header { text-align: center; margin-bottom: 1.5rem; }
.fg-card-header h1 { margin: 0 0 .5rem; font-size: 1.6rem; color: var(--fg-primary); }
.fg-card-footer { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--fg-border); text-align: center; font-size: .9rem; color: var(--fg-muted); }

/* ── Alertes ── */
.fg-alert { padding: .8rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.fg-alert-success { background: #eafaee; border: 1px solid #a8d5ae; color: #1a5c28; }
.fg-alert-error   { background: #faeaea; border: 1px solid #e0a0a0; color: #8b1a1a; }

/* ── Formulaires ── */
.fg-form { display: flex; flex-direction: column; gap: 1rem; }
.fg-field { display: flex; flex-direction: column; gap: .3rem; }
.fg-field label { font-weight: 600; font-size: .9rem; color: var(--fg-text); }
.fg-field input, .fg-field select, .fg-field textarea {
    border: 1px solid var(--fg-border);
    border-radius: 8px;
    padding: .6rem .9rem;
    font-size: 1rem;
    transition: border-color .2s;
    width: 100%;
    box-sizing: border-box;
}
.fg-field input:focus, .fg-field select:focus, .fg-field textarea:focus {
    border-color: var(--fg-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(44,95,46,.15);
}
.fg-field small { font-size: .8rem; color: var(--fg-muted); }
.fg-required { color: var(--fg-danger); }
.fg-field-inline { flex-direction: row; align-items: center; }

/* ── Boutons ── */
.fg-btn {
    display: inline-block;
    padding: .7rem 1.4rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    text-align: center;
    transition: all .2s;
}
.fg-btn-primary { background: var(--fg-primary); color: #fff; }
.fg-btn-primary:hover { background: var(--fg-primary-h); color: #fff; }
.fg-btn-secondary { background: transparent; color: var(--fg-primary); border: 2px solid var(--fg-primary); }
.fg-btn-secondary:hover { background: var(--fg-primary); color: #fff; }
.fg-btn-danger-outline { background: transparent; color: var(--fg-danger); border: 2px solid var(--fg-danger); }

/* ── Badges ── */
.fg-badge {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.fg-badge-active    { background: #d4edda; color: #155724; }
.fg-badge-invited   { background: #d1ecf1; color: #0c5460; }
.fg-badge-unclaimed { background: #fff3cd; color: #856404; }
.fg-badge-deceased  { background: #e2e3e5; color: #383d41; }

/* ── Profil ── */
.fg-profile-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    background: var(--fg-card);
    padding: 2rem;
    border-radius: var(--fg-radius);
    border: 1px solid var(--fg-border);
    margin-bottom: 1.5rem;
    box-shadow: var(--fg-shadow);
}
.fg-profile-avatar img, .fg-profile-avatar .fg-avatar-placeholder {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 3px solid var(--fg-border);
}
.fg-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--fg-primary);
    color: #fff;
    font-size: 2rem;
    font-weight: 700;
}
.fg-profile-meta h1 { margin: 0 0 .3rem; font-size: 1.8rem; }
.fg-genealogy-id { color: var(--fg-muted); font-size: .9rem; }
.fg-profile-dates { display: flex; flex-direction: column; gap: .2rem; margin: .5rem 0; font-size: .9rem; }
.fg-deceased, .fg-deceased-badge { color: #555; margin-left: .3rem; }

/* ── Onglets ── */
.fg-tabs { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.fg-tab {
    padding: .5rem 1.2rem;
    border: 2px solid var(--fg-border);
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    font-size: .9rem;
    font-weight: 600;
    transition: all .15s;
}
.fg-tab.active { background: var(--fg-primary); color: #fff; border-color: var(--fg-primary); }
.fg-tab-content { display: none; background: var(--fg-card); border: 1px solid var(--fg-border); border-radius: var(--fg-radius); padding: 1.5rem; }
.fg-tab-content.active { display: block; }

/* ── Relations ── */
.fg-relations-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }
.fg-relation-group h3 { margin: 0 0 .8rem; font-size: 1rem; color: var(--fg-muted); text-transform: uppercase; letter-spacing: .05em; }
.fg-relation-group--wide { grid-column: 1 / -1; }
.fg-children-grid { display: flex; flex-wrap: wrap; gap: .8rem; }
.fg-relation-card {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .7rem;
    border: 1px solid var(--fg-border);
    border-radius: 10px;
    text-decoration: none;
    color: var(--fg-text);
    transition: all .15s;
    background: var(--fg-bg);
}
.fg-relation-card:hover { border-color: var(--fg-primary); box-shadow: 0 2px 8px rgba(44,95,46,.15); }
.fg-relation-card img, .fg-relation-avatar-wrap img { border-radius: 50%; width:40px; height:40px; object-fit:cover; }
.fg-relation-info { display: flex; flex-direction: column; }
.fg-relation-info strong { font-size: .9rem; }
.fg-relation-info small { color: var(--fg-muted); font-size: .8rem; }

/* ── Articles ── */
.fg-articles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.2rem; }
.fg-article-card { border: 1px solid var(--fg-border); border-radius: 10px; overflow: hidden; }
.fg-article-card img { width: 100%; height: 140px; object-fit: cover; }
.fg-article-meta { padding: .8rem; }
.fg-article-meta h4 { margin: 0 0 .3rem; font-size: .95rem; }
.fg-article-meta time { font-size: .8rem; color: var(--fg-muted); }

/* ── Sections profil ── */
.fg-section { margin-bottom: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--fg-border); }
.fg-section:last-child { border-bottom: none; }
.fg-account-info dl { display: grid; grid-template-columns: auto 1fr; gap: .4rem 1rem; }
.fg-account-info dt { font-weight: 600; color: var(--fg-muted); }
.fg-info-box { background: var(--fg-bg); padding: .6rem 1rem; border-radius: 8px; border: 1px solid var(--fg-border); }
.fg-admin-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1rem; }

/* ── Arbre ── */
.fg-tree-page { max-width: 1100px; }
.fg-tree-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }
.fg-tree-controls { display: flex; gap: .5rem; }
.fg-tree-controls input, .fg-tree-controls select { padding: .5rem .8rem; border: 1px solid var(--fg-border); border-radius: 8px; }
.fg-members-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .8rem; }
.fg-tree-card {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .8rem 1rem;
    background: var(--fg-card);
    border: 1px solid var(--fg-border);
    border-radius: 10px;
    cursor: pointer;
    transition: all .15s;
}
.fg-tree-card:hover { border-color: var(--fg-primary); box-shadow: var(--fg-shadow); }
.fg-tree-card.fg-status-deceased { opacity: .7; }
.fg-tree-card-avatar img, .fg-tree-card-avatar .fg-avatar-placeholder { width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; }
.fg-avatar-sm { font-size: .9rem; font-weight: 700; }
.fg-tree-card-info { flex: 1; display: flex; flex-direction: column; }
.fg-tree-card-info strong { font-size: .95rem; }
.fg-tree-card-info small { font-size: .8rem; color: var(--fg-muted); }
.fg-tree-card-status { flex-shrink: 0; }

/* ── Panel latéral ── */
.fg-member-panel {
    position: fixed;
    right: 0; top: 0; bottom: 0;
    width: 360px;
    background: #fff;
    box-shadow: -4px 0 20px rgba(0,0,0,.15);
    overflow-y: auto;
    padding: 2rem;
    z-index: 9999;
}
.fg-panel-close { position: absolute; top: 1rem; right: 1rem; background: none; border: none; font-size: 1.2rem; cursor: pointer; }
.fg-panel-header { margin-bottom: 1rem; }
.fg-panel-avatar { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; margin-bottom: .5rem; }
.fg-panel-relations { list-style: none; padding: 0; }
.fg-panel-relations li { padding: .4rem 0; border-bottom: 1px solid var(--fg-border); font-size: .9rem; }
.fg-relation-type { color: var(--fg-muted); font-size: .8rem; display: block; }
.fg-panel-loading { color: var(--fg-muted); text-align: center; padding: 2rem; }

/* ── Login page ── */
.fg-login-page { max-width: 440px; }
.fg-login-page .fg-card { max-width: 440px; margin: 0 auto; }
.fg-reset-form { margin-top: 1rem; }

/* ── Utilitaires ── */
.fg-empty { color: var(--fg-muted); font-style: italic; padding: 1rem 0; }

/* ── Responsive ── */
@media (max-width: 640px) {
    .fg-profile-header { flex-direction: column; text-align: center; }
    .fg-member-panel { width: 100%; }
    .fg-tree-toolbar { flex-direction: column; align-items: flex-start; }
}

/* ── Panneau édition inline ─────────────────────────────────────────── */
.fg-btn-edit-trigger {
    margin-top: .7rem;
    background: #f0f6e8;
    border: 1.5px solid #2c5f2e;
    color: #2c5f2e;
    border-radius: 8px;
    padding: .4rem 1rem;
    cursor: pointer;
    font-size: .875rem;
    font-weight: 600;
    transition: all .15s;
    display: inline-block;
}
.fg-btn-edit-trigger:hover { background: #2c5f2e; color: #fff; }

.fg-edit-panel {
    background: #fff;
    border: 2px solid #2c5f2e;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1rem 0;
    box-shadow: 0 4px 24px rgba(44,95,46,.12);
}
.fg-edit-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
    padding-bottom: .8rem;
    border-bottom: 1px solid #e8e8e8;
}
.fg-edit-panel-header h3 { margin: 0; font-size: 1.1rem; color: #2c5f2e; }
.fg-edit-close {
    background: #f5f5f5;
    border: none;
    border-radius: 50%;
    width: 30px; height: 30px;
    cursor: pointer;
    font-size: 1rem;
    display: flex; align-items: center; justify-content: center;
}

.fg-edit-section {
    margin-bottom: 1.2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f0f0f0;
}
.fg-edit-section:last-child { border-bottom: none; }
.fg-edit-section h4 {
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #888;
    margin: 0 0 .8rem;
}

.fg-edit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: .7rem;
}
.fg-edit-field { display: flex; flex-direction: column; gap: .25rem; }
.fg-edit-field--wide { grid-column: span 2; }
.fg-edit-field--full { grid-column: 1 / -1; }
.fg-edit-field label { font-size: .78rem; font-weight: 600; color: #555; }
.fg-edit-field input,
.fg-edit-field select,
.fg-edit-field textarea {
    border: 1.5px solid #ddd;
    border-radius: 6px;
    padding: .4rem .6rem;
    font-size: .875rem;
    width: 100%;
    box-sizing: border-box;
    transition: border-color .15s;
}
.fg-edit-field input:focus,
.fg-edit-field select:focus,
.fg-edit-field textarea:focus { border-color: #2c5f2e; outline: none; }

.fg-edit-avatar-row { display: flex; align-items: center; gap: 1rem; }
.fg-edit-avatar-preview {
    width: 70px; height: 70px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ddd;
}
.fg-edit-hint { font-size: .75rem; color: #999; margin: .3rem 0 0; }

.fg-add-relation-form {
    background: #f8fff8;
    border: 1px solid #c8e6c9;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: .8rem;
}

.fg-edit-actions {
    display: flex;
    gap: .7rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

/* History table */
.fg-history-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.fg-history-table th, .fg-history-table td { padding: .4rem .6rem; border-bottom: 1px solid #eee; text-align: left; }
.fg-history-table th { background: #f8f9fa; font-weight: 600; }

.fg-badge-green { background: #d4edda; color: #155724; }
.fg-badge-orange { background: #fff3cd; color: #856404; }
.fg-badge-red { background: #f8d7da; color: #721c24; }
.fg-badge-grey { background: #e2e3e5; color: #383d41; }

/* ── Branch colors ──────────────────────────────────────────── */
.fg-branch-banner {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: .875rem;
}
.fg-branch-swatch {
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,.15);
    flex-shrink: 0;
    display: inline-block;
}
.fg-branch-name { font-weight: 500; color: #374151; }
.fg-branch-gen  { color: #6b7280; }

.fg-branch-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-left: .3rem;
    vertical-align: middle;
    flex-shrink: 0;
}

/* ── Branch legend ──────────────────────────────────────────── */
.fg-branch-legend-row {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    padding: .5rem 0;
    border-bottom: 1px solid #e8e8e8;
    margin-bottom: .8rem;
}
.fg-legend-item {
    display: flex;
    align-items: center;
    gap: .3rem;
    font-size: .75rem;
    color: #555;
    background: #f9f9f9;
    border-radius: 20px;
    padding: .2rem .6rem;
}
.fg-legend-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* ── Lien d'aide ────────────────────────────────────────────── */
.fg-help-link {
    margin-top: .8rem;
    padding-top: .8rem;
    border-top: 1px solid #f0f0f0;
    font-size: .85rem;
    color: #888;
}
.fg-help-link a {
    color: #6b7280;
    text-decoration: none;
    border-bottom: 1px dashed #d1d5db;
}
.fg-help-link a:hover { color: #374151; border-bottom-color: #6b7280; }

/* ── Formulaire d'aide ──────────────────────────────────────── */
.fg-help-section {
    margin-top: 1.5rem;
    border-top: 1px solid #f0f0f0;
    padding-top: 1rem;
}
.fg-help-toggle {
    background: none;
    border: none;
    padding: 0;
    font-size: .875rem;
    color: #6b7280;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dashed;
    text-underline-offset: 3px;
}
.fg-help-toggle:hover { color: #374151; }
.fg-help-form-wrap {
    margin-top: 1rem;
    background: #f8f9fa;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 1rem;
}
.fg-help-intro { font-size: .85rem; color: #555; margin-bottom: .8rem; }
.fg-help-field { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .7rem; }
.fg-help-field label { font-size: .78rem; font-weight: 600; color: #555; }
.fg-help-field input,
.fg-help-field textarea {
    border: 1.5px solid #ddd;
    border-radius: 6px;
    padding: .4rem .6rem;
    font-size: .875rem;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
}
.fg-help-field input:focus,
.fg-help-field textarea:focus { border-color: #2c5f2e; outline: none; }

/* ── Shortcode anniversaires ──────────────────────────────── */
.fg-birthdays { margin: 1rem 0; }
.fg-birthdays-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: .8rem;
    color: #1f2937;
}
.fg-birthdays-empty { color: #888; font-style: italic; }
.fg-birthdays-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .4rem;
}
.fg-birthday-item { border-radius: 8px; overflow: hidden; }
.fg-birthday-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem .8rem;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: all .15s;
    position: relative;
}
.fg-birthday-link:hover {
    border-color: #2c5f2e;
    box-shadow: 0 2px 8px rgba(44,95,46,.08);
    transform: translateX(2px);
}
.fg-birthday-avatar img,
.fg-birthday-avatar-initials {
    width: 40px; height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .85rem;
}
.fg-birthday-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .1rem;
}
.fg-birthday-name {
    font-weight: 600;
    font-size: .9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fg-birthday-age {
    font-size: .78rem;
    color: #6b7280;
}
.fg-birthday-branch { font-size: .75rem; }
.fg-birthday-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.fg-birthday-item.fg-status-deceased .fg-birthday-link {
    opacity: .7;
    background: #f9f9f9;
}
