html,
body {
    font-family: system-ui, sans-serif;
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
}

#map {
    height: 100%;
    width: 100%;
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
}

#sidebar {
    position: fixed;
    background-color: rgba(255, 255, 255, 0.6);
    left: 0;
    top: 0;
    bottom: 0;
    min-width: 310px;
    max-width: 99vw;
    width: auto;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

#sidebar.collapsed {
    width: 10px !important;
    min-width: 5px;
    background: transparent;
}

#sidebar.collapsed>* {
    display: none;
}

#sidebar.collapsed>button.show {
    display: block;
    left: 0;
    top: 0;
    pointer-events: all;
    z-index: 10;
    right: auto;
    font-size: 2em;
    padding: 0.8em;
}

#sidebar.collapsed>#resizer {
    display: block;
    padding-right: 2.5rem;
    right: -2.5rem;
}

#sidebar.collapsed>#resizer div {
    border-left: 10px solid black;
    border-right: none;
    width: 0;
}

[hidden] {
    display: none !important;
}

.tab-content-container {
    flex: 1;
    /* Take up all available space */
    overflow-y: auto;
    /* Enable vertical scrolling */
}

.tab-bar {
    display: flex;
    background-color: #f0f0f0;
    border-top: 1px solid #ccc;
    pointer-events: auto;
}

.tab-bar a {
    padding: 10px;
    display: block;
    text-decoration: none;
    color: black;
    flex: 1 1 0px;
    text-align: center;
    border-right: 1px solid black;
}

.tab-bar a:last-child {
    border-right: none;
}

/* Hide all tab content by default */
.tab-content {
    display: none;
}

/* Initially display the first tab content */
.tab-content:first-of-type {
    display: block;
}

/* Hide other tabs when one is targeted */
.tab-content-container :target {
    display: block;
}

.tab-content-container:has(:target) .tab-content:not(:target) {
    display: none;
}

.tab-bar a:target {
    background-color: rgba(255, 255, 255, 0.4);
}

ol {
    list-style: none;
    padding: 0;
    margin: 0;
}

.node-list li,
.packet-list li {
    padding: .5em 1em;
    border-bottom: 1px solid white;
}

.node-list li {
    cursor: pointer;
}

.tab-content-container section {
    padding: 0;
    margin: 0;
    pointer-events: auto;
}

#sidebar h1 {
    margin: 0;
    padding: 1em;
    font-size: 1.2em;
    line-height: 1.2em;
    text-align: center;
}

.node-list li.is-offline {
    opacity: 0.5;
}

.node-list li.is-old {
    display: none;
}

.node-list li:hover {
    background-color: rgba(255, 255, 255, 0.5);

    opacity: 1;
}

.node-list li.selected {
    background-color: rgba(255, 255, 255, 0.2);

    opacity: 1;
}

.node-list li.selected:hover {
    background-color: rgba(255, 255, 255, 0.6);
}

dl {
    display: grid;
    grid-template: auto / auto 1fr;
    margin: 0;
    padding: 0;
}

dt {
    grid-column: 1;
    font-weight: 600;
    min-width: 100px;
}

dd {
    grid-column: 2;
    max-width: 300px;
    margin-left: 1.2em;
}

.maplibregl-popup-content dt {
    min-width: 80px;
}

#resizer {
    background: transparent;
    position: absolute;
    right: -1rem;
    top: 50%;
    margin-top: -1rem;
    padding: 1rem;
    pointer-events: all;
    cursor: ew-resize;
}

#resizer div {
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-right: 5px solid black;
    width: 5px;
    height: 3rem;
    margin-top: -1.5rem;
}

svg.icon {
    display: inline-block;
    height: 1.2em;
    width: 1.2em;
    vertical-align: top;
}

button.list-action {
    display: block;
    padding: 0.5em;
    box-sizing: border-box;
    width: 100%;
    font-size: 1.1em;
    margin: 0.5em 0;
}

#sidebar-main {
    display: flex;
    flex-direction: column;
}

#sidebar-main,
#sidebar-details {
    pointer-events: auto;
    min-height: 100%;
}

#sidebar-details {
    overflow-y: auto;
    padding: .5em;
    background: (255, 255, 255, .7);
}

dialog {
    min-width: 35vw;
    max-width: 96vw;
    border: none;
    border-radius: 10px;
}


dialog button.close {
    float: right;
    padding: .6em;
}

dialog h1 {
    margin-top: 0;
    font-size: 1.8em;
    white-space: nowrap;
    margin-right: 5rem;
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.5);
}

svg.logo {
    max-width: 512px;
    margin: 0 auto;
    width: auto;
    height: auto;
    display: block;
}

button.back {
    position: absolute;
    cursor: pointer;
    margin: .8rem 0;
    height: 1.6em;
    min-width: 1.6em;
    font-size: 1em;
    line-height: 1.6em;

    background: white;
    border-radius: 5px;
    border: none;
    box-shadow: 1px 1px black;
    font-weight: 500;
}

button.settings,
button.hide,
button.show {
    box-sizing: content-box;
    position: absolute;
    right: 0;
    font-size: 1.1em;
    padding: 1em 1.2em;
    margin: 0;
    background: transparent;
    border: none;
    outline: none;
    cursor: pointer;
}

button.settings {
    right: auto;
    left: 0;
}

button.show {
    display: none
}

button.about {
    margin: 0 auto;
}

#settings {
    padding: .5em 1em;

    display: none;
    padding-bottom: 1em;
}

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

#settings .input-note {
    margin-top: 0;
}

#settings.visible {
    display: block;
}

/* Reduce font size and margin for smaller devices */
@media only screen and (max-device-width: 960px) {
    main {
        font-size: 13px;
    }

    .node-list li,
    .packet-list li {
        padding: .4em .5em;
    }
}

ul.gateway-selector {
    cursor: pointer;
}

ul.gateway-selector li.selected {
    text-decoration: underline;
}

.received-by-gateway h2 {
    margin-bottom: 0;
}

.received-by-gateway p {
    margin: 0;
}
