/* General page layout */
html {
    height: 100%;
    font-size: 16px;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: Arial, Helvetica, sans-serif;
    color: #212529;
    background-color: #ffffff;
}


header {
    flex-shrink: 0;
}

main {
    flex: 1 0 auto;
    width: 100%;
}

.footer {
    flex-shrink: 0;
    width: 100%;
    margin-top: auto;
}


.navbar {
    border-bottom: 1px solid #dee2e6;
}

.navbar-brand {
    font-weight: 700;
}


/* Main content */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

    main section.container-fluid {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;
        padding: 0 !important;
    }

h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

main p {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

main section .text-center {
    flex-shrink: 0;
}

/* ArcGIS map */
.map-container {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    background-color: #ffffff;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

#viewDiv {
    flex: 1;
    width: 100%;
    height: 100%;
    min-height: 400px;
    border: none;
    border-radius: 0;
    overflow: hidden;
}

/* Status and validation messages */
#statusMessage {
    margin-bottom: 0.75rem;
}

/* Footer */
footer {
    flex-shrink: 0;
    margin-top: 0;
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    color: #495057;
}

/* Legend container */
.legend-container {
    position: relative;
    background: #ffffff;
    min-width: 220px;
    max-width: 300px;
    padding: 10px;
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    box-sizing: border-box;
}

.legend-button-container {
    position: absolute;
    top: 100px;
    right: 20px;
    z-index: 10;
}

.legend-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #dddddd;
}

    .legend-header span {
        font-weight: 600;
    }

.legend-close-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #333333;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

    .legend-close-button:hover {
        background: #eeeeee;
    }

.legend-content {
    max-height: 300px;
    overflow-y: auto;
}

/* Hide the ArcGIS legend service heading */
.esri-widget__heading.esri-legend__service-label {
    display: none !important;
}

/* --------------------------------------------------
   ArcGIS popup action buttons
   -------------------------------------------------- */

/* Base styling for popup action buttons */
.esri-popup__action[ data-action-id="adopt-road" ] {
    background-color: #198754 !important;
    color: #ffffff !important;
}

/* Clean Sweep this Road */
.esri-popup__action[ data-action-id="clean-sweep" ] {
    background-color: #0d6efd !important;
    color: #ffffff !important;
}

/* Make the agreement checkbox prominent */
.terms-checkbox {
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid #0d6efd;
    cursor: pointer;
}

    .terms-checkbox:checked {
        background-color: #0d6efd;
        border-color: #0d6efd;
    }

.terms-label {
    font-weight: 600;
    font-size: 1.05rem;
    margin-left: 8px;
    cursor: pointer;
}

/* ArcGIS Calcite action bar */
calcite-action-bar {
    --calcite-color-foreground-1: #e8f1fb;
    --calcite-color-foreground-2: #d4e4f5;
    --calcite-color-foreground-3: #c2d8ef;
    /* Dark text and icons for better contrast */
    --calcite-color-text-1: #183653;
    --calcite-color-text-2: #294d70;
    background-color: #e8f1fb !important;
}

/* Action bar background and border */
.esri-popup calcite-action-bar {
    background: #e8f1fb !important;
    border-top: 2px solid #b6cee8 !important;
}




/* Mobile screens */
@media (max-width: 768px) {
    h1 {
        font-size: 1.6rem;
    }

    main section.container-fluid {
        padding: 0.5rem !important;
    }

    #viewDiv {
        min-height: 350px;
    }

    calcite-action-bar calcite-action {
        --calcite-action-text-display: inline;
    }

        calcite-action-bar calcite-action::part(text) {
            display: inline !important;
            visibility: visible !important;
            opacity: 1 !important;
        }
}

/* Compact legend on small mobile screens */
@media (max-width: 576px) {
    .legend-container {
        min-width: 180px;
        max-width: 180px;
        padding: 8px;
    }

    .legend-content {
        max-height: 180px;
        overflow: auto;
        font-size: 11px;
    }

        .legend-content .esri-legend__service,
        .legend-content .esri-legend__layer {
            margin: 0 !important;
            padding: 0 !important;
        }

        .legend-content .esri-legend__layer-table {
            font-size: 11px !important;
        }

        .legend-content .esri-legend__symbol {
            transform: scale(0.8);
            transform-origin: left center;
        }

    calcite-action-bar calcite-action {
        --calcite-action-text-display: inline;
    }

        calcite-action-bar calcite-action::part(text) {
            display: inline !important;
            visibility: visible !important;
            opacity: 1 !important;
        }

}
