/*
 * Styles pour la page single (individu + lieu).
 * VERSION RESPONSIVE MOBILE-FIRST
 */

/* ── Tables ─────────────────────────────────────────────────────────────── */
.wpg-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2em;
}
.wpg-table th,
.wpg-table td {
    padding: 8px 12px;
    border: 1px solid #ddd;
    text-align: left;
    vertical-align: top;
}
.wpg-table th {
    /* Pas de width fixe : s'adapte au contenu */
    background-color: #f7f7f7;
    font-weight: bold;
    white-space: nowrap;
}
.wpg-table ul {
    margin: 0;
    padding-left: 20px;
    list-style-type: disc;
}

/* Wrapper scroll horizontal — sur mobile la table défile plutôt que de déborder */
.wpg-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 2em;
}
.wpg-table-wrap .wpg-table {
    margin-bottom: 0;
    min-width: 280px;
}

/* ── Notes & sources ─────────────────────────────────────────────────────── */
.wpg-notes-content,
.wpg-sources-list {
    margin-bottom: 2em;
}
.wpg-source-entry {
    border: 1px solid #e0e0e0;
    border-left: 4px solid #0073aa;
    padding: 10px 15px;
    margin-bottom: 1em;
    background: #fdfdfd;
}
.wpg-source-entry .source-title {
    font-weight: bold;
    margin-top: 0;
}
.wpg-source-entry .source-details dt {
    font-weight: 600;
    display: inline;
}
.wpg-source-entry .source-details dd {
    display: inline;
    margin-left: 5px;
}
.wpg-source-entry .source-details dt::after {
    content: ':';
}
.wpg-source-entry .source-details dd::after {
    content: '';
    display: block;
}
.event-note {
    margin-top: 8px;
    padding-left: 15px;
    border-left: 2px solid #ddd;
    color: #666;
    font-size: 0.9em;
}

/* ── Bouton retour ───────────────────────────────────────────────────────── */
.wpg-back-button {
    margin-bottom: 1.5em;
    display: inline-block;
    padding: 10px 14px;
    background-color: var(--wpg-btn-bg, #f0f0f0);
    color: var(--wpg-btn-color, #333);
    border: 1px solid transparent;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    min-height: 44px;
    line-height: 1.4;
    transition: filter .18s ease, background-color .18s ease;
}
.wpg-back-button:hover {
    filter: brightness(0.85);
    cursor: pointer;
}

/* ── Carte commune individu + lieu ──────────────────────────────────────── */
.wpg-card {
    background: #fff;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border: 1px solid #eee;
}

/* ── Page Lieu ───────────────────────────────────────────────────────────── */
.wpg-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px;
    box-sizing: border-box;
}
.wpg-lieu-header {
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 16px;
}
.wpg-lieu-meta-badges {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.wpg-lieu-meta-badges .badge {
    background: #eef1f6;
    color: #555;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9em;
    border: 1px solid #ddd;
}

/* Grille 2 colonnes — 1 colonne sur mobile */
.wpg-grid-2-cols {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.wpg-lieu-event-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.wpg-lieu-event-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
    flex-wrap: wrap;
}
.wpg-lieu-event-list li:last-child {
    border-bottom: none;
}
.wpg-event-date {
    background: #f0f0f1;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.9em;
    color: #555;
    flex-shrink: 0;
}
.wpg-lieu-note {
    margin-top: 16px;
    padding: 12px 15px;
    background: #fffbe6;
    border-left: 4px solid #fcd34d;
}
.wpg-lieu-pagination {
    margin-top: 20px;
    text-align: center;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
}
.wpg-lieu-pagination .page-numbers {
    display: inline-block;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #555;
    min-height: 40px;
    line-height: 1.4;
}
.wpg-lieu-pagination .page-numbers.current {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

/* ── Carte Leaflet ───────────────────────────────────────────────────────── */
#wpg-map-wrapper {
    position: relative;
    height: 260px;    /* plus compact sur mobile */
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #ddd;
}
#wpg-map-lieu {
    height: 100%;
    width: 100%;
    z-index: 1;
}
#wpg-map-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.9);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
#wpg-map-status {
    margin-top: 10px;
    font-size: 0.9em;
    color: #666;
    font-style: italic;
    min-height: 20px;
}

.wpg-spin {
    animation: wpg-spin 1.5s infinite linear;
}
@keyframes wpg-spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ── Uniformisation boutons ─────────────────────────────────────────────── */
.button,
.button-primary,
.button-secondary,
.button-large,
.button-hero {
    font-size:        var(--wpg-btn-fs,   12px) !important;
    line-height:      var(--wpg-btn-lh,   22px) !important;
    min-height:       var(--wpg-btn-minh, 26px) !important;
    height: auto !important;
    padding:          var(--wpg-btn-pad,  0 8px) !important;
    background-color: var(--wpg-btn-bg,   #f0f0f0) !important;
    color:            var(--wpg-btn-color, #333)   !important;
    font-family:      var(--wpg-font-family, inherit);
}

/* ── Typographie interface publique ─────────────────────────────────────── */
.wpg-translucent-container,
.wpg-tree-container,
.wpg-search-container,
#wpg-kinship-calculator {
    font-family: var(--wpg-font-family, inherit);
    color:       var(--wpg-text-color,  #1d2327);
}
.wpg-back-button {
    background-color: var(--wpg-btn-bg,    #f0f0f0) !important;
    color:            var(--wpg-btn-color,  #333)    !important;
    font-family:      var(--wpg-font-family, inherit);
}

/* ────────────────────────────────────────────────
   Tablette ≥ 600px
   ──────────────────────────────────────────────── */
@media (min-width: 600px) {
    .wpg-container {
        padding: 20px;
    }
    .wpg-card {
        padding: 20px;
    }
    #wpg-map-wrapper {
        height: 340px;
    }
    .wpg-table th {
        width: 28%;   /* largeur raisonnable tablette */
    }
}

/* ────────────────────────────────────────────────
   Desktop ≥ 900px : 2 colonnes pour les lieux
   ──────────────────────────────────────────────── */
@media (min-width: 900px) {
    .wpg-grid-2-cols {
        grid-template-columns: 2fr 1fr;
        gap: 30px;
    }
    #wpg-map-wrapper {
        height: 400px;
    }
    .wpg-table th {
        width: 25%;
    }
}
