/**
 * avq-maps.css
 * Leaflet map styling for QAQ (Avecqui)
 * - Responsive heights + rounded corners
 * - Sticky sidebar variant
 * - Accessible focus states
 * - Admin + Front support
 */

/* ---------- Variables ---------- */
:root {
    --avq-map-radius: 1rem;
    /* matches rounded-3 in Bootstrap */
    --avq-map-shadow: 0 8px 24px rgba(0, 0, 0, .08);
    --avq-map-border: 1px solid rgba(0, 0, 0, .06);
    --avq-map-focus: 0 0 0 .25rem rgba(13, 110, 253, .25);
    /* Bootstrap primary focus */
}

/* ---------- Base wrappers ---------- */
.avq-map-wrap {
    position: relative;
    width: 100%;
}

#avq-map,
#avq-admin-map,
.avq-map {
    min-height: 320px;
    width: 100%;
    border-radius: var(--avq-map-radius);
    overflow: hidden;
    background: #f8f9fa;
    /* subtle skeleton bg */
    box-shadow: var(--avq-map-shadow);
    border: var(--avq-map-border);
}

/* Taller on larger screens */
@media (min-width: 576px) {

    #avq-map,
    #avq-admin-map,
    .avq-map {
        min-height: 380px;
    }
}

@media (min-width: 992px) {

    #avq-map,
    #avq-admin-map,
    .avq-map {
        min-height: 460px;
    }
}

/* Sticky sidebar variant (use on a column containing the map) */
.avq-map-sticky {
    position: sticky;
    top: 1rem;
    /* adjust if your header is sticky */
    z-index: 2;
}

/* Readonly state (if you disable interactions in JS) */
.avq-map--readonly {
    pointer-events: none;
    filter: grayscale(10%);
    opacity: .95;
}

/* ---------- Leaflet specifics ---------- */
.leaflet-container {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
    outline: none;
}

.leaflet-container a {
    text-decoration: none;
}

.leaflet-container a:hover,
.leaflet-container a:focus {
    text-decoration: underline;
}

/* Controls & attribution */
.leaflet-control-container .leaflet-control {
    border-radius: .75rem;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .12);
}

.leaflet-control-zoom a {
    width: 36px;
    height: 36px;
    line-height: 34px;
    font-size: 18px;
}

.leaflet-control-attribution {
    background: rgba(255, 255, 255, .85);
    font-size: .75rem;
    padding: .25rem .5rem;
    border-radius: .5rem;
}

/* Popups */
.leaflet-popup-content {
    margin: .5rem .75rem;
    line-height: 1.35;
    font-size: .9375rem;
}

.leaflet-popup-content img {
    max-width: 100%;
    height: auto;
    border-radius: .5rem;
}

/* Marker accessibility: focus ring when navigating with keyboard */
.leaflet-marker-icon:focus {
    outline: none;
    box-shadow: var(--avq-map-focus);
    border-radius: 999px;
}

/* Dragging cursor */
.leaflet-drag-target,
.leaflet-marker-icon.leaflet-interactive {
    cursor: grab;
}

.leaflet-drag-target:active,
.leaflet-marker-icon.leaflet-interactive:active {
    cursor: grabbing;
}

/* ---------- Utility: small locate button (optional helper class) ---------- */
.avq-locate-btn {
    position: absolute;
    right: .75rem;
    bottom: .75rem;
    z-index: 400;
    /* above controls */
    border: 1px solid rgba(0, 0, 0, .1);
    background: #fff;
    border-radius: 999px;
    padding: .5rem .75rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
}

.avq-locate-btn:focus {
    outline: none;
    box-shadow: var(--avq-map-focus);
}

/* ---------- Fullscreen modal map (if you show a bigger map on click) ---------- */
.avq-map-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .72);
    z-index: 1055;
    /* above Bootstrap modal default if needed */
    display: none;
}

.avq-map-modal.is-open {
    display: block;
}

.avq-map-modal__inner {
    position: absolute;
    inset: 2.5vw;
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 16px 48px rgba(0, 0, 0, .25);
    overflow: hidden;
}

.avq-map-modal__close {
    position: absolute;
    top: .75rem;
    right: .75rem;
    border: 0;
    background: rgba(255, 255, 255, .9);
    border-radius: 999px;
    width: 40px;
    height: 40px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}

/* map inside modal fills area */
.avq-map-modal .avq-map,
.avq-map-modal #avq-map {
    height: 100%;
    min-height: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

/* ---------- Forms near maps (lat/lng inputs) ---------- */
.avq-geo-row .form-control[readonly] {
    background-color: #f1f3f5;
    /* slightly darker than .form-control-plaintext */
    cursor: default;
}

.avq-geo-row .form-text {
    margin-top: .25rem;
    font-size: .8125rem;
    color: #6c757d;
}

/* ---------- Dark mode polish (optional) ---------- */
@media (prefers-color-scheme: dark) {

    #avq-map,
    #avq-admin-map,
    .avq-map {
        background: #0f1115;
        border-color: rgba(255, 255, 255, .08);
        box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
    }

    .leaflet-control-attribution {
        background: rgba(0, 0, 0, .55);
        color: #e9ecef;
    }

    .avq-map-modal__inner {
        background: #0f1115;
    }
}

/* ---------- Print ---------- */
@media print {
    .leaflet-control-container {
        display: none !important;
    }

    #avq-map,
    #avq-admin-map,
    .avq-map {
        box-shadow: none;
        border: 0;
    }
}