/* ========================================
   MODAL DE SÉLECTION DES LIEUX
   ======================================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.8rem;
    color: #2c3e50;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: #f5f5f5;
    color: #333;
}

.modal-body {
    padding: 24px;
}

.modal-subtitle {
    color: #666;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ========================================
   GRILLE DES LIEUX
   ======================================== */

.places-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.place-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
}

.place-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-color: #8b4513;
}

.place-image {
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: #f5f5f5;
}

.place-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.place-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: #ccc;
}

.place-info {
    padding: 16px;
}

.place-info h3 {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    color: #2c3e50;
}

.place-info p {
    margin: 0 0 4px 0;
    color: #666;
    font-size: 0.9rem;
}

.place-relation {
    margin: 8px 0 0 0 !important;
    color: #8b4513 !important;
    font-size: 0.85rem !important;
    font-weight: 500;
}

/* ========================================
   CARTES D'ANCÊTRES
   ======================================== */

.ancestor-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.ancestor-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-color: #8b4513;
}

.ancestor-card.selected {
    border-color: #8b4513;
    border-width: 3px;
    box-shadow: 0 8px 20px rgba(139, 69, 19, 0.3);
}

.ancestor-photo {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #f5f5f5;
}

.ancestor-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ancestor-info {
    padding: 16px;
}

.ancestor-name {
    margin: 0 0 8px 0;
    font-size: 1.2rem;
    color: #2c3e50;
}

.ancestor-dates {
    margin: 0 0 8px 0;
    color: #666;
    font-size: 0.9rem;
}

.ancestor-place {
    margin: 0;
    color: #8b4513;
    font-size: 0.85rem;
}

.ancestor-select-icon {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: #8b4513;
    color: white;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
}

.ancestor-card.selected .ancestor-select-icon {
    display: flex;
}

/* ========================================
   MESSAGES
   ======================================== */

.error-message,
.info-message {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 12px;
    grid-column: 1 / -1;
}

.error-message {
    border: 2px solid #ff4444;
    color: #ff4444;
}

.info-message {
    border: 2px solid #4CAF50;
    color: #4CAF50;
}

.error-message p,
.info-message p {
    margin: 0 0 16px 0;
    font-size: 1.1rem;
}

.error-message a,
.info-message a {
    display: inline-block;
    padding: 12px 24px;
    background: #8b4513;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.error-message a:hover,
.info-message a:hover {
    background: #6d3510;
    transform: translateY(-2px);
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .places-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .modal-header h2 {
        font-size: 1.4rem;
    }
}
