/* ============================================================
   Base Map Shared Styles
   Managed by: ccambassador-maps MU plugin
   ============================================================ */

/* Map Layout Base */
.map-layout {
    position: relative;
    width: 100%;
    height: 70vh;
    overflow: hidden;
    border-radius: var(--border-radius-3xl);
}

@media (max-width: 830px) {
    .map-layout {
        height: 65vh;
    }
}

/* Google Maps control street view */
.gm-svpc,
/* Google Maps control fullscreen */
.gm-fullscreen-control,
.gm-control-active,
body.dark-theme .gm-svpc,
body.dark-theme .gm-fullscreen-control,
body.dark-theme .gm-control-active {
    background-color: #FEFFFE !important;
    box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.24) !important;
    opacity: 0.9;
}

/* Google Maps control fullscreen, open controls size */
.gm-fullscreen-control,
.gm-control-active {
    height: 32px !important;
    width: 32px !important;
}



/* Force Google Maps control icons (fullscreen, street view) to keep dark grey path styling in dark theme */
body.dark-theme .gm-fullscreen-control svg path,
body.dark-theme .gm-fullscreen-control path,
body.dark-theme .gm-control-active svg path,
body.dark-theme .gm-control-active path,
body.dark-theme .gm-svpc svg path,
body.dark-theme .gm-svpc path {
    fill: #666666 !important;
}

body.dark-theme .gm-fullscreen-control img,
body.dark-theme .gm-control-active img,
body.dark-theme .gm-svpc img {
    filter: brightness(0.4) !important;
}


/* Google Maps Bottom Control Bar (Keyboard shortcuts, Map data, Terms) */
.gm-style-cc,
.gm-style-cc a,
.gm-style-cc span,
.gm-style-cc button,
.gm-style-cc div,
body.dark-theme .gm-style-cc,
body.dark-theme .gm-style-cc a,
body.dark-theme .gm-style-cc span,
body.dark-theme .gm-style-cc button,
body.dark-theme .gm-style-cc div {
    background-color: rgba(255, 255, 255, 0.7) !important;
    color: rgba(0, 0, 0, 0.6) !important;
}

.gm-style-cc button,
body.dark-theme .gm-style-cc button {
    background: transparent !important;
}


/* Google Maps Control Buttons (Map / Satellite) */
.gm-style-mtc-bbw,
body.dark-theme .gm-style-mtc-bbw {
    background-color: transparent !important;
    border-radius: var(--border-radius-xs) !important;
    box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.24) !important;

    & .gm-style-mtc {

        & button,
        & div {
            height: 3.2rem !important;
            padding: 0.8rem 1.2rem !important;
            display: inline-flex !important;
            align-items: center !important;
            justify-content: center !important;
            box-sizing: border-box !important;
            color: var(--text-color-primary) !important;
            font-family: var(--font-secondary, inherit) !important;
            font-size: 1.4rem !important;
            font-weight: 400;
            transition: all 0.2s ease !important;
            background-color: rgba(254, 255, 254, 0.8) !important;


            &[aria-checked="true"] {
                background-color: rgb(254, 255, 254) !important;
                font-weight: 600;
            }

        }

        & ul {
            background-color: rgb(254, 255, 254) !important;
            padding: 0 !important;

            & li {
                background-color: transparent !important;
                margin: 0;

                & span {
                    color: var(--text-color-primary) !important;
                    filter: none !important;
                }
                
                & label {
                    color: var(--text-color-primary) !important;
                    padding-inline-start: 0.5rem;
                    font-family: var(--font-secondary, inherit) !important;
                    font-size: 1.4rem !important;
                }

                &::before {
                    display: none;
                    visibility: hidden;
                }
            }
        }
    }
}


/* Map Dark/Light Theme Toggle Control  */
.obs-map-theme-toggle-wrapper {
    margin: 1.2rem;
    display: flex;
    align-items: center;
    height: 34px;


    & .obs-map-theme-toggle-btn {
        border: none;
        border-radius: var(--border-radius-xs);
        outline: none;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        font-family: var(--font-secondary);
        font-size: 1.2rem;
        font-weight: 600;
        line-height: 1;
        width: 100px;
        height: 24px;
        box-sizing: border-box;
        transition: all 0.25s ease-in-out;
        user-select: none;
        padding: 0;
        margin: 0;

        & .obs-map-theme-toggle-icon {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 34px;
            height: 34px;
            flex-shrink: 0;
            margin-top: -5px;
            margin-bottom: -5px;
        }

        & .obs-map-theme-toggle-icon svg {
            display: block;
            width: 34px;
            height: 34px;
        }

        & .obs-map-theme-toggle-label {
            white-space: nowrap;
            letter-spacing: -0.132px;
            line-height: 1;
            margin: 0;
            padding: 0;
        }

        /* Light Mode State */
        &.is-light {
            background-color: #fff;
            color: var(--text-color-primary);
            border-top-left-radius: 15px;
            border-bottom-left-radius: 15px;
            padding: 0 0.8rem 0 0;

            & .obs-map-theme-toggle-label {
                margin-left: 0.6rem;
                margin-right: 0;
            }

            &:hover {
                box-shadow: 0 4px 12px rgba(0, 0, 0, 0.24);
            }
        }

        /* Dark Mode State */
        &.is-dark {
            background-color: #5B5B5B;
            color: var(--text-color-white);
            border-top-right-radius: 15px;
            border-bottom-right-radius: 15px;
            padding: 0 0 0 0.8rem;

            & .obs-map-theme-toggle-label {
                margin-right: 0.6rem;
                margin-left: 0;
            }

            &:hover {
                background-color: #484848;
                box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
            }
        }
    }
}


/* Marker Tooltips & InfoWindows */
button.gm-ui-hover-effect {
    display: none !important;
}

.gm-style-iw.gm-style-iw-c {
    padding: 0;
    background: none;
    box-shadow: none;
    border-radius: 0;
    overflow: visible !important;
}

.gm-style-iw-d {
    overflow: visible !important;
}

/* Hide Google's default tail */
.gm-style-iw-tc {
    display: none !important;
}

.marker-tooltip {
    position: relative;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    white-space: nowrap;
    background-color: #888;
    overflow: visible;
}

/* Custom triangle (tail) */
.marker-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px;
    border-style: solid;
    border-color: transparent;
    border-top-color: #888;
}

/* Base Legend Container */
.map-legend__container {
    margin-top: 1.6rem;

    & .map__legend__list {
        list-style: none;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: start;
        flex-wrap: wrap;
        row-gap: 1.6rem;
        column-gap: 2.4rem;

        & li {
            margin: 0;
            padding: 0;
            display: flex;
            flex-direction: row;
            align-items: center;
            column-gap: 0.8rem;
            white-space: nowrap;

            & img {
                display: block;
                width: 20px;
                height: 20px;
                object-fit: contain;
            }

            p {
                margin: 0;
                color: var(--text-color-dark-grey);
                font-family: var(--font-primary);
                font-size: 1.4rem;
                font-weight: 400;
                line-height: 1.5;
            }

            &::before {
                content: none !important;
                display: none !important;
            }
        }
    }

    @media (max-width: 600px) {
        & .map__legend__list {
            gap: 1.6rem;

            & li {
                gap: 0.5rem;
            }
        }
    }
}



/* Shared Filters Container */
.cc-map-filters-container {
    margin-top: 4rem;
    margin-bottom: 2rem;
    position: relative;
    z-index: 1001;
}

.cc-table-filters-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1.6rem;
    align-items: flex-start;
}

.cc-table-filter-item {
    flex: 1 1 auto;
    min-width: 160px;
}

.cc-table-filter-item.project-filter--reset {
    align-self: end;
    justify-content: center;
    flex: 0 0 auto;
}

/* Filter Dropdown */


/* Mobile Filter Accordion */
.cc-map-filters-mobile-toggle {
    display: none;
    width: 100%;
    background: transparent;
    border: var(--border-button-primary);
    border-radius: 10px;
    padding: 1.2rem 2.4rem 1.2rem 2rem;
    align-items: center;
    justify-content: center;
    gap: 1.2rem;
    cursor: pointer;
    font-family: var(--font-primary, inherit);
    font-size: 1.6rem;
    line-height: 2.4rem;
    font-weight: 500;
    color: var(--color-primary);
    margin-bottom: 1.6rem;
    transition: all 0.3s ease;
}

.filter-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.6rem;
}

.toggle-text {
    display: flex;
    align-items: center;
    height: 100%;
}

/* .cc-map-filters-mobile-toggle .chevron-icon {
    display: flex;
    align-items: center;
    justify-content: center;
} */

.cc-map-filters-mobile-toggle .chevron-icon {
    transition: transform 0.3s ease;
}

.cc-map-filters-container.is-open .cc-map-filters-mobile-toggle .chevron-icon svg {
    transform: rotate(180deg);
}

@media (max-width: 600px) {
    .cc-map-filters-mobile-toggle {
        display: flex;
    }

    .cc-table-filters-group {
        height: 0;
        overflow: hidden;
        display: grid;
        opacity: 0;
        padding: 2.4rem;
        background: #fff;
        border: none;
        border-radius: 10px;
        margin-top: -6rem;
        border-top-left-radius: 0;
        border-top-right-radius: 0;
        pointer-events: none;
    }

    .cc-map-filters-container.is-open {
        border-radius: 10px;
        padding: 0;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    }

    .cc-map-filters-container.is-open .cc-map-filters-mobile-toggle {
        background-color: var(--color-primary);
        color: var(--white-100);
        border-color: transparent;
        margin-bottom: 0;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }

    .cc-map-filters-container.is-open .cc-table-filters-group {
        grid-template-rows: 1fr;
        grid-template-columns: 1fr;
        opacity: 1;
        height: auto;
        position: absolute;
        left: 0;
        right: 0;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
        transition: opacity 0.35s ease-in-out;
        margin-top: 0;
        pointer-events: auto;
    }
}