html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

html {
    font-family: system-ui, sans-serif;
    font-size: 11pt;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.0;
    transform: scale(10.0);
    transition: transform ease-in-out 750ms, opacity ease-in-out 250ms;
    z-index: 100;
    display: none;
    background: white;
}

.modal-overlay-content {
    margin: auto;
    height: 120px;
    text-align: center;
    font-size: 1em;
    font-weight: 100;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    padding-bottom: 100px;
}

.modal-overlay-content > span {
    display: block;
}

.modal-overlay-content > img,
.modal-overlay-content > svg {
    display: inline-block;
    width: 80px;
    height: 80px;
    margin-bottom: 10px;
}

@keyframes rotate {
    from {
        transform: rotate3d(0,1,0,90deg);
    }

    to {
        transform: rotate3d(0,1,0,0deg);
    }
}

#loading-message > img {
    transition: transform ease-in-out 750ms;
    transform: rotate3d(0,1,0,90deg);
}

#loading-message img.loaded {
    animation-duration: 1s;
    animation-name: rotate;
    animation-iteration-count: infinite;
    animation-direction: alternate;
}

#popup {
    z-index: 150; /* even above the input field when .locate-manual is active */
}

#popup p {
    max-width: 300px;
    margin: 20px auto;
    line-height: 1.25em;
    text-align: left;
}

#popup button {
    display: block;
    max-width: 300px;
    margin: 20px auto;
    background: #016DBE;
    color: white;
    border: 0;
    font: inherit;
    padding: 8px;
    width: 100%;
    box-sizing: border-box;
}

.map {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
}

.is-embedded .map {
    bottom: auto;
    height: 250px;
}

.drawer {
    box-sizing: border-box;
    position: absolute;
    top: 200px; /* automatically updated on non-embedded mobile */
    left: 0;
    right: 0;
    border-radius: 10px 10px 0 0;
    height: auto;
    background: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    padding: 20px 0 40px 0;
    overflow-x: hidden;
    font-size: 1.2em;
    z-index: 20;
}

.drawer:before {
    content: '';
    position: absolute;
    top: 8px;
    left: 0;
    right: 0;
    margin: 0 auto;
    width: 40px;
    height: 4px;
    background: #ccc;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) inset;
}

.drawer-content {
    position: relative;
    padding-bottom: 100px;
    min-height: 100%;
    box-sizing: border-box;
}

.drawer-content .geodienst-link {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    text-decoration: none;
    font-size: 0.5em;
    color: #777;
    text-align: center;
}

.drawer-content .geodienst-link img {
    width: 80%;
    display: block;
    margin: 0 auto;
    box-sizing: border-box;
}

.drawer h2,
.drawer h3 {
    margin: 4px 0;
}

.drawer h2 {
    font-size: 1.25rem; /* Let op deze wordt overschreven per locatie door fitFontSize */
}

.drawer h3 {
    font-size: 1.0rem;
}

.drawer > .hidden {
    display: none;
}

.location-control {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    text-align: right;
    pointer-events: visiblePainted;
}

.location-address-bar {
    display: inline-block;
    margin: 10px;
    background: white;
    border: none;
    font: 14px/22px sans-serif;
    width: 100%;
    max-width: 190px;
    transition: all 250ms ease-in-out;
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.2);
    color: #777;
    box-sizing: border-box;
    position: relative;
}

.location-address-bar > svg {
    width: 14px;
    height: 14px;
    position: absolute;
    left: 8px;
    top: 12px;
    fill: #888;
    pointer-events: none;
    transition: transform 300ms ease-in-out, opacity 300ms ease-in-out;
}

.location-control .location-address-bar > .location-address-clear-button {
    position: absolute;
    display: block;
    top: 7px;
    right: 10px;
    background: transparent;
    color: #777;
    opacity: 0.8;
    border: 0;
    width: 24px;
    height: 24px;
    font: 16px/8px system-ui sans-serif;
    text-align: center;
    padding: 0;
}

.location-control .location-address-bar > .location-address-clear-button:hover,
.location-control .location-address-bar > .location-address-clear-button:focus {
    background: #ccc;
    outline: none;
}

.location-control .location-address-bar > input:placeholder-shown + .location-address-clear-button {
    display: none;
}

/* Tekstveld */

.location-control input {
    font: inherit;
    color: inherit;
    margin: 0;
    padding: 8px 26px;
    width: 100%;
    border: 0;
    box-sizing: border-box;
    transition: padding 300ms ease-in-out;
}

.location-control input:focus {
    outline: none;
}

.location-control.focussed {
    transition: box-shadow 300ms ease-in-out;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    z-index: 40;
}

.location-control.focussed .location-address-bar {
    max-width: 100%;
    margin: 0;
    outline: none;
    box-shadow: none;
    color: #000;
    border-radius: 0;
    padding: 10px 0;
}

.location-control.focussed .location-address-bar > input {
    padding-left: 10px;
}

.location-control.focussed .location-address-bar > svg {
    opacity: 0;
}

.location-control.focussed .location-address-bar > .location-address-clear-button {
    transform: translateY(8px);
}

/* Suggesties */

.location-control .location-suggestions {
    margin: 0;
    display: none;
    text-align: left;
    z-index: 10;
}

.location-control.focussed .location-suggestions {
    display: block;
}

.location-control button {
    display: none;
}

.location-suggestions {
    list-style: none;
    padding: 0;
    background: white;
}

.location-suggestions .location-suggestion {
    padding: 8px;
    cursor: pointer;
}

.location-suggestions .location-suggestion:hover,
.location-suggestions .location-suggestion:focus {
    background: #016DBE;
    color: white;
    outline: none;
}

.destination-control {
    padding-bottom: 20px;
}

.destination-control .swiper-pagination-bullet {
    width: 4px;
    height: 4px;
}

.destination-control .swiper-pagination-bullet-active {
    background: #f00;
}

.destination-control h2::before {
    content: '';
    background: url(stemlokaal-icon-2x.png) 0 0 no-repeat;
    background-size: contain;
    display: inline-block;
    width: 20px;
    height: 20px;
}

.destination-control p {
    margin: 4px 0;
}

/* Restyle standard leaflet components */

.hide-route .drawer #route {
    display: none;
}

.drawer .leaflet-routing-alt,
.drawer .leaflet-routing-geocoders,
.drawer .leaflet-routing-error {
    max-height: none;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

.drawer .leaflet-routing-alt .duration.bicycle::before {
    content: '';
    display: inline-block;
    background: url(bicycle.svg) center bottom no-repeat;
    background-size: contain;
    width: 1em;
    height: 1em;
    margin-right:0.2em;
}

.drawer .leaflet-routing-alt h2 {
    font-size: 1.0em;
    margin: 4px 20px;
}

.drawer .leaflet-routing-alt h3 {
    font-size: 0.8em;
    margin: 4px 20px;
}

.drawer .leaflet-routing-alt table {
    font-size: 1.0em;
}

.drawer .leaflet-routing-alt table > tbody > tr > td {
    padding: 4px 0;
}

.drawer .leaflet-routing-alt table > tbody > tr > td:nth-child(1) {
    padding-left: 20px;
}

.drawer .leaflet-routing-alt table > tbody > tr > td:nth-child(3) {
    text-align: right;
    white-space: nowrap;
    padding-right: 20px;
}

.drawer .leaflet-routing-alt.leaflet-routing-alt-minimized {
    max-height: 3em;
}

.drawer .leaflet-routing-container {
    width: auto;
    background: transparent;
    padding: 0;
    box-shadow: none;
    border-radius: 0;
    float: none;
}

.drawer .leaflet-routing-collapse-btn {
    display: none;
}

.nearest-location {
    padding: 10px 20px;
    box-sizing: border-box;
}

.nearest-location .openingstijden {
    font-size: 0.8em;
}

.nearest-location .uitzondering {
    color: red;
    cursor: help;
}

.nearest-location .uitzondering:hover {
    text-decoration: underline;
}

/* Loading animation stuff */

body > * {
    transition: transform ease-out 300ms, opacity ease-out 300ms;
}

body.loading > * {
    opacity: 0;
}

body.hide-drawer {
    overflow: hidden;
}

body.hide-drawer .drawer {
    transform: translateY(250px);
}

body.loading #loading-message,
body.locating #locating-message,
body.locating-manual #locating-manual-message,
body.popup-open #popup {
    display: block;
    opacity: 1.0;
    transform: scale(1.0); 
}

body.locating-manual #location-control {
    top: 50%;
    left: 0;
    right: 0;
    z-index: 110;
    text-align: center;
}

body.locating-manual #location-control .location-address-bar {
    max-width: 250px;
}

body.locating-manual #location-control.focussed .location-address-bar {
    max-width: 500px;
    border-bottom: 1px solid #ccc;
}

body.locating-manual #location-control.focussed .location-suggestions {
    max-width: 500px;
    margin: 0 auto;
}

/* Filter control */

.filter-control {
    display: flex;
    justify-content: center;
    margin: 0px 20px 0 20px;
    border-collapse: collapse;
    text-align: center;
    font-size: 0.8em;
}

.filter-control input {
    display: none;
}

.filter-control label {
    color: #016DBE;
    border: 1px solid #016DBE;
    border-right: none;
    padding: 4px 5px;
    flex: 1 0 0;
    cursor: pointer;
}

.filter-control label:first-of-type {
    border-radius: 4px 0 0 4px;
}

.filter-control label:last-of-type {
    border-right: 1px solid #016DBE;
    border-radius: 0 4px 4px 0;
}

.filter-control input:checked + label {
    background: #016DBE;
    color: white;
}

/* Desktop edition */

@media (min-width: 700px) {
    html, body {
        overflow: hidden;
    }

    .is-embedded .map {
        height: auto;
        bottom: 0;
    }

    .location-control {
        right: 272px;
        width: 500px;
        left: auto;
    }

    .filter-control {
        margin: 10px 10px 0 10px;
    }

    body.locating-manual .location-control {
        right: 0;
        left: 0;
        width: auto;
        max-width: 100%;
    }

    .location-control .location-address-bar {
        max-width: 250px;
        margin: 10px 0;
    }

    .location-control.focussed .location-address-bar > .location-address-clear-button {
        transform: none;
    }

    body.locating-manual .location-control.focussed,
    body.locating-manual .location-control.focussed .location-address-bar {
        box-shadow: none;
    }

    body.locating-manual .location-control.focussed .location-address-bar > .location-address-clear-button {
        transform: translateY(8px);
    }

    .location-control.focussed .location-address-bar {
        margin: 10px 0 0 0;
        padding: 0;
    }

    #popup p {
        max-width: 600px;
        font-size: 1.75em;
    }

    .drawer .leaflet-routing-container {
        background: white;
    }

    .drawer {
        border-right: 1px solid #ccc;
        position: fixed;
        top: 10px;
        right: 10px;
        bottom: auto;
        left: auto;
        width: 250px;
        max-height: calc(100% - 40px);
        margin-top: 0;
        padding: 0 0 20px 0;
        overflow-y: auto;
        border-radius: 0;
        background: white;
        box-shadow: 0 2px 3px rgba(0, 0, 0, 0.2);
        font-size: 1.0em;
    }

    .drawer::before {
        content: none;
    }

    body.hide-drawer .drawer {
        transform: translateX(260px);
        opacity: 0;
    }

    .nearest-location {
        padding: 10px;
    }

    .drawer .leaflet-routing-alt h2 {
        margin: 4px 10px;
    }

    .drawer .leaflet-routing-alt h3 {
        margin: 4px 10px;
    }

    .drawer .leaflet-routing-alt table > tbody > tr > td:nth-child(1) {
        padding-left: 10px;
    }

    .drawer .leaflet-routing-alt table > tbody > tr > td:nth-child(3) {
        padding-right: 10px;
    }
}

.thinking-emoji .hand {
    animation-duration: 1s;
    animation-name: thinking-hand;
    animation-iteration-count: infinite;
    animation-direction: alternate;
    transform-origin: 0 50%;
}

.thinking-emoji .left-eyebrow,
.thinking-emoji .right-eyebrow,
.cold-sweat-emoji .sweat {
    animation-duration: 1s;
    animation-iteration-count: infinite;
    animation-direction: alternate;
}

.thinking-emoji .left-eyebrow {
    animation-name: thinking-left-eyebrow;
}

.thinking-emoji .right-eyebrow {
    animation-name: thinking-right-eyebrow;
}

.cold-sweat-emoji .sweat {
    animation-name: thinking-right-eyebrow;
}

@keyframes thinking-left-eyebrow {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(-2px);
    }
}

@keyframes thinking-right-eyebrow {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(2px);
    }
}

@keyframes thinking-hand {
    from {
        transform: rotate(-5deg);
    }
    to {
        transform: rotate(5deg);
    }
}
