* {
    box-sizing: border-box;
}

html {
    font-family: "Calibri", sans-serif;
    font-size: 18px;
}

body {
    margin: 0;
    display: grid;
    justify-content: stretch;
    grid-template-rows: auto 1fr;
    grid-template-columns: 1fr auto;
    grid-template-areas: 'header header'
                         'main sidebar';

    background-color: #EDEDED;
    height: 100vh;
}

input, textarea, #label, button {
    font-size: 100%;
}

header {
    grid-area: header;

    background-color: #002E5F;
    color: #FFFFFF;

    width: 100vw;
    padding: 1rem;

    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

h1, h3 {
    font-weight: initial;
    margin-top: 0;
    margin-bottom: 0;
}

#access-denied {
    place-self: center;
}

.hidden {
    display: none;
}

main {
    grid-area: main;
}

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

#sidebar {
    grid-area: sidebar;

    background-color: #ffffff;
    border-left: 0.1rem solid #bababa;
    padding: 0.4rem;

    display: flex;
    flex-direction: column;
    gap: 0.4rem;

    width: 19rem;
    height: 100%;
}

#search-field {
    display: flex;
    justify-content: space-between;
    gap: 0.1rem;
}

#search-term {
    flex-grow: 3;
}

#search-results {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;

    overflow-y: auto;
    height: 0;
    flex-grow: 1;
    flex-shrink: 1;
    flex-basis: auto;
}

#search-spinner {
    max-width: 7rem;
    align-self: center;
}

.search-result {
    border: 2px solid #DADADA;
    border-radius: 0.5rem;
    padding: 0.2rem;
}

.search-result.active {
    background-color: #bec297;
}

.search-result .person, .workspace-name, .person-name, .comment-text {
    font-weight: bold;
}

.search-result .role:before, .person-role:before {
    content: ', ';
}

.search-result .comment {
    font-style: italic;
}

.search-result .comment:before {
    content: '(';
}

.search-result .comment:after {
    content: ')';
}

.map-flex {
    display: flex;
}

.map-flex.dim {
    opacity: 0.5;
}

.map-icon {
    text-wrap: nowrap;
}

.map-icon img {
    height: 20px;
}

.map-icon .label {
    background-color: #ededed;
    margin-left: 4px;
    padding-left: 4px;
    padding-right: 4px;
    border-radius: 4px;
}

.map-icon .label.no-label {
    display: none;
}

.map-icon .person {
    font-weight: bold;
}

form > * + * {
    margin-top: 0.2rem;
}

.popup-form label, .popup-form input {
    display: block;
}

input, textarea {
    border: 2px solid #DADADA;
    border-radius: 0.5rem;
    padding: 0.5rem;
}

textarea {
    flex-grow: 10;
}

button {
    color: #FFFFFF;
    background-color: #002E5F;
    border: 2px solid #33587F;
    border-radius: 0.5rem;
    padding: 0.5rem;
    white-space: nowrap;
}

button:hover {
    background-color: #33587F;
}

button:disabled {
    color: #000000;
    background-color: #BABABA;
    border: 2px solid #BABABA;
}

button.cancel {
    color: #000000;
    background-color: #BABABA;
    border: 2px solid #DADADA;
}
button.cancel:hover {
    background-color: #BABABA;
}

button.delete {
    background-color: #D30000;
    border: 2px solid #E43B3B;
}
button.delete:hover {
    background-color: #E43B3B;
}

@media (width <= 45rem) {
    body {
        grid-template-rows: auto 1fr auto;
        grid-template-areas: 'header'
                             'main'
                             'sidebar';
    }

    h1 {
        font-size: 1.2rem;
    }

    #sidebar {
        border-left: initial;
        border-top: 0.1rem solid #bababa;

        width: initial;
        height: initial;
        max-height: 40vh;
        margin-bottom: 3rem;
    }

    #search-results {
        height: unset;
    }
}
