/* wConfig3: looks like the WinForms wConfig2 (Windows 10/11 classic controls) */

:root {
    --control: #f0f0f0;
    --window: #ffffff;
    --border: #828790;
    --button: #e1e1e1;
    --button-border: #adadad;
    --hot: #e5f1fb;
    --hot-border: #0078d7;
    --highlight: #0078d7;
    --highlight-text: #ffffff;
    --gray-text: #6d6d6d;
    --grid-line: #f0f0f0;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    height: 100%;
    background: var(--control);
    color: #000;
    font-family: "Segoe UI", "Microsoft Sans Serif", Tahoma, sans-serif;
    font-size: 12px;
    user-select: none;
    overflow: hidden;
}

#app {
    height: 100%;
}

.loading {
    padding: 12px;
}

input, select, button {
    font: inherit;
    color: inherit;
}

/* window */

.form {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.form.busy {
    cursor: progress;
}

.form.busy .split {
    pointer-events: none;
}

/* menu */

.menubar {
    display: flex;
    background: var(--window);
    border-bottom: 1px solid #e3e3e3;
    padding: 1px 2px;
    flex: none;
}

.menubar-item {
    position: relative;
    padding: 3px 7px;
    border: 1px solid transparent;
    cursor: default;
}

.menubar-item:hover, .menubar-item.open {
    background: #cce8ff;
    border-color: #99d1ff;
}

.menu-popup {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 20;
    min-width: 180px;
    padding: 2px;
    background: #f2f2f2;
    border: 1px solid #ccc;
    box-shadow: 2px 2px 3px rgba(0, 0, 0, .25);
    white-space: nowrap;
}

.menu-popup.sub {
    top: -3px;
    left: 100%;
    min-width: 260px;
}

.menu-item {
    position: relative;
    padding: 3px 24px 3px 28px;
    border: 1px solid transparent;
    cursor: default;
}

.menu-item:hover:not(.disabled), .menu-item.open {
    background: #91c9f7;
    border-color: #91c9f7;
}

.menu-item.disabled {
    color: var(--gray-text);
}

.menu-item.has-sub::after {
    content: "▸";
    position: absolute;
    right: 8px;
}

.menu-hint {
    color: var(--gray-text);
}

.menu-separator {
    height: 1px;
    margin: 3px 2px 3px 28px;
    background: #d7d7d7;
}

/* split container */

.split {
    display: flex;
    flex: 1;
    min-height: 0;
}

.panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 3px;
}

.panel.left {
    flex: none;
}

.panel.right {
    flex: 1;
}

.splitter {
    flex: none;
    width: 4px;
    cursor: col-resize;
}

.label-row {
    display: flex;
    align-items: center;
    height: 30px;
    flex: none;
    padding: 0 3px;
}

.label-row .label {
    font-family: "Microsoft Sans Serif", Tahoma, sans-serif;
    font-weight: bold;
    font-size: 11px;
}

.add-remove {
    position: relative;
    margin-left: auto;
    display: flex;
    gap: 6px;
}

.add-menu {
    top: 100%;
    left: 0;
    min-width: 120px;
}

/* list boxes */

.listbox {
    background: var(--window);
    border: 1px solid var(--border);
    overflow: auto;
    margin: 0 3px;
}

.listbox.devices {
    flex: 40;
}

.listbox.objects {
    flex: 60;
}

.listbox-item {
    padding: 0 2px;
    line-height: 16px;
    white-space: nowrap;
    cursor: default;
}

.listbox-item.selected {
    background: var(--highlight);
    color: var(--highlight-text);
}

/* buttons */

.win-button {
    min-width: 75px;
    height: 23px;
    padding: 0 8px;
    background: var(--button);
    border: 1px solid var(--button-border);
    border-radius: 0;
}

.win-button.small {
    min-width: 23px;
    width: 23px;
    padding: 0;
}

.win-button:hover:not(:disabled) {
    background: var(--hot);
    border-color: var(--hot-border);
}

.win-button:active:not(:disabled) {
    background: #cce4f7;
    border-color: #005499;
}

.win-button:disabled {
    color: #838383;
    background: #cccccc;
    border-color: #bfbfbf;
}

.buttons {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    justify-items: center;
    align-items: center;
    padding: 4px 0 1px;
    flex: none;
}

/* property grid */

.grid-device {
    height: 250px;
    flex: none;
    margin: 3px;
}

.grid-object {
    flex: 1;
    min-height: 0;
    margin: 3px;
}

.pg {
    height: 100%;
    overflow: auto;
    background: var(--window);
    border: 1px solid var(--border);
}

.pg-row {
    display: flex;
    min-height: 16px;
    line-height: 16px;
    border-bottom: 1px solid var(--grid-line);
}

.pg-margin {
    flex: none;
    width: 14px;
    background: var(--control);
}

.pg-name {
    display: flex;
    align-items: center;
    flex: 0 0 calc(50% - 14px);
    min-width: 0;
    border-right: 1px solid var(--grid-line);
    white-space: nowrap;
    overflow: hidden;
}

.pg-name > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
}

.pg-row.selected .pg-name {
    background: var(--highlight);
    color: var(--highlight-text);
}

.pg-toggle, .pg-toggle-space {
    flex: none;
    width: 9px;
    height: 9px;
    margin-right: 4px;
}

.pg-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #919191;
    background: var(--window);
    color: #000;
    font-size: 9px;
    line-height: 1;
    cursor: default;
}

.pg-value {
    position: relative;
    flex: 1;
    min-width: 0;
    padding: 0 2px;
    white-space: nowrap;
}

.pg-value.readonly, .pg.disabled .pg-value {
    color: var(--gray-text);
}

.pg-text {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pg-value input, .pg-value select, .pg-flags {
    width: 100%;
    height: 16px;
    padding: 0;
    border: none;
    background: transparent;
    outline: none;
    line-height: 16px;
}

.pg-value input:focus {
    background: var(--window);
    user-select: text;
}

.pg-flags {
    display: flex;
    text-align: left;
    cursor: default;
}

.pg-flags .pg-text {
    flex: 1;
}

.pg-arrow {
    flex: none;
    padding: 0 3px;
}

.pg-flags-popup {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 10;
    max-height: 240px;
    min-width: 100%;
    overflow: auto;
    padding: 2px 4px;
    background: var(--window);
    border: 1px solid #000;
}

.pg-flags-popup label {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* status strip */

.statusbar {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 22px;
    flex: none;
    padding: 0 6px;
    background: var(--control);
    border-top: 1px solid #dadada;
}

.status-text {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.progress {
    width: 100px;
    height: 14px;
    border: 1px solid #bcbcbc;
    background: #e6e6e6;
}

.progress-bar {
    display: block;
    height: 100%;
    background: #06b025;
}

.status-proxy.ok::before, .status-proxy.error::before {
    content: "●";
    margin-right: 3px;
}

.status-proxy.ok::before {
    color: #06b025;
}

.status-proxy.error::before {
    color: #c42b1c;
}

.status-proxy a {
    margin-left: 4px;
    color: #0066cc;
}

.status-proxy a.update {
    font-weight: bold;
    color: #c25e00;
}

/* dialog */

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .15);
}

.dialog {
    width: 320px;
    background: var(--control);
    border: 1px solid #888;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
}

.dialog-title {
    padding: 6px 8px;
    background: var(--window);
}

.dialog-body {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 8px;
    align-items: center;
    padding: 10px;
}

.dialog-body input, .dialog-body select {
    height: 23px;
    border: 1px solid #7a7a7a;
    background: var(--window);
    user-select: text;
}

.dialog-error {
    padding: 0 10px 6px;
    color: #c42b1c;
}

.dialog-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    padding: 0 10px 10px;
}

/* proxy install dialog */

.dialog.install {
    width: min(600px, calc(100vw - 24px));
}

.install-body {
    padding: 4px 12px 0;
    user-select: text;
}

.install-body p {
    margin: 8px 0;
}

.tabs {
    display: flex;
    margin-top: 10px;
}

.tab {
    padding: 3px 10px;
    margin-right: -1px;
    background: var(--control);
    border: 1px solid #d9d9d9;
    border-bottom: none;
}

.tab.selected {
    background: var(--window);
    position: relative;
    top: 1px;
}

.tab-page {
    padding: 2px 10px 8px;
    background: var(--window);
    border: 1px solid #d9d9d9;
}

.command {
    display: flex;
    gap: 6px;
    align-items: stretch;
}

.command code {
    flex: 1;
    padding: 5px 6px;
    background: #1e1e1e;
    color: #e8e8e8;
    font-family: Consolas, "Cascadia Mono", monospace;
    font-size: 11px;
    word-break: break-all;
}

.command .win-button {
    height: auto;
    min-width: 60px;
}

.hint {
    color: var(--gray-text);
}

.install-body details {
    margin: 4px 0;
}

.install-body summary {
    cursor: default;
    margin-bottom: 4px;
}

.dialog-buttons .waiting {
    margin-right: auto;
    align-self: center;
    color: var(--gray-text);
}

.dialog-buttons .waiting::after {
    content: "";
    animation: waiting 1.5s steps(4) infinite;
}

@keyframes waiting {
    0% { content: ""; }
    25% { content: "."; }
    50% { content: ".."; }
    75% { content: "..."; }
}

/* blazor */

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    padding: 6px 12px;
    background: lightyellow;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, .2);
}

#blazor-error-ui .dismiss {
    position: absolute;
    right: 12px;
    cursor: pointer;
}
