:root {
    --bg-color: white;
    --color: #121212;
    --highlight: rgba(0,0,0,.05);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #121212;
        --color: #eee;
        --highlight: rgba(255,255,255,.1);
    }
}


html {
    font-family: 'Roboto', sans-serif;
    font-size: 12px;
    line-height: 1.5;
    scroll-behavior: smooth;
}

body {
    font-size: 1.33rem;
    max-width: 70ch;
    padding: 1rem;
    margin: auto;
    background-color: var(--bg-color);
    color: var(--color);
}

button, .btn, input {
    color: inherit;
    background: transparent;
    border: 1px solid;
    padding: .5em .75em;
    border-radius: .25em;
    text-transform: uppercase;
    display: inline-block;
    cursor: pointer;
    line-height: 1;
}

input {
    text-transform: none;
    background-color: var(--bg-color);
}

a { color: inherit; }

::placeholder {
  color: inherit;
  opacity: 1;
}

.warning {
    padding: 1.5em;
    margin-bottom: 2em;
    background-color: #ffeaa7;
    border-radius: 0.25em;
    color: #121212;
}

#location div { margin-bottom: 1em; }

#getLocation, #autocomplete input {
    padding-left: 2em;
    background-position: .5em center;
    background-repeat: no-repeat;
    background-size: 1em 1em;
    outline: none;
}

body.app.location #location div {
    display: none;
}

.align-center { text-align: center; }
.margin-auto { margin-left: auto; margin-right: auto; }
.hidden { display: none !important; }

body > header {
    text-align: center;
}

section {
    margin-top: 3rem;
}

section[data-title]:not(.hidden):before {
    content: attr(data-title);
    display: block;
    text-align: center;
    margin-bottom: 1.5em;
    font-size: 1.5em;
    font-weight: 600;
}

body.app #search {
    z-index: 10;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--bg-color);
    margin-top: 0;
    padding: 1em 1rem;
}

body.app #search #autocomplete ul {
    top: 0;
    transform: translateY(-100%);
    margin-top: -.25em;
    max-height: calc(100vh - 4em);
    overflow-y: auto;
}

#autocomplete {
    display: block;
    position: relative;
}

#autocomplete ul {
    position: absolute;
    left: 0;
    right: 0;
    list-style-type: none;
    padding: 0;
    margin: 0;
    text-align: left;
    border-radius: .25em;
    margin-top: .25em;
    pointer-events: none;
}

#autocomplete input {
    display: block;
    width: 100%;
}

#autocomplete ul.visible {
    border: 1px solid;
    pointer-events: auto;
    background-color: var(--bg-color);
    z-index: 10;
}

#autocomplete li {
    padding-left: 0.75em; /* other padding are defined by favorite svg */
    cursor: pointer;
    display: flex;
    align-items: center;
    line-height: 1.2;
}

#autocomplete li .line {
    padding: .25em .5em;
    border-radius: .2em;
    font-family: 'Red Hat Mono', monospace;
    margin-right: .5em;
    min-width: calc(2ch + 1em);
    text-align: center;
    display: inline-block;
}

#autocomplete li .name { font-weight: 500; }
#autocomplete li .destination { font-size: .8em; }
#autocomplete li .favorite { margin-left:auto;
flex-shrink: 0; }
#autocomplete li .favorite svg {
    margin: 2em .75em 2em 2em;
}

#location {
    padding: 1.5em;
    background-color: var(--highlight);
    border-radius: .25em;
}

#options {
    position: sticky;
    top:0;
    background-color: var(--bg-color);
    z-index: 8;
}

#options button {
    margin: 1em;
}

.card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2em;
    transition: all .3s ease-out;
    transition-property: max-height, margin-bottom;
}

.card.deleted {
    max-height: 0px !important;
    margin-bottom: 0px;
    overflow: hidden;
}

.card header {
    display: flex;
    flex-direction: row;
    align-items: center;
    font-weight: 500;
    flex: 1 1 auto;
}

.card .line {
    padding: .25em .5em;
    border-radius: .2em;
    font-family: 'Red Hat Mono', monospace;
    margin-right: .5em;
    font-size: 1em;
    min-width: calc(2ch + 1em);
    text-align: center;
}

.card .station {
    flex: 1 1 auto;
    margin-right: .5em;
}

.card .station > * {
    margin: 0;
    font-size: 1em;
    line-height: 1;
}

.card .station h3 { text-transform: uppercase; font-weight: 500; letter-spacing: 1px; margin-bottom: 0.25em;}
.card .station h4 {
    background-image: url('../images/direction.svg');
    background-repeat: no-repeat;
    background-position: left center;
    padding-left: 1.25em;
    background-size: 1em 1em;
    font-weight: 400; font-size: .8em;
    display: flex;
    align-items: center;
}

.card .station h4:before {
    content: "";
    background-repeat: no-repeat;
    background-position: left center;
    background-size: 1em 1em;
    width: 1em;
    height: 1em;
    margin-right: 0.25em;
    flex-shrink: 0;
}

.card[data-type="bus"] .station h4:before {
    background-image: url('../images/bus.svg');
}

.card[data-type="tram"] .station h4:before {
    background-image: url('../images/tram.svg');
}

.card .time {
    position: relative;
    height: 2em;
    user-select: none;
    font-family: 'Red Hat Mono', monospace;
    min-width: calc(5ch + 1.5em);
    font-size: 1.25em;
    line-height: 1;
}
.card .time > span {
    font-size: inherit;
    line-height: inherit;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    display: inline-block;
    padding: .5em .75em;
    border-radius: .25em;
    background-color: var(--highlight);
    user-select: none;
    cursor: pointer;
    background-position: center;
    background-repeat: no-repeat;
    background-size: 1em 1em;
    text-align: center;
    opacity: 0;
    transition: all .3s ease-in;
}

.card .time > span.visible {
    opacity: 1;
}

.card.delete .time:before {
    content: "";
    position: absolute;
    inset: 0 0 0 0;
    background-color: #e74c3c;
    border-radius: .25em;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24' fill='white'%3E%3Cpath d='M7 21Q6.175 21 5.588 20.413Q5 19.825 5 19V6H4V4H9V3H15V4H20V6H19V19Q19 19.825 18.413 20.413Q17.825 21 17 21ZM17 6H7V19Q7 19 7 19Q7 19 7 19H17Q17 19 17 19Q17 19 17 19ZM9 17H11V8H9ZM13 17H15V8H13ZM7 6V19Q7 19 7 19Q7 19 7 19Q7 19 7 19Q7 19 7 19Z'/%3E%3C/svg%3E");
    background-position: center;
    background-repeat: no-repeat;
    z-index: 5;
    cursor:pointer;
}

#tips {
    padding: 1em 0;
    border-radius: .5em;
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
}

#tips:before { content: "💡"; margin-right: 1ch; }

#tips p {
    margin: 0;
}

footer {
    margin-top: 3rem;
    font-size: .7em;
}

@media (prefers-color-scheme: dark) {

  .card .station h4 {
      background-image: url('../images/direction_dark.svg');
  }

  .card[data-type="bus"] .station h4:before {
      background-image: url('../images/bus_dark.svg');
  }

  .card[data-type="tram"] .station h4:before {
      background-image: url('../images/tram_dark.svg');
  }
}
