:root {
    --orange: #ef7d00;
    --orange-dark: #c96a00;
    --orange-light: #fff3e6;
    --black: #1a1a1a;
    --gray-dark: #2e2e2e;
    --gray-mid: #6b6b6b;
    --gray-light: #f0f0f0;
    --white: #ffffff;
    --border: #e0e0e0;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: Arial, sans-serif;
    background: var(--gray-light);
    color: var(--black);
    display: flex;
    flex-direction: column;
}

/* ── HEADER ── */
#header {
    background: var(--orange);
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 64px;
    height: auto;
    flex-shrink: 0;
    flex-wrap: wrap;
}

#logo {
    width: 100px;
    height: auto;
    padding: auto;
}

.header-separator {
    width: 1px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.7);
    margin: 0 16px;
    flex-shrink: 0;
}

#header-text {
    flex: 1 1 auto;
    min-width: 0;
    padding: 10px 0;
}

#header-title {
    font-size: clamp(15px, 2vw, 24px);
    font-weight: 700;
    font-family: 'HelveticaNeue-CondensedBold', 'Helvetica Neue LT Std 75 Bold', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: var(--white);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#header-subtitle {
    font-size: clamp(11px, 1.4vw, 16px);
    font-weight: 400;
    font-family: 'HelveticaNeue', 'Helvetica Neue LT Std 55 Roman', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: var(--white);
    margin-top: 2px;
    opacity: 0.9;
    line-height: 1.3;
}

/* ── FILTERS (liaison type selection) ── */

.filters {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--white);
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    font-size: 13px;
}

.filter-title {
    font-weight: 700;
    margin-bottom: 4px;
}

.filters label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot.rcpv {
    background: rgb(239, 125, 0);
}

.dot.bt {
    background: rgb(0, 150, 255);
}

.dot.mt {
    background: rgb(0, 200, 100);
}

/* ── SEARCH BAR ────────────────────────────────────────────────────────── */

#search-wrapper {
    display: flex;
    align-items: stretch;

    position: relative;

    width: 380px;
    max-width: min(380px, 90vw);
    height: 36px;

    border: 1.5px solid #545759;
    border-radius: 2px;

    background: #545759;
    overflow: visible;

    margin-bottom: 10px;
}

#address-input {
    flex: 1;
    min-width: 0;

    height: 100%;
    padding: 0 12px;

    border: none;
    outline: none;

    background: var(--white);
    color: #545759;

    font: 13px Arial, sans-serif;

    border-radius: 2px 0 0 2px;
}

#address-input::placeholder {
    color: #545759;
    opacity: 0.6;
}

#search-btn {
    flex-shrink: 0;

    padding: 0 14px;

    border: none;
    border-left: 2px solid #545759;
    border-radius: 0 2px 2px 0;

    background: var(--white);
    color: #545759;

    font: 700 13px Arial, sans-serif;

    cursor: pointer;
    white-space: nowrap;

    transition: background 0.15s, color 0.15s;
}

#search-btn:hover {
    background: #545759;
    color: #ffffff;
}

#search-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;

    z-index: 200;

    max-height: 240px;
    overflow-y: auto;
    display: none;

    background: var(--white);

    border: 1px solid var(--border);
    border-top: 2px solid var(--orange);
    border-radius: 0 0 4px 4px;

    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 8px;

    padding: 9px 14px;

    font-size: 13px;
    color: var(--gray-dark);

    cursor: pointer;
    border-bottom: 1px solid var(--border);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: var(--orange-light);
}

/* Mobile */
@media (max-width: 700px) {
    #search-wrapper {
        width: min(380px, 80vw);
    }
}

/* ── MAP ── */
#main {
    position: relative;
    flex: 1 1 0;
    width: 100%;
    overflow: hidden;
}

#viewDiv {
    width: 100%;
    height: 100%;
}

#addressHeader {
    display: grid;
    grid-template-columns: 1fr 1fr;
    font-weight: 700;
    padding: 5px 12px;
    font-size: 11px;
    background: var(--black);
    color: var(--white);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    flex-shrink: 0;
}

#addressList {
    overflow-y: auto;
    max-height: 300px;
}

#addressList::-webkit-scrollbar {
    width: 5px;
}

#addressList::-webkit-scrollbar-track {
    background: var(--gray-light);
}

#addressList::-webkit-scrollbar-thumb {
    background: var(--orange);
    border-radius: 3px;
}

#addressList .addr-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 6px 12px;
    font-size: 13px;
    color: var(--gray-dark);
    border-bottom: 1px solid var(--border);
}

#addressList .addr-row:last-child {
    border-bottom: none;
}

#addressList .addr-liaison {
    color: var(--gray-mid);
}

/* ── ESRI OVERRIDES ─────────────────────────────────────────────────────── */

.esri-ui-top-left,
.esri-ui-top-right {
    top: 0px !important;
}
.esri-ui-bottom-right {
    margin-bottom: 10px;
}

.esri-ui-bottom-left {
    margin-bottom: 10px;
}

.esri-widget {
    font-family: Arial, sans-serif !important;
    border-radius: 3px !important;
}

.esri-zoom .esri-widget--button {
    border-radius: 3px !important;
}

/* Search above compass */
.esri-ui-top-right .esri-widget {
    margin-top: 0;
}

/* Slight gap between search and compass */
.esri-ui-top-right #search-wrapper {
    margin-bottom: 8px;
}


/* ── RESPONSIVE ─────────────────────────────────────────────────────────── */

/* Tablets */
@media (max-width: 1000px) {

    #header {
        padding: 10px 14px;
        gap: 10px;
        font-size: 56px;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        display: flex;
    }

    #logo {
        width: clamp(80px, 10vw, 110px);
        height: auto;
        flex-shrink: 0;
        align-self: center;
    }

    #header-text {
        flex: 1;
        min-width: 0;

        display: flex;
        flex-direction: column;
        justify-content: center;

        padding: 0;
    }

    #header-subtitle {
        white-space: normal;
        overflow-wrap: break-word;
        line-height: 1.3;
        max-width: 360px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        /* Standard property for compatibility */
        line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }


    .filters {
        order: 3;
        flex-shrink: 0;
    }

}

/* Mobile */
@media (max-width: 700px) {

    #header {
        flex-direction: column;
        align-items: stretch;
        padding: 10px;
        gap: 8px;
    }

    #header-text {
        padding: 0;
    }

    #header-title {
        white-space: normal;
        font-size: 16px;
        line-height: 1.3;
    }

    .filters {
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        gap: 10px;
        width: 100%;
    }

    .filter-title {
        margin-bottom: 0;
    }

    #search-wrapper {
        width: 100%;
        max-width: 100%;
        flex: 1 1 100%;
    }

    #search-btn {
        min-width: 110px;
    }

    .header-separator {
        display: none;
    }
}

/* Small phones */
@media (max-width: 480px) {

    #logo {
        width: 80px;
    }

    #header-title {
        font-size: 14px;
    }

    #search-btn {
        min-width: 90px;
        padding: 0 10px;
        font-size: 12px;
    }

    #address-input {
        font-size: 12px;
    }

    .esri-widget--button {
        width: 44px !important;
        height: 44px !important;
    }
}