html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.main-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.atlas-header {
    flex-shrink: 0;
    background: var(--background-default-grey);
    border-bottom: 1px solid var(--border-default-grey);
    padding: 1rem;
    z-index: 1000;
}

.atlas-header-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.atlas-logo {
    height: 50px;
    width: auto;
}

.atlas-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.atlas-title-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.atlas-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-title-grey);
}

.atlas-type-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.atlas-type-badge.diachronique {
    background: var(--background-contrast-info);
    color: var(--text-label-blue-france);
}

.atlas-type-badge.voisinage {
    background: var(--background-contrast-success);
    color: var(--text-label-green-emeraude);
}

.atlas-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Les boutons/toggles ne doivent pas se comprimer les uns les autres : DSFR calcule la
   largeur du libellé d'un fr-toggle en fonction de la largeur de son conteneur
   (calc(100% - 2rem)), donc un conteneur trop comprimé fait retomber le texte
   caractère par caractère. On fige une largeur confortable et on laisse la barre
   passer à la ligne (flex-wrap) plutôt que d'écraser chaque contrôle. */
.atlas-controls > * {
    flex-shrink: 0;
}

#view-mode-toggle-container {
    margin: 0;
    min-width: 12.5rem;
}

#sync-toggle-container {
    margin: 0;
    min-width: 15rem;
}

#view-mode-toggle-container .fr-toggle__label,
#sync-toggle-container .fr-toggle__label {
    font-size: 0.875rem;
    white-space: nowrap;
}

.content-wrapper {
    flex: 1;
    display: flex;
    min-height: 0;
    position: relative;
}

.maps-container {
    flex: 1;
    display: flex;
    position: relative;
}

.layer-control-panel {
    width: 320px;
    flex-shrink: 0;
    overflow-y: auto;
    background: white;
    border-left: 1px solid var(--border-default-grey);
}

#loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    gap: 1rem;
}

#loading-overlay.hidden {
    display: none;
}

.error-message {
    max-width: 600px;
    text-align: center;
    padding: 2rem;
}

/* Single View */
#single-view {
    width: 100%;
    height: 100%;
    display: block; /* Par défaut visible */
}

#map-single {
    width: 100%;
    height: 100%;
}

/* Split View */
#split-view {
    display: none; /* Par défaut caché */
    width: 100%;
    height: 100%;
    position: relative;
}

#map-left,
#map-right {
    flex: 1;
    height: 100%;
}

#map-divider {
    width: 8px;
    background: var(--border-default-grey);
    cursor: col-resize;
    flex-shrink: 0;
    position: relative;
    z-index: 100;
}

#map-divider:hover {
    background: var(--border-action-high-blue-france);
}

@media (max-width: 992px) {
    .layer-control-panel {
        width: 280px;
    }
}

@media (max-width: 768px) {
    .atlas-info-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .atlas-logo {
        height: 40px;
    }
    
    .layer-control-panel {
        width: 100%;
        max-height: 40vh;
        border-left: none;
        border-top: 1px solid var(--border-default-grey);
    }
    
    .content-wrapper {
        flex-direction: column;
    }
    
    #split-view {
        flex-direction: column;
    }
    
    #map-divider {
        width: 100%;
        height: 8px;
        cursor: row-resize;
    }
}
