/*
 * style.css
 *
 * This stylesheet defines the visual presentation for the Crestwood Infill Map application.
 * It covers global layout, navigation, MapLibre map integration, and custom controls.
 */

/* ========================================= */
/* --- 1. Global Resets & Base Layout --- */
/* ========================================= */

body {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: sans-serif;
    color: #333;
}

#map {
    flex-grow: 1;
    width: 100%;
    /* Important: Prevents flex container overflow issues in some browsers */
    min-height: 0;
}

/* ========================================= */
/* --- 2. Navigation Bar (Navbar) --- */
/* ========================================= */

.navbar {
    background-color: #333;
    color: #fff;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    flex-shrink: 0;
}

.navbar-brand {
    font-size: 1.2em;
    font-weight: bold;
    font-family: sans-serif;
}

/* Navbar Toggle Button (Hamburger) for mobile */
.navbar-toggle {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1002;
}

.navbar-toggle:focus {
    outline: none;
}

.navbar-toggle .icon-bar {
    width: 100%;
    height: 3px;
    background-color: #fff;
    border-radius: 2px;
    transition: all 0.3s ease-in-out;
}

/* Navbar Menu (Mobile First - initially hidden) */
.navbar-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    position: absolute;
    top: 50px; /* Adjust based on actual navbar height */
    left: 0;
    width: 100%;
    background-color: #333;
    flex-direction: column;
    display: none; /* Hidden by default on mobile */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

/* State when the navbar menu is active/visible */
.navbar-menu.active {
    display: flex;
}

.navbar-menu li {
    text-align: center;
    padding: 10px 0;
}

.navbar-menu li a {
    color: #fff;
    text-decoration: none;
    font-family: sans-serif;
    font-size: 1em;
    padding: 10px 0;
    display: block;
    transition: background-color 0.3s ease;
}

.navbar-menu li a:hover,
.navbar-menu li a:focus {
    background-color: #555;
    color: #ffd700;
}

/* ========================================= */
/* --- 3. Media Query for Desktop/Larger Screens --- */
/* ========================================= */

@media (min-width: 768px) {
    /* Hides the hamburger toggle button on larger screens */
    .navbar-toggle {
        display: none;
    }

    /* Resets navbar menu for desktop display */
    .navbar-menu {
        position: static;
        display: flex;
        flex-direction: row;
        width: auto;
        background-color: transparent;
        box-shadow: none;
        top: auto;
        left: auto;
    }

    .navbar-menu li {
        padding: 0;
    }

    /* Adds horizontal space between desktop menu items */
    .navbar-menu li:not(:last-child) {
        margin-right: 20px;
    }

    .navbar-menu li a {
        padding: 5px 0;
        font-size: 0.95em;
        background-color: transparent;
    }
}

/* ========================================= */
/* --- 4. Map Legend --- */
/* ========================================= */

.map-legend {
    position: absolute;
    bottom: 70px; /* Positions legend above the disclaimer/bottom controls */
    right: 20px;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    font-family: sans-serif;
    font-size: 0.9em;
    color: #333;
    z-index: 999;
    max-width: calc(100vw - 40px);
}

.map-legend h4 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.1em;
    color: #000;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

/* Removes bottom margin from the last legend item */
.legend-item:last-child {
    margin-bottom: 0;
}

.legend-color {
    width: 20px;
    height: 20px;
    border: 1px solid #ccc;
    margin-right: 10px;
    flex-shrink: 0;
}

/* Map Legend - Adjustments for Smaller Screens */
@media (max-width: 400px) {
    .map-legend {
        font-size: 0.8em;
        padding: 8px;
    }

    .legend-color {
        width: 16px;
        height: 16px;
    }
}

/* ========================================= */
/* --- 5. MapLibre Custom Controls --- */
/* ========================================= */

/* Styles for the disclaimer paragraph text inside the custom MapLibre control */
.maplibre-disclaimer-text {
    font-size: 12px;
    font-family: sans-serif;
    color: #666;
    line-height: 20px; /* Adjust as needed */
    margin: 0;
    padding: 0 0px;
    background-color: transparent; /* No background on the text itself */
    text-align: right;
}

/* Styles for strong tags within the disclaimer text */
.maplibre-disclaimer-text strong {
    color: #333;
}

/* Styles for the container of your custom control when placed in the bottom-left */
/* This targets the `div` with classes `maplibregl-ctrl maplibregl-ctrl-group` */
.maplibregl-ctrl-bottom-left .maplibregl-ctrl-group {
    background-color: rgba(255, 255, 255, 0.5); /* Semi-transparent white background for *your control* */
    padding: 0px 2px;
    border-radius: 0px;
    box-shadow: none;

    /* Margins to position the control relative to the map edges */
    margin-left: 0px; /* Space from the left edge of the map */
    margin-bottom: 0px; /* Space from the bottom edge of the map */

    /* Ensure the text is aligned within this control's container */
    text-align: left;
}