html,
body,
#map-canvas {
    height: 100%;
    margin: 0;
    padding: 0;
    min-height: 710px;
}

#legend {
    position: absolute;
    display: flex;
    flex-direction: column;
    z-index: 11;
    top: 5px;
    bottom: 5px;
    height: auto;
    width: 210pxpx;
    left: 0px;
    padding: 15px;
    background-color: rgb(255, 255, 255);
    border-radius: 0px 3px 3px 0px;
}

#legend-locations {
    position: absolute;
    display: flex;
    flex-direction: column;
    z-index: 11;
    top: auto;
    bottom: 10px;
    height: auto;
    width: 210px;
    left: 0px;
    padding: 15px;
    background-color: rgb(255, 255, 255);
    border-radius: 0px 3px 3px 0px;
}

.mobile {
    display: none;
}

.desktop a {
    display: flex;
    align-items: center;
}

.type {
    cursor: pointer;
}

.desktop img {
    margin-right: 8px;
}

.legend-img {
        width: 30px;
        object-fit: contain;
        min-height: 25px;
        max-height: 25px;
    
}

@media only screen and (max-width: 400px) {
    #legend {
        position: initial !important;
    }

    #legend .desktop {
        display: none;
    }

    #legend h3 {
        display: inline-block;
        font-size: 13px;
    }

    .mobile {
        display: block;
    }

    #map-container {
        overflow: hidden;
        padding-bottom: 56.25%;
        position: relative;
        height: 0;
    }

    #map-canvas {
        left: 0;
        top: 0;
        height: 100%;
        width: 100%;
        position: absolute;
    }

    .liftImg {
        max-width: 200px;
    }
}

/* Button style for legend items */
.legend-item {
    display: flex;
    align-items: center;
    padding: 5px;
    border: 1px solid #012c5000;
    background-color: #fff;
    cursor: pointer;
    width: 100%;
    margin-bottom: 10px;
    border-radius: 5px;
    position: relative;
}

/* Hide the checkbox but keep it functional */
.legend-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* When the checkbox is checked, change background and text */
.legend-item input[type="checkbox"]:checked+label {
    background-color: #fff;
    font-weight: bold;
}

/* Ensure the label is clickable by the whole area */
.legend-item label {
    display: flex;
    align-items: center;
    cursor: pointer;
    width: 100%;
}

/* Adjust image size and spacing */
.legend-item label img {
    margin-right: 8px;
    width: 32px;
    height: 32px;
    
}

/* Change background color on hover */
.legend-item:hover {
    background-color: #fff;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

/* Button layout */

.legend-btn {
    display: flex;
    width: 100%;
    cursor: pointer;
    margin: 10px 0px;
    /* Make sure the button takes the full width of the container */
}

label {
    display: flex;
    align-items: center;
    width: 100%;
    cursor: pointer;
    font-size: small;
    
}

/* button styling */
button {
    padding: 5px;
    border-radius: 3px;
    border: 1px solid transparent;
    transition: all 0.3s ease-in-out;
    font-size: 15px;
    background-color: #efefef; /* Set default background color */
    color: #000; /* Set default text color to black */
    -webkit-appearance: none; /* Remove default WebKit styles */
    -moz-appearance: none; /* Remove default Mozilla styles */
    appearance: none; /* Remove default styles */
}

/* Button hover and active states */
button:hover, .active:hover, .active {
    color: #012d50;
    border-color: #012d50;
    background-color: #fff;
}

/* Ensure text color and background remain correct when button is not hovered or active */
button:not(:hover):not(.active) {
    color: #000;
    background-color: #efefef;
}

/* Remove default focus styles */
button:focus {
    outline: none;
}

/* Optional: Add custom focus styles for accessibility */
button:focus-visible {
    box-shadow: 0 0 0 2px rgba(1, 45, 80, 0.5);
}

/* button hover and active state with smooth transition */
button:hover{
    color: #012d50;
    
    border-radius: 3px;
    background-color: #fff;
    transition: all 0.3s ease-in-out;
}

.active:hover {
    font-weight: bold;
    color: #012d50;
    border: #012d50 solid 1px;
    border-radius: 3px;
    background-color: #fff;
    transition: all 0.3s ease-in-out;

}

.active {
    font-weight: bold;
    color: #012d50;
    border: #012d50 solid 1px;
    border-radius: 3px;
    background-color: #fff;
    transition: all 0.3s ease-in-out;

}

img.legend-img {
    padding-right: 5px;
}

/* remove WordPress outline */
:where(.wp-site-blocks *:focus) { outline-width: 0px;}

p { 
    margin: 0;
    padding: 0;
    
}
br {
    display: none;
}

input {
    display: none;
}

/* Media query for mobile devices (width 550px and below) */
@media only screen and (max-width: 550px) {
    #legend {
        flex-direction: row;
        /* Arrange the buttons in one row */
        flex-wrap: wrap;
        /* Allow wrapping to the next line if buttons overflow */
        width: 100%;
        /* Full width for the container */
    }

    .legend-btn {
        width: auto;
        /* Set button width to be dynamic based on label size */
    }

    .legend-item {
        width: auto;
        /* Allow legend items to take the size of their content */
        padding: 5px 10px;
        /* Add padding to buttons */
    }

    label {
        width: auto;
        margin-right: 35px;
        /* Make the label width dynamic */
    }
}

/* Updated media query for mobile devices */
@media only screen and (max-width: 769px) {
    #map-outer {
        display: flex;
        flex-direction: column;
    }

    #legend-container {
        width: 100%;
        background-color: transparent;
        order: -1; /* This moves the legend container above the map */
    }

    #legend, #legend-locations {
        position: static;
        flex-direction: row;
        flex-wrap: nowrap;
        width: 100%;
        overflow-x: auto;
        padding: 0px 0px;
        margin: 0;
        background-color: #ffffff;
    }

    #legend-locations {
        padding: 0px 0px 5px 0px;
    }

    .legend-btn {
        width: auto;
        margin-right: 10px;
        white-space: nowrap;
    }

    .legend-item {
        width: auto;
        padding: 0px 0px;
    }

    label {
        width: auto;
        margin-right: 35px;

    }

    #legend::-webkit-scrollbar,
    #legend-locations::-webkit-scrollbar {
        display: none;
    }

    #legend,
    #legend-locations {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    #map-container {
        width: 100%;
        height: 70vh; /* Adjust this value as needed */
    }
}

@media only screen and (min-width: 770px) {
    #legend-container {
        position: absolute;
        display: flex;
        flex-direction: column;
        justify-content: center;
        z-index: 11;
        top: 14%;
        bottom: 14%;
        left: 0px;
        width: 210px;
        background-color: #ffffff;
        border-radius: 0px 3px 3px 0px;
        padding: 15px;
    }

    #legend,
    #legend-locations {
        position: relative;
        top: auto;
        bottom: auto;
        width: 100%;
        padding: 0;
        background-color: transparent;
    }
}

@media only screen and (max-width: 769px) {
    #legend-container {
        width: 100%;
        background-color: transparent;
    }
}