/* MapAlerter – Public Consultations */

:root {
    --ma-green: #8cc63f;
    --ma-dark: #1f2d3a;
    --ma-orange: #f28c28;
    --ma-text: #333;
    --ma-muted: #6b7280;
    --ma-radius: 6px;
    --ma-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#map {
    position: fixed;
    inset: 0;
}

/* ---------- Logo control (sits to the right of the zoom buttons) ---------- */
.leaflet-top.leaflet-left .ma-logo-control {
    clear: none;               /* let it sit beside zoom, as in the existing apps */
    margin-left: 8px;
    background: transparent;
    box-shadow: none;
}
.ma-logo-control a.ma-logo-link { display: block; line-height: 0; }
.ma-logo-control img {
    height: 52px;
    width: auto;
    display: block;
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, .9));
}
.ma-logo-control .ma-all-layers {
    display: inline-block;
    margin-top: 6px;
    padding: 5px 10px;
    background: #fff;
    color: var(--ma-text);
    font-size: 14px;
    text-decoration: none;
    border-radius: 4px;
    box-shadow: var(--ma-shadow);
}
.ma-logo-control .ma-all-layers:hover { background: #f4f4f4; }
.ma-logo-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ma-logo-buttons .ma-all-layers { margin-top: 0; }

/* ---------- Google search control (top right) ---------- */
.ma-search-control { background: transparent; box-shadow: none; }
.ma-search-control input {
    width: 300px;
    max-width: calc(100vw - 210px);
    box-sizing: border-box;
    padding: 9px 12px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: var(--ma-shadow);
    outline: none;
}
.ma-search-control input:focus { border-color: var(--ma-green); }

/* Google autocomplete dropdown must sit above Leaflet panes/controls */
.pac-container { z-index: 10000 !important; }

/* ---------- Basemap switcher ---------- */
.leaflet-control-layers-base label { font-size: 14px; cursor: pointer; }
.leaflet-control-layers-base input { margin-right: 6px; }

/* ---------- Markers ---------- */
.ma-marker { background: none; border: 0; }
.ma-marker__inner { position: relative; width: 100%; height: 100%; }
.ma-marker__inner img {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Ripple rings radiating from the pin's point – only when zoomed in */
/* Defaults – overridden at runtime from config.php ('ripple' settings) */
:root { --ma-ripple: #e53935; --ma-ripple-scale: 4; --ma-ripple-speed: 2s; }
.ma-ripple {
    position: absolute;
    z-index: 0;
    left: 50%;
    top: 100%;                      /* the pin's tip = the actual location */
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid var(--ma-ripple);
    background: rgba(229, 57, 53, .25);                                   /* fallback */
    background: color-mix(in srgb, var(--ma-ripple) 25%, transparent);
    box-shadow: 0 0 6px var(--ma-ripple);
    border-radius: 50%;
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
}
.ma-animate .ma-ripple { animation: ma-ripple var(--ma-ripple-speed) ease-out infinite; }
@keyframes ma-ripple {
    0%   { transform: scale(0.2); opacity: 1; }
    70%  { opacity: .5; }
    100% { transform: scale(var(--ma-ripple-scale)); opacity: 0; }
}

/* ---------- Popups ---------- */
.ma-popup { font-size: 13px; color: var(--ma-text); max-width: 300px; }
.ma-popup h3 {
    margin: 0 0 6px;
    font-size: 15px;
    line-height: 1.3;
    color: var(--ma-dark);
}
.ma-popup .ma-pill {
    display: inline-block;
    margin-bottom: 8px;
    padding: 2px 8px;
    font-size: 11px;
    background: var(--ma-orange);
    color: #fff;
    border-radius: 10px;
}
.ma-popup .ma-pill--open     { background: #2e7d32; }
.ma-popup .ma-pill--upcoming { background: #1565c0; }
.ma-popup .ma-pill--closed   { background: #757575; }
.ma-popup dl { margin: 0 0 8px; display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; }
.ma-popup dt { color: var(--ma-muted); font-weight: 600; }
.ma-popup dd { margin: 0; }
.ma-popup .ma-desc {
    max-height: 140px;
    overflow-y: auto;
    padding-top: 6px;
    border-top: 1px solid #eee;
    line-height: 1.4;
}

.ma-popup a.ma-alert-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 6px 12px;
    background: var(--ma-dark);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    text-decoration: underline;
    border-radius: 6px;
}
.ma-popup a.ma-alert-btn:hover { background: #2c4054; color: #fff; }

/* ---------- Toast ---------- */
.ma-toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    z-index: 1100;
    transform: translate(-50%, 20px);
    max-width: calc(100vw - 32px);
    padding: 10px 18px;
    background: rgba(31, 45, 58, .92);
    color: #fff;
    font-size: 14px;
    text-align: center;
    border-radius: 22px;
    box-shadow: var(--ma-shadow);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease, transform .25s ease;
}
.ma-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Welcome modal ---------- */
.ma-modal[hidden] { display: none; }
.ma-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.ma-modal__backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .5); }
.ma-modal__dialog {
    position: relative;
    width: 100%;
    max-width: 460px;
    padding: 28px 26px 22px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
    text-align: center;
    animation: ma-pop .2s ease-out;
}
@keyframes ma-pop { from { transform: scale(.95); opacity: 0; } to { transform: none; opacity: 1; } }
.ma-modal__x {
    position: absolute;
    top: 8px;
    right: 10px;
    border: 0;
    background: none;
    font-size: 26px;
    line-height: 1;
    color: var(--ma-muted);
    cursor: pointer;
}
.ma-modal__logo { height: 60px; width: auto; margin-bottom: 10px; }
.ma-modal__title { margin: 0 0 10px; font-size: 20px; color: var(--ma-dark); }
.ma-modal__body { font-size: 15px; line-height: 1.5; color: var(--ma-text); text-align: left; }
.ma-modal__btn {
    margin-top: 14px;
    padding: 10px 26px;
    border: 0;
    border-radius: 4px;
    background: var(--ma-green);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}
.ma-modal__btn:hover { filter: brightness(.95); }

/* ---------- Small screens ---------- */
@media (max-width: 600px) {
    .ma-logo-control img { height: 40px; }
    .ma-search-control input { width: 200px; max-width: calc(100vw - 170px); }
    .ma-all-layers { font-size: 13px; }
}
