﻿/* citymap2.css - styles for the MapLibre map on /city/{id} (CityMap2.razor).

   Only rules for elements the map script creates belong here: markers, labels, popups,
   tooltips and the MapLibre controls. Those elements do not exist until the map is drawn,
   so this file arriving late cannot move anything on the page.

   Page layout - the container, rows, columns, map box and place list - lives in
   Pages/CityMap2.razor.css, which is in the <head> from the first paint. Layout rules
   used to sit here as global !important overrides for phones; because this file is only
   loaded once WebAssembly has started, they reflowed the whole page several seconds in and
   gave every city page a CLS of about 0.35 (see _doc/20261116_city_page_load_plan.md). */

/* Custom marker style for solid black markers */
.custom-marker {
    width: 30px;
    height: 42px;
    background-image: url("data:image/svg+xml,%3Csvg width='30' height='42' viewBox='0 0 30 42' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M15 0C6.71573 0 0 6.71573 0 15C0 23.2843 15 42 15 42C15 42 30 23.2843 30 15C30 6.71573 23.2843 0 15 0Z' fill='%23000000'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    cursor: pointer;
}

/* Marker label style */
.marker-label {
    position: absolute;
    background-color: transparent;
    color: white;
    font-weight: bold;
    font-size: 12px;
    text-align: center;
    pointer-events: none;
    width: 100%;
    top: 8px;
    left: 0;
    z-index: 10;
}

/* Popup styles */
.maplibregl-popup {
    max-width: 300px !important;
    z-index: 5;
}

.maplibregl-popup-content {
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.maplibregl-popup-anchor-top .maplibregl-popup-tip,
.maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
.maplibregl-popup-anchor-top-right .maplibregl-popup-tip {
    border-bottom-color: white;
}

.maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip {
    border-top-color: white;
    margin-top: -6px; /* Pull the tip closer to the popup */
}

.place-popup .place-title {
    margin: 0 0 8px 0;
    color: #1565c0;
    font-size: 18px;
    font-weight: bold;
}

.place-popup .place-address {
    margin: 8px 0;
    color: #555;
    font-size: 14px;
}

.place-popup .place-description {
    margin: 8px 0;
    color: #555; /* was inherited from the global .place-description rule, now scoped to the page */
    font-size: 14px;
    line-height: 1.4;
}

.place-popup .place-website {
    margin: 12px 0 0 0;
}

    .place-popup .place-website a {
        color: #1565c0;
        text-decoration: none;
        font-weight: bold;
    }

        .place-popup .place-website a:hover {
            text-decoration: underline;
        }

/* Ensure tooltips don't get clipped by the marker */
.maplibregl-marker {
    z-index: 1;
}

.maplibregl-popup {
    z-index: 2;
}

/* Make selected marker be on top of others */
.maplibregl-marker.selected {
    z-index: 3;
}


/* Phones */
@media (max-width: 768px) {
    .maplibregl-popup {
        max-width: 90vw !important;
    }

    .maplibregl-popup-content {
        padding: 10px !important;
    }

    .maplibregl-ctrl-top-right {
        top: 5px !important;
        right: 5px !important;
    }

    .maplibregl-ctrl {
        margin: 5px !important;
    }

    .maplibregl-ctrl-top-right .maplibregl-ctrl-group {
        margin-bottom: 5px !important;
    }

    /* Make map controls smaller on mobile */
    .maplibregl-ctrl-group button {
        width: 28px !important;
        height: 28px !important;
    }
}

/* Very small screens */
@media (max-width: 380px) {
    .place-popup .place-title {
        font-size: 16px !important;
    }

    .place-popup .place-address,
    .place-popup .place-description {
        font-size: 13px !important;
    }
}

/* Marker tooltip styles */
.marker-tooltip {
    position: fixed;
    background-color: #555; /* Dark grey background */
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    z-index: 10000;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    display: none;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    transform: translateY(-50%); /* Center vertically */
    /* Removed max-width to allow full text display */
    line-height: 1.2;
}

    /* Tooltip positioning for right side */
    .marker-tooltip.tooltip-right {
        transform: translateY(-50%);
    }

    /* Tooltip positioning for left side */
    .marker-tooltip.tooltip-left {
        transform: translateX(-100%) translateY(-50%);
    }

    /* Arrow pointing to marker - right side */
    .marker-tooltip.tooltip-right::before {
        content: '';
        position: absolute;
        top: 50%;
        left: -5px;
        margin-top: -5px;
        border-width: 5px;
        border-style: solid;
        border-color: transparent #555 transparent transparent; /* Dark grey arrow */
    }

    /* Arrow pointing to marker - left side */
    .marker-tooltip.tooltip-left::before {
        content: '';
        position: absolute;
        top: 50%;
        right: -5px;
        margin-top: -5px;
        border-width: 5px;
        border-style: solid;
        border-color: transparent transparent transparent #555; /* Dark grey arrow */
    }

/* Mobile optimizations for tooltips */
@media (max-width: 768px) {
    .marker-tooltip {
        font-size: 11px;
        padding: 4px 8px;
        /* Removed max-width to allow full text display on mobile too */
    }
}

/* Ensure tooltips work well with touch devices */
@media (hover: none) and (pointer: coarse) {
    .marker-tooltip {
        display: none !important;
    }
}
