/* Map pages: the map under the top bar, popup buttons, the photo overlay, link colour and the dark theme of the map controls (the OSM background stays as it is) */

#map {
    flex: 1;
    min-height: 0;
}

/* link buttons in popups (tender notices, planning documents), in the sidebar's blue like the top bar's current page */
.popup-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 12px 0 2px;
}
.leaflet-container .popup-buttons a.popup-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    border-radius: 6px;
    background: var(--highlight);
    color: #ffffff;
    font: 600 13px/1 var(--font);
    text-decoration: none;
    white-space: nowrap;
}
.leaflet-container .popup-buttons a.popup-button:hover {
    background: var(--highlight-hover);
}
.popup-button i {
    opacity: .85;
}

/* photo overlay (nuotrauka.js): the photo over a dimmed page, in both themes */
.photo-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 56px 64px 20px;
    box-sizing: border-box;
    background: rgba(10, 13, 17, .88);
    font: 14px/1.4 var(--font);
}
.photo-overlay.open {
    display: flex;
}
.photo-overlay img {
    /* size set by nuotrauka.js; a frame in the theme's surface colour around the picture */
    flex: none;
    box-sizing: border-box;
    padding: 12px;
    border-radius: 10px;
    background: var(--surface);
    box-shadow: 0 6px 30px rgba(0, 0, 0, .5);
    transition: opacity .15s;
}
.photo-overlay.loading img {
    opacity: 0;
}
.photo-caption {
    flex: none;
    max-width: 100%;
    color: #e7ebee;
    text-align: center;
}
.photo-overlay button {
    position: absolute;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 6px;
    background: rgba(255, 255, 255, .1);
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
}
.photo-overlay button:hover {
    background: rgba(255, 255, 255, .2);
}
.photo-overlay button[hidden], .photo-caption[hidden] {
    display: none;
}
.photo-close { top: 8px; right: 8px; }
.photo-prev, .photo-next { top: calc(50% - 22px); }
.photo-prev { left: 10px; }
.photo-next { right: 10px; }
@media (max-width: 600px) {
    .photo-overlay { padding: 56px 8px 64px; }
    .photo-prev, .photo-next { top: auto; bottom: 10px; }
}

/* text links on the map in the site's accent colour (not the zoom buttons or sidebar tabs, which are links too) */
.leaflet-popup-content a, .leaflet-sidebar-pane a, .leaflet-control-attribution a {
    color: var(--accent);
}

/* dark theme of the map controls */

/* zoom buttons */
/* Leaflet's see-through edge as in the light theme (and on the sidebar); the buttons are clipped to the rounded box */
[data-theme="dark"] .leaflet-bar {
    overflow: hidden;
    background-color: var(--surface);
}
[data-theme="dark"] .leaflet-bar a, [data-theme="dark"] .leaflet-bar a:hover {
    border-radius: 0;
    background-color: var(--surface);
    border-bottom-color: var(--border);
    color: var(--text);
}
[data-theme="dark"] .leaflet-bar a:hover {
    background-color: var(--surface-hover);
}
[data-theme="dark"] .leaflet-bar a.leaflet-disabled {
    background-color: var(--surface);
    color: #5a646e;
}

/* attribution and scale */
[data-theme="dark"] .leaflet-container .leaflet-control-attribution {
    background: rgba(17, 21, 26, .75);
    color: var(--muted);
}
[data-theme="dark"] .leaflet-control-scale-line {
    background: rgba(17, 21, 26, .6);
    border-color: var(--muted);
    color: var(--text);
    text-shadow: none;
}

/* popups */
[data-theme="dark"] .leaflet-popup-content-wrapper, [data-theme="dark"] .leaflet-popup-tip {
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 4px 20px rgba(0, 0, 0, .5);
}
[data-theme="dark"] .leaflet-container a.leaflet-popup-close-button {
    color: var(--muted);
}
[data-theme="dark"] .leaflet-container a.leaflet-popup-close-button:hover {
    color: var(--text);
}

/* sidebar */
/* the container stays transparent, so its see-through edge darkens the map as in the light theme */
[data-theme="dark"] .leaflet-sidebar-tabs, [data-theme="dark"] .leaflet-sidebar-tabs > ul > li > a,
[data-theme="dark"] .leaflet-sidebar-content {
    background-color: var(--surface);
    color: var(--text);
}
[data-theme="dark"] .leaflet-sidebar-tabs > ul > li:hover, [data-theme="dark"] .leaflet-sidebar-tabs > ul > li > a:hover {
    background-color: var(--surface-hover);
    color: var(--text);
}
/* open panel: the highlight blue, a deeper one than in the light theme */
[data-theme="dark"] .leaflet-sidebar-tabs > ul > li.active, [data-theme="dark"] .leaflet-sidebar-tabs > ul > li.active > a {
    background-color: var(--highlight);
    color: #ffffff;
}
[data-theme="dark"] .leaflet-sidebar-tabs > ul > li.disabled, [data-theme="dark"] .leaflet-sidebar-tabs > ul > li.disabled > a {
    color: #5a646e;
}
[data-theme="dark"] .leaflet-sidebar-header {
    background-color: var(--highlight);
    color: #ffffff;
}
[data-theme="dark"] .leaflet-sidebar-pane {
    color: var(--text);
}

/* notifications */
[data-theme="dark"] .leaflet-control-notifications.modern .leaflet-notification {
    background: rgba(26, 32, 39, .95);
    box-shadow: 0 4px 20px rgba(0, 0, 0, .5);
}
[data-theme="dark"] .leaflet-control-notifications.modern .leaflet-notification-icon,
[data-theme="dark"] .leaflet-control-notifications.modern .leaflet-notification-title {
    color: var(--text);
}
[data-theme="dark"] .leaflet-control-notifications.modern .leaflet-notification-message {
    color: var(--muted);
}
