:root {
    --border-color: #ccc;
    --border-width: 1px;
    --dark-border-color: #555;
    --element-dark-bgcolor: #292a2d;
    --highlight-dark-color: #444;
    --highlight-light-color: #ddd;
    --shadow-bottom-light: inset 0 -4px 4px -4px rgba(0, 0, 0, 0.4);
    --shadow-top-light: inset 0 4px 4px -4px rgba(0, 0, 0, 0.4);
    --shadow-bottom-dark: inset 0 -6px 4px -4px rgba(0, 0, 0, 0.5);
    --shadow-top-dark: inset 0 6px 4px -4px rgba(0, 0, 0, 0.5);
    --status-bar-height: 20px;
    --strong-highlight-dark-color: #777;
    --strong-highlight-light-color: #aaa;
    --text-dark-color: #f8f8f2;
}

.both-sides-shadow {
    box-shadow: var(--shadow-top-light), var(--shadow-bottom-light);
}

.top-shadow {
    box-shadow: var(--shadow-top-light);
}

.bottom-shadow {
    box-shadow: var(--shadow-bottom-light);
}

.top-border {
    border-top: var(--border-width) solid var(--border-color);
}

.dialog-scroll-container {
    /* It appears currently impossble to get the heights of the surrounding elements without using
     * JavaScript and/or maintaining a list of these elements. */
    height: calc(100vh - 200px);

    margin: 0;
    overflow-y: scroll;
    padding: 0;
}

div#status-bar {
    background-color: #fff;
    border-top: var(--border-width) solid var(--border-color);
    bottom: 0;
    color: #555;
    height: var(--status-bar-height);
    left: 0;
    position: fixed;
    right: 0;
}

p#status-text {
    display: unset;
    font-size: 9pt;
    line-height: 0;
    padding-left: 10px;
    vertical-align: middle;
    white-space: nowrap;
}

div#menu-border {
    background-color: #fff;
    border-bottom: var(--border-width) solid var(--border-color);
    height: 0px;
    left: 0;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 1000;
}

div#blocked-content-info {
    background-color: #ffffe1;
    border-bottom-style: solid;
    border-top-style: solid;
    border-color: #ddd;
    border-width: var(--border-width);
    color: black;
    cursor: pointer;
    height: 30px;
    left: 0;
    line-height: 30px;
    overflow: hidden;
    position: fixed;
    right: 0;
    text-align: left center;
    top: 0;
    z-index: 1000;
}

p.blocked-content-info-text {
    font-size: 10pt;
    margin-bottom: 0px;
    margin-top: 0px;
    padding-left: 10px;
    padding-right: 10px;
}

span#blocked-content-info-text-container {
    display: table-cell;
    width: 100%;
}

span#blocked-content-info-close-button {
    display: table-cell;
}

div.dialog-content {
    font-size: 11pt;
}

div.dialog-input-field {
    margin: 1em 0;
    width: 100%;
}

input#search-input {
    width: 100%;
}

.dialog-buttons {
    background-color: #fff;
    bottom: 0;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin: 0;
    padding: 10px 10px 20px 10px;
}

.dialog-buttons button {
    height: 2em;
    min-width: 70px;
}

dialog {
    padding-bottom: 0;
    width: 80%;
}

dialog * {
    cursor: default;
}

dialog h1 {
    border-bottom: 1px solid var(--border-color);
    font-size: 13pt;
    margin-top: 20px;
}

dialog a,
dialog a * {
    cursor: pointer;
}

input[type="text"],
input[type="number"] {
    box-sizing: border-box;
    cursor: text;
}

span#error-dialog-content {
    cursor: text;
}

/* Based on https://stackoverflow.com/a/25210414 (Is it possible to always show up/down arrows for input "number"?) */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    opacity: 1;
}

main#content {
    display: flex;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
}

div#separator {
    background-color: var(--border-color);
    cursor: col-resize;
    flex-grow: 0;
    flex-shrink: 0;
    margin: -10px 10px -30px 0;
    width: 3px;

    /* Prevent the browser's built-in drag from interfering */
    user-select: none;
}

nav#toc {
    display: none;
    margin: 0px 0px var(--status-bar-height) 0px;
    max-width: calc(100% - 100px);
    min-width: 20px;
    overflow: auto;
    padding: 10px;
    width: 20%;
}

nav#toc * {
    cursor: default;
    vertical-align: middle;
}

div.toc-section {
    margin: 0px -10px;
    padding: 0;
}

div.toc-section a {
    color: black;
    display: inline-block;
    font-size: 11pt;
    height: 100%;
    padding: 5px 0px;
    text-decoration: none;
}

div.toc-section:hover {
    background-color: var(--highlight-light-color);
}

span.toc-expand-button {
    display: inline-block;
    padding: 5px;
}

span.toc-expand-button img {
    height: 0.8em;
    padding: 0.2em;
    width: 0.8em;
}

span.toc-expand-button:hover {
    background-color: var(--strong-highlight-light-color);
}

article#content-body {
    margin: 0px 0px var(--status-bar-height) 0px;
    overflow: auto;
    padding: 10px 15px 10px 10px;
    width: 100%;
}

article#content-body:focus {
    outline: none;
}

span.search-result {
    background-color: var(--highlight-light-color);
}

span#selected-search-result {
    background-color: var(--strong-highlight-light-color);
}

div.dialog-tab-container {
    align-items: stretch;
    display: flex;
}

div.dialog-tab {
    border-color: var(--border-color);
    border-style: solid;
    border-width: var(--border-width);
    cursor: default;
    flex-grow: 1;
    margin: 0px;
    padding: 10px;
}

div.unselected-tab:hover {
    background-color: var(--highlight-light-color);
}

div.dialog-tab-content {
    border-color: var(--border-color);
    border-style: solid;
    border-width: var(--border-width);
    border-bottom-style: none; /* Button container below has its own border */
    border-top-style: none; /* Needs to be after other border definitions */
    padding: 5px 20px;
}

#about-dialog .dialog-content * {
    margin: auto;
    margin-bottom: 1rem;
}

#about-dialog .dialog-content h1,
#about-dialog .dialog-content h2,
#about-dialog .dialog-content p {
    text-align: center;
}

img#application-icon {
    height: 15rem;
}

p#issue-link-paragraph {
    text-align: right !important;
}

#about-dialog h1 {
    border-bottom-style: none;
    font-size: 20pt;
}

#about-dialog th,
#about-dialog td {
    text-align: left;
}

@media (prefers-color-scheme: dark) {
    .both-sides-shadow {
        box-shadow: var(--shadow-top-dark), var(--shadow-bottom-dark);
    }

    .top-shadow {
        box-shadow: var(--shadow-top-dark);
    }

    .bottom-shadow {
        box-shadow: var(--shadow-bottom-dark);
    }

    .top-border {
        border-top: var(--border-width) solid var(--dark-border-color);
    }

    div.info {
        background-color: #726a95;
    }

    div.warning {
        background-color: #ba6b57;
    }

    div.error {
        background-color: #8f4068;
    }

    #raw-text {
        color: var(--text-dark-color);
    }

    div#status-bar {
        background: var(--element-dark-bgcolor);
        border-top: var(--border-width) solid var(--dark-border-color);
        color: var(--text-dark-color);
    }

    div#menu-border {
        background-color: var(--element-dark-bgcolor);
        border-bottom: var(--border-width) solid var(--dark-border-color);
    }

    div#blocked-content-info {
        background-color: #7a1f28;
        border-color: black;
        color: var(--text-dark-color);
    }

    div#separator {
        background-color: var(--dark-border-color);
    }

    div.toc-section a,
    div.toc-section * {
        color: var(--text-dark-color);
    }

    div.toc-section:hover {
        background-color: var(--highlight-dark-color);
    }

    span.toc-expand-button:hover {
        background-color: var(--strong-highlight-dark-color);
    }

    span.search-result {
        background-color: var(--highlight-dark-color);
    }

    span#selected-search-result {
        background-color: var(--strong-highlight-dark-color);
    }

    .dialog-buttons {
        background-color: var(--element-dark-bgcolor);
    }

    dialog,
    input {
        background-color: var(--element-dark-bgcolor);
        color: var(--text-dark-color);
    }

    dialog h1 {
        border-bottom-color: var(--dark-border-color);
    }

    div.dialog-tab {
        border-color: var(--dark-border-color);
    }

    div.unselected-tab:hover {
        background-color: var(--highlight-dark-color);
    }

    div.dialog-tab-content {
        border-color: var(--dark-border-color);
    }
}
