:root {
    --code-font-family: Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --background: rgb(23, 23, 23);
        --separator: dimgray;
        --separator-accent: rgb(57, 57, 57);
        --tab-controls: rgb(57, 57, 57);
        --tab-button-background: rgb(43, 42, 50);
        --text-color: white;
        --tab-button-active-background: rgb(22 100 219);
        --tab-button-active-color: var(--text-color);
        --tab-button-border: rgb(96, 96, 96);
        --hoverable-background: #31383e;
        --selected-border: cyan;
        --console-prompt-color: cyan;
        --console-message-color: lightskyblue;
        --console-warning-color: orange;
        --console-input-color: rgb(57, 57, 57);
        --console-input-focus-color: cyan;
        --console-table-row-odd: rgb(57, 57, 57);
        --console-table-row-hover: rgb(80, 79, 79);
        --console-table-border: gray;
        --property-table-head: rgb(57, 57, 57);
        --property-table-row: rgb(45, 45, 45);
    }
}

@media (prefers-color-scheme: light) {
    :root {
        --background: white;
        --separator: lightgray;
        --separator-accent: white;
        --tab-controls: rgb(229, 229, 229);
        --tab-button-background: white;
        --text-color: black;
        --tab-button-active: rgb(22 100 219);
        --tab-button-border: rgb(242, 242, 242);
        --hoverable-background: rgb(236, 236, 236);
        --selected-border: blue;
        --console-prompt-color: blue;
        --console-message-color: blue;
        --console-warning-color: darkorange;
        --console-input-color: rgb(229, 229, 229);
        --console-input-focus-color: blue;
        --console-table-row-odd: rgb(229, 229, 229);
        --console-table-row-hover: rgb(199, 198, 198);
        --console-table-border: gray;
        --property-table-head: rgb(229, 229, 229);
        --property-table-row: rgb(240, 240, 240);
    }
}

html {
    background-color: var(--background);
}

body {
    font-family: system-ui, sans-serif;
    font-size: 10pt;

    margin: 0;
}

.split-view {
    width: 100vw;
    height: 100vh;

    overflow: hidden;
}

.split-view-container {
    max-height: calc(100% - 40px);
    min-height: 40px;
}

.split-view-separator {
    background-color: var(--separator);

    width: 100%;
    height: 5px;

    display: flex;
    justify-content: center;

    cursor: row-resize;
    user-select: none;

    z-index: 100;
}

.split-view-separator circle {
    fill: var(--separator-accent);
}

.tab-controls-container {
    background-color: var(--tab-controls);

    width: 100%;

    padding: 4px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    z-index: 100;
}

.tab-controls {
    overflow: hidden;
    flex-shrink: 0;
}

.tab-controls button {
    color: var(--text-color);
    background-color: var(--tab-button-background);

    font-size: 12px;
    font-weight: 600;

    float: left;
    border: none;
    outline: none;
    cursor: pointer;

    padding: 4px 8px;
}

.tab-controls :first-child {
    border-radius: 0.5rem 0 0 0.5rem;
}

.tab-controls :last-child {
    border-radius: 0 0.5rem 0.5rem 0;
}

.tab-controls button.active {
    background-color: var(--tab-button-active-background);
    color: var(--tab-button-active-color);
}

.tab-controls button + button {
    border-left: 1px solid var(--tab-button-border);
}

.global-controls {
    margin: 0 8px 0 8px;
}

.global-controls button {
    width: 24px;
    height: 24px;

    border: none;
    outline: none;
    cursor: pointer;
}

#export-inspector-button {
    background-image: url("resource://icons/16x16/download.png");
    background-position: center;
    background-repeat: no-repeat;
    background-color: var(--tab-controls);
}

#export-inspector-button:hover {
    background-color: var(--tab-button-background);
}

.tab-content {
    height: calc(100% - 40px);

    display: none;

    padding: 8px 0px 0px 4px;

    overflow: auto scroll;
}

.tab-header {
    position: sticky;
    top: 2px; /* FIXME: Remove this when https://github.com/LadybirdBrowser/ladybird/issues/1245 is resolved. */
    left: 0;
    right: 0;
    background-color: var(--tab-controls);
    border-top: 2px solid var(--background);
    display: flex;
    padding: 0.5em;
}

details > :not(:first-child) {
    display: list-item;
    list-style: none inside;
    margin-left: 1em;
}

.hoverable {
    display: block;
    padding: 1px;
}

.dom-editor {
    width: fit-content;
    outline: none;
}

.hoverable:hover {
    background-color: var(--hoverable-background);
}

.selected {
    border: 1px dashed var(--selected-border);
    padding: 0;
}

#console {
    overflow: unset;
}

.console {
    font-family: var(--code-font-family);
    width: 100%;
    height: 100%;
}

.console-output {
    height: calc(100% - 32px);
    overflow: auto scroll;
}

.console-input {
    background-color: var(--console-input-color);
    width: 100%;
    height: 24px;
    padding: 4px;
    position: absolute;
    bottom: 0;
    left: 0;
}

.console-input input {
    width: calc(100% - 60px);
}

.console-input input:focus {
    outline: 1px dashed var(--console-input-focus-color);
}

.console-prompt {
    color: var(--console-prompt-color);
}

.console-message {
    color: var(--console-message-color);
}

.console-warning {
    color: var(--console-warning-color);
}

.property-table {
    width: 100%;

    table-layout: fixed;
    border-collapse: collapse;
}

.property-table th {
    background-color: var(--property-table-head);
    position: sticky;
    top: 0px;
}

.property-table th,
.property-table td {
    padding: 4px;
    text-align: left;

    overflow: hidden;
    text-overflow: ellipsis;
}

.property-table tr:nth-child(even) {
    background-color: var(--property-table-row);
}

#fonts {
    display: flex;
    flex-direction: row;
}

#fonts-list {
    display: flex;
    flex-direction: column;
}

#fonts-list .font {
    display: flex;
    flex-direction: row;
}

#fonts-list .font div {
    padding: 4px;
}

#fonts-list .font div.name {
    background-color: var(--property-table-head);
    font-weight: bold;
    padding-left: 10px;
    padding-right: 10px;
}

.console-log-table {
    width: 100%;
    padding: 0 10px;
    box-sizing: border-box;
}

.console-log-table table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    border: 1px solid var(--console-table-border);
}

.console-log-table thead {
    border-bottom: 1px solid var(--console-table-border);
}

.console-log-table th {
    position: sticky;
    top: 0px;
    border: 1px solid var(--console-table-border);
}

.console-log-table td {
    border-left: 1px solid var(--console-table-border);
    border-right: 1px solid var(--console-table-border);
}

.console-log-table tbody tr:nth-of-type(2n + 1) {
    background-color: var(--console-table-row-odd);
}

.console-log-table tbody tr:hover {
    background-color: var(--console-table-row-hover);
}

.console-log-table th,
.console-log-table td {
    padding: 4px;
    text-align: left;
}

#style-sheet-picker {
    flex-grow: 1;
}

#style-sheet-source {
    font-size: 10pt;
    font-family: var(--code-font-family);
    white-space: pre;
    padding: 0.5em;
}
