/* WiCAM NC Converter - one stylesheet for the whole app, in the look of the WPF converter (Telerik "Green" theme
   with WiCAM's palette, dark only). Colours and sizes are the --nc-* variables. */

:root {
    color-scheme: dark;

    --nc-font: "Segoe UI", system-ui, -apple-system, sans-serif;
    --nc-mono: Consolas, "Cascadia Mono", "Courier New", monospace;
    --nc-font-size: 13px;

    --nc-bg: #1d1e21;            /* ToolbarBackgroundColor: window, title bar, lists */
    --nc-surface: #2b2c2e;       /* BaseThemeBackgroundColor: panels, grid header, buttons */
    --nc-input: #1b1b1f;         /* MainColor: text boxes */
    --nc-border: #474747;        /* BasicColor */
    --nc-separator: #696969;     /* DimGray */
    --nc-hover: #343434;         /* LowColor */
    --nc-text: #f0f8ff;          /* AliceBlue */
    --nc-muted: #a7adb5;
    --nc-accent: #0667d0;        /* AccentHighColor: selected tab, focus */
    --nc-accent-low: #0e74b9;    /* AccentLowColor */
    --nc-icon: #1e90ff;          /* ButtonBlueColor (DodgerBlue): row actions */
    --nc-ok: #21c813;            /* GreenColor */
    --nc-warn: #eb9000;          /* WarningColor */
    --nc-error: #eb1919;         /* RedColor */
    --nc-band: #116998;          /* the login page's band */
    --nc-logo-bg: #e5e6e8;
    --nc-images-bg: #ccd1d9;     /* machine pictures in the drop zone */

    --nc-titlebar-height: 38px;
    /* The desktop host reserves the window buttons' width here (webview2-titlebar.js). */
    --nc-caption-width: 0px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    background: var(--nc-bg);
    color: var(--nc-text);
    font-family: var(--nc-font);
    font-size: var(--nc-font-size);
}

button, input, select, textarea {
    font: inherit;
    color: inherit;
}

.nc-muted { color: var(--nc-muted); }
.nc-pre-line { white-space: pre-line; }
.nc-text-error { color: var(--nc-error); }

/* ---------- frame and title bar ---------- */

.nc-app {
    display: grid;
    grid-template-rows: var(--nc-titlebar-height) 1fr;
    height: 100vh;
    border: 2px solid var(--nc-separator);
}

.nc-titlebar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    padding-right: var(--nc-caption-width);
    background: var(--nc-bg);
    user-select: none;
}

.nc-title {
    margin-left: 15px;
    overflow: hidden;
    font-size: 16px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.nc-toolbar {
    display: grid;
    grid-auto-flow: column;
    align-items: center;
    gap: 2px;
    margin: 3px;
}

.nc-toolbar-separator {
    width: 2px;
    height: 25px;
    margin: 0 3px;
    background: var(--nc-separator);
}

.nc-tool {
    display: inline-grid;
    place-items: center;
    width: 31px;
    height: 31px;
    padding: 0;
    border: none;
    border-radius: 2px;
    background: transparent;
    color: var(--nc-text);
    cursor: pointer;
}

.nc-tool:hover:not(:disabled) { background: var(--nc-hover); }
.nc-tool:disabled { opacity: 0.4; cursor: default; }

.nc-main {
    min-height: 0;
    overflow: hidden;
}

.nc-center {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 8px;
    height: 100%;
    padding: 16px;
    text-align: center;
}

.nc-big-text {
    font-size: 32px;
    font-weight: 600;
}

.nc-center p {
    max-width: 760px;
    margin: 8px;
    font-size: 16px;
    font-weight: 600;
}

/* ---------- icons ---------- */

.nc-icon { flex: none; display: block; }
.nc-white { color: var(--nc-text); }
.nc-blue { color: var(--nc-icon); }
.nc-green { color: var(--nc-ok); }
.nc-orange { color: var(--nc-warn); }
.nc-red { color: var(--nc-error); }

.nc-spin { animation: nc-spin 2.5s linear infinite reverse; }

@keyframes nc-spin {
    to { transform: rotate(360deg); }
}

/* ---------- controls (Telerik "Green" look) ---------- */

.nc-button {
    min-height: 26px;
    padding: 2px 12px;
    border: 1px solid var(--nc-border);
    border-radius: 2px;
    background: var(--nc-surface);
    cursor: pointer;
}

.nc-button:hover:not(:disabled) { background: var(--nc-hover); border-color: var(--nc-accent-low); }
.nc-button:active:not(:disabled) { background: var(--nc-accent); }
.nc-button:disabled { opacity: 0.5; cursor: default; }

.nc-input {
    width: 100%;
    min-height: 26px;
    padding: 2px 6px;
    border: 1px solid var(--nc-border);
    border-radius: 2px;
    background: var(--nc-input);
}

.nc-input:focus { outline: none; border-color: var(--nc-accent); }
.nc-input[readonly] { color: var(--nc-muted); }

select.nc-input { padding-right: 2px; cursor: pointer; }
select.nc-input option { background: var(--nc-input); }

.nc-check {
    display: inline-grid;
    grid-template-columns: auto 1fr;
    gap: 6px;
    align-items: center;
    cursor: pointer;
}

.nc-check input {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: var(--nc-accent);
}

.nc-check:has(input:disabled) { opacity: 0.5; cursor: default; }

/* Telerik RadToggleSwitchButton */
.nc-switch {
    position: relative;
    width: 50px;
    height: 22px;
    margin: 2px;
    padding: 0;
    border: 1px solid var(--nc-border);
    border-radius: 2px;
    background: var(--nc-input);
    cursor: pointer;
}

.nc-switch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 22px;
    height: 16px;
    border-radius: 1px;
    background: var(--nc-separator);
    transition: left 0.15s;
}

.nc-switch[aria-checked="true"] { background: var(--nc-accent); border-color: var(--nc-accent); }
.nc-switch[aria-checked="true"]::after { left: 24px; background: var(--nc-text); }
.nc-switch:disabled { opacity: 0.4; cursor: default; }

.nc-separator {
    height: 1px;
    margin: 10px 3px 3px;
    background: var(--nc-separator);
}

/* ---------- tabs (RadTabControl) ---------- */

.nc-tabs {
    display: flex;
    flex-wrap: wrap;
    border-bottom: 2px solid var(--nc-accent);
}

.nc-tab {
    display: inline-grid;
    grid-auto-flow: column;
    gap: 6px;
    align-items: center;
    padding: 4px 12px;
    border: none;
    background: transparent;
    white-space: nowrap;
    cursor: pointer;
}

.nc-tab:hover { background: var(--nc-hover); }
.nc-tab.active { background: var(--nc-accent); }

/* ---------- converter ---------- */

.nc-converter {
    position: relative;
    display: grid;
    grid-template-rows: auto 1fr;
    height: 100%;
    min-height: 0;
}

.nc-jobs-area {
    display: grid;
    grid-template-rows: auto 1fr;
    min-height: 0;
}

.nc-jobs {
    grid-row: 2;
    min-height: 0;
    overflow: auto;
}

.nc-job {
    display: grid;
    grid-template-columns: auto minmax(150px, auto) auto 1fr auto;
    align-items: center;
    height: 35px;
    padding: 0 4px;
}

.nc-job:hover { background: var(--nc-surface); }

.nc-job-file {
    position: relative;
    display: grid;
    place-items: center;
    width: 31px;
    height: 31px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--nc-text);
    cursor: pointer;
}

/* The outline on hover, as the WPF converter's tooltip. */
.nc-thumb {
    position: absolute;
    top: 30px;
    left: 0;
    z-index: 20;
    /* hidden, not display:none: the outline needs a layout to be measured (fitThumbs) */
    visibility: hidden;
    width: 400px;
    height: 300px;
    padding: 6px;
    border: 1px solid var(--nc-border);
    background: var(--nc-surface);
    pointer-events: none;
}

.nc-job-file:hover .nc-thumb { visibility: visible; }
.nc-thumb svg { width: 100%; height: 100%; }

.nc-job-name { margin: 5px; white-space: nowrap; }
.nc-job-machines { white-space: nowrap; }

.nc-job-right {
    display: grid;
    grid-auto-flow: column;
    align-items: center;
}

.nc-job-material { margin-right: 5px; white-space: nowrap; }

.nc-row-button {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
}

.nc-row-button:hover { background: var(--nc-hover); }

.nc-state-icon {
    display: grid;
    place-items: center;
    width: 31px;
    height: 31px;
}

/* ---------- drop zone ---------- */

.nc-dropzone {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: grid;
    align-content: center;
    justify-items: center;
    overflow: auto;
    padding: 16px;
    background: var(--nc-bg);
}

.nc-dropzone-title {
    display: grid;
    grid-auto-flow: column;
    gap: 8px;
    align-items: center;
    font-size: 32px;
    font-weight: 600;
}

.nc-drop-cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 12px;
}

.nc-drop-card {
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-width: 220px;
    height: 150px;
    margin: 5px;
    padding: 5px;
    border: 1px solid var(--nc-text);
    border-radius: 5px;
}

.nc-drop-card.accept { border: 2px solid var(--nc-ok); }
.nc-drop-card.reject { border: 2px solid var(--nc-error); }

.nc-drop-card-buttons {
    display: grid;
    grid-auto-flow: column;
    justify-content: center;
    gap: 6px;
}

.nc-drop-card-buttons .nc-tool { border: 1px solid var(--nc-border); background: var(--nc-surface); }

.nc-drop-images {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    min-width: 400px;
    height: 164px;
    margin-top: 15px;
    padding: 20px;
    border: 2px solid darkgray;
    background: var(--nc-images-bg);
}

.nc-drop-images img {
    width: 100%;
    height: 120px;
    object-fit: contain;
}

/* ---------- login ---------- */

.nc-login {
    position: relative;
    display: grid;
    place-items: center;
    height: 100%;
}

.nc-login-band {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--nc-band);
}

.nc-login-logo {
    position: absolute;
    top: 20px;
    right: 15px;
    width: 150px;
    height: 50px;
    padding: 4px 6px;
    background: var(--nc-logo-bg);
}

.nc-login-logo img { width: 100%; height: 100%; object-fit: contain; }

.nc-login-form {
    display: grid;
    grid-template-columns: minmax(180px, auto) auto;
    gap: 6px 6px;
    align-items: center;
}

.nc-login-form > * { grid-column: 1; }

.nc-password {
    position: relative;
}

.nc-password .nc-input { padding-right: 28px; }

.nc-password button {
    position: absolute;
    top: 0;
    right: 2px;
    bottom: 0;
    display: grid;
    place-items: center;
    padding: 0 4px;
    border: none;
    background: transparent;
    cursor: pointer;
}

.nc-login-button {
    grid-column: 2 !important;
    grid-row: 3;
    display: grid;
    grid-auto-flow: column;
    align-items: center;
    padding: 0 4px;
    border: none;
    background: transparent;
    color: var(--nc-icon);
    cursor: pointer;
}

.nc-login-button:disabled { opacity: 0.5; cursor: default; }

/* ---------- windows (RadWindow) ---------- */

.nc-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.35);
}

.nc-window {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    max-width: 100%;
    max-height: 100%;
    border: 1px solid var(--nc-border);
    background: var(--nc-bg);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.6);
    outline: none;
}

.nc-window-header {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    height: 28px;
    padding-left: 6px;
    background: var(--nc-bg);
}

.nc-window-header > span {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.nc-window-header button {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--nc-muted);
    cursor: pointer;
}

.nc-window-header button:hover { color: var(--nc-text); background: var(--nc-hover); }

.nc-window-body {
    display: grid;
    min-height: 0;
    overflow: hidden;
}

.nc-window-footer {
    display: grid;
    padding: 6px 3px 2px;
}

.nc-window-footer.split { grid-template-columns: 1fr 1fr; gap: 6px; }

/* ---------- settings ---------- */

.nc-settings {
    display: grid;
    grid-template-rows: auto 1fr;
    width: 500px;
    max-width: calc(100vw - 32px);
    height: 650px;
    max-height: calc(100vh - 110px);
}

.nc-settings-page {
    min-height: 0;
    overflow: auto;
    padding: 5px;
}

.nc-setting-header { margin: 5px 3px 2px; }
.nc-setting-item { margin: 5px 3px 2px 10px; }

.nc-setting-row {
    display: grid;
    grid-auto-flow: column;
    justify-content: start;
    align-items: center;
    gap: 6px;
}

.nc-swatch {
    display: block;
    width: 50px;
    height: 35px;
    padding: 0;
    border: 1px solid darkgray;
    cursor: pointer;
}

.nc-swatch input {
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.nc-pair-setting {
    margin: 3px 6px 3px 3px;
}

.nc-pair-machines {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    align-items: end;
}

.nc-pair-delete {
    grid-column: 3;
    grid-row: 1;
    margin: 2px 3px 2px 0;
}

.nc-pair-setting .nc-check,
.nc-settings-page > .nc-check {
    display: grid;
    width: max-content;
}

.nc-folder-input {
    display: grid;
    grid-template-columns: 1fr auto;
}

.nc-folder-input button {
    width: 28px;
    border: 1px solid var(--nc-border);
    border-left: none;
    background: var(--nc-surface);
    cursor: pointer;
}

.nc-language {
    position: relative;
}

.nc-language > button {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 6px;
    align-items: center;
    min-width: 100px;
    height: 24px;
    padding: 0 4px;
    border: 1px solid var(--nc-accent);
    border-radius: 2px;
    background: var(--nc-input);
    cursor: pointer;
}

.nc-language img { width: 28px; height: 16px; object-fit: cover; }

.nc-language-list {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 30;
    display: grid;
    min-width: 100%;
    border: 1px solid var(--nc-border);
    background: var(--nc-input);
}

.nc-language-list button {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px;
    align-items: center;
    padding: 3px 6px;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.nc-language-list button:hover { background: var(--nc-accent); }

/* ---------- grids (RadGridView) ---------- */

.nc-grid {
    width: 100%;
    border-collapse: collapse;
}

.nc-grid th {
    position: sticky;
    top: 0;
    z-index: 1;
    height: 28px;
    padding: 0 6px;
    border-right: 1px solid var(--nc-border);
    border-bottom: 1px solid var(--nc-border);
    background: var(--nc-surface);
    font-weight: 600;
    text-align: left;
}

.nc-grid th .nc-th {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
}

.nc-grid th button {
    border: none;
    background: transparent;
    color: var(--nc-muted);
    cursor: pointer;
}

.nc-grid th button.active { color: var(--nc-icon); }

.nc-grid td {
    height: 28px;
    padding: 0;
    border-right: 1px solid var(--nc-border);
    border-bottom: 1px solid var(--nc-border);
}

.nc-grid td .nc-input {
    border-color: transparent;
    background: transparent;
}

.nc-grid td .nc-input:focus { border-color: var(--nc-accent); background: var(--nc-input); }
.nc-grid tr:hover td { background: var(--nc-hover); }
.nc-grid .nc-grid-indicator { width: 20px; border-right: 2px solid var(--nc-accent-low); }
.nc-grid .nc-grid-delete { width: 30px; text-align: center; }

.nc-grid-add td {
    padding: 0 6px;
    color: var(--nc-muted);
    cursor: pointer;
}

.nc-grid-filter td { background: var(--nc-surface); }

.nc-material-page {
    min-height: 0;
    overflow: auto;
}

/* ---------- small windows ---------- */

.nc-info {
    display: grid;
    width: 308px;
    padding: 5px;
}

.nc-material-problems {
    display: grid;
    grid-template-rows: auto 1fr auto;
    width: 320px;
    height: 400px;
    padding: 5px;
}

.nc-applying {
    display: grid;
    place-items: center;
    background: var(--nc-surface);
    font-size: 16px;
    font-weight: 600;
}

/* ---------- comparison and preview ---------- */

.nc-compare {
    display: grid;
    grid-template-columns: 2fr 5px 1fr;

    max-width: calc(100vw - 32px);

    max-height: calc(100vh - 110px);
}

.nc-compare pre {
    margin: 0;
    overflow: auto;
    padding: 4px 6px;
    border: 1px solid var(--nc-border);
    background: var(--nc-input);
    font-family: var(--nc-mono);
    font-size: 12px;
    line-height: 1.4;
}

.nc-splitter {
    background: var(--nc-surface);
    cursor: col-resize;
}

.nc-preview {
    position: relative;
    width: 500px;
    max-width: calc(100vw - 32px);
    height: 500px;
    max-height: calc(100vh - 110px);
    overflow: hidden;
}

.nc-preview-svg {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
    touch-action: none;
}

.nc-preview-svg:active { cursor: grabbing; }

.nc-preview-tools {
    position: absolute;
    right: 22px;
    bottom: 22px;
    display: grid;
    grid-auto-flow: column;
    align-items: center;
}

.nc-preview-tools > * {
    height: 25px;
    border: 1px solid darkgray;
    background: #292929;
}

.nc-preview-coordinates {
    min-width: 180px;
    padding: 0 3px;
    font-size: 16px;
    line-height: 23px;
    text-align: right;
}

.nc-preview-tools input[type="range"] { width: 180px; padding: 0 5px; accent-color: var(--nc-accent); }
.nc-preview-tools .nc-swatch { width: 40px; height: 25px; }
.nc-preview-tools .nc-tool { width: 25px; height: 25px; border-radius: 0; }

/* ---------- messages ---------- */

.nc-message {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    padding: 4px 8px;
    background: var(--nc-surface);
    color: var(--nc-warn);
}

/* Notices above the job list (row 1 of .nc-jobs-area); empty when there is none. */
.nc-messages {
    display: grid;
    gap: 1px;
}

.nc-message-text {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 8px;
}

.nc-message-actions {
    display: grid;
    grid-auto-flow: column;
    align-items: center;
    gap: 8px;
}

/* ---------- Blazor's error bar ---------- */

#blazor-error-ui {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: none;
    padding: 10px 16px;
    background: #3a1c1c;
    color: var(--nc-error);
}

#blazor-error-ui .dismiss {
    float: right;
    cursor: pointer;
}
