/* OS 2000 — classic desktop OS chrome
 * Beveled buttons, gray windows, title bars. Inspired by late-90s/early-2000s
 * desktop interfaces. Pure CSS — no images for chrome.
 */

:root {
  --c-bg: #c0c0c0;
  --c-bg-light: #dfdfdf;
  --c-bg-dark: #808080;
  --c-bg-darker: #404040;
  --c-hilite: #ffffff;
  --c-shadow: #808080;
  --c-shadow-dark: #000000;
  --c-text: #000000;
  --c-text-disabled: #808080;
  --c-text-disabled-hilite: #ffffff;
  --c-title-active: #0a246a;
  --c-title-active-2: #a6caf0;
  --c-title-inactive: #808080;
  --c-title-inactive-2: #b5b5b5;
  --c-title-text: #ffffff;
  --c-select: #0a246a;
  --c-select-text: #ffffff;
  --c-link: #0000ee;
  --c-desktop: #3a6ea5;
  --c-taskbar: #c0c0c0;
  /* Type stack:
   *   UI:      Tahoma (system, era-authentic) → Verdana → Geneva → sans-serif
   *   Fixed:   VT323 (loaded from Google Fonts) → Lucida Console → mono
   * Swap the UI stack with a self-hosted MS Sans Serif lookalike (e.g.
   * W95FA.woff2 in /vendor/fonts/) for the most authentic appearance —
   * see DEPLOY.md for the @font-face snippet.
   */
  --font-ui: Tahoma, "Geneva", "Verdana", sans-serif;
  --font-fixed: "VT323", "Lucida Console", "Courier New", monospace;
  --font-display: Arial, Helvetica, sans-serif;

  /* Beveled edges — the core of the classic 3D look. Defined once and reused
     everywhere, so the depth of the whole UI can be retuned from one place. */
  --bevel-raised:
    inset 1px 1px 0 0 var(--c-hilite),
    inset -1px -1px 0 0 var(--c-shadow-dark),
    inset 2px 2px 0 0 var(--c-bg-light),
    inset -2px -2px 0 0 var(--c-shadow);
  --bevel-pressed:
    inset 1px 1px 0 0 var(--c-shadow-dark),
    inset -1px -1px 0 0 var(--c-hilite),
    inset 2px 2px 0 0 var(--c-shadow),
    inset -2px -2px 0 0 var(--c-bg-light);
  --bevel-sunken:
    inset 1px 1px 0 0 var(--c-shadow),
    inset -1px -1px 0 0 var(--c-hilite),
    inset 2px 2px 0 0 var(--c-shadow-dark),
    inset -2px -2px 0 0 var(--c-bg-light);
  --bevel-raised-thin:
    inset 1px 1px 0 0 var(--c-hilite),
    inset -1px -1px 0 0 var(--c-shadow);
  --bevel-sunken-thin:
    inset 1px 1px 0 0 var(--c-shadow),
    inset -1px -1px 0 0 var(--c-hilite);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--c-text);
  user-select: none;
  -webkit-user-select: none;
  background: var(--c-desktop);
  cursor: default;
}

#root { position: absolute; inset: 0; }

/* --- BUTTONS --- */
.btn, button.os-btn {
  font: 11px var(--font-ui);
  background: var(--c-bg);
  color: var(--c-text);
  border: none;
  padding: 3px 10px;
  min-width: 75px;
  height: 23px;
  cursor: default;
  position: relative;
  box-shadow: var(--bevel-raised);
  outline: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn:focus, button.os-btn:focus {
  outline: 1px dotted #000;
  outline-offset: -4px;
}
.btn:active:not(:disabled),
button.os-btn:active:not(:disabled),
.btn.pressed,
button.os-btn.pressed {
  box-shadow: var(--bevel-pressed);
}
.btn:disabled, button.os-btn:disabled {
  color: var(--c-text-disabled);
  text-shadow: 1px 1px 0 var(--c-text-disabled-hilite);
}
.btn.default, button.os-btn.default {
  box-shadow:
    inset 0 0 0 1px #000,
    inset 1px 1px 0 1px var(--c-hilite),
    inset -1px -1px 0 1px var(--c-shadow-dark),
    inset 2px 2px 0 1px var(--c-bg-light),
    inset -2px -2px 0 1px var(--c-shadow);
}

/* Sunken (inset) frame — used for fields, status areas */
.sunken {
  background: #fff;
  box-shadow: var(--bevel-sunken);
  padding: 2px;
}
.sunken-thin {
  box-shadow: var(--bevel-sunken-thin);
}
.raised-thin {
  box-shadow: var(--bevel-raised-thin);
}

/* --- INPUTS --- */
input[type="text"], input[type="password"], textarea, .field {
  font: 11px var(--font-ui);
  background: #fff;
  color: #000;
  border: none;
  padding: 3px 4px;
  box-shadow: var(--bevel-sunken);
  outline: none;
}
input[type="text"]:focus, input[type="password"]:focus, textarea:focus {
  /* no extra ring; classic look */
}

input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  background: #fff;
  box-shadow: var(--bevel-sunken);
  position: relative;
  margin: 0 4px 0 0;
  vertical-align: -2px;
}
input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  inset: 2px;
  background:
    linear-gradient(45deg, transparent 45%, #000 45% 55%, transparent 55%),
    linear-gradient(-45deg, transparent 45%, #000 45% 55%, transparent 55%);
}

input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--bevel-sunken);
  position: relative;
  margin: 0 4px 0 0;
  vertical-align: -2px;
}
input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: #000;
}

label.os-label { display: inline-flex; align-items: center; gap: 0; cursor: default; }

/* --- WINDOWS --- */
.window {
  position: absolute;
  background: var(--c-bg);
  box-shadow: var(--bevel-raised);
  padding: 3px;
  display: flex;
  flex-direction: column;
  min-width: 120px;
  min-height: 28px;
}
.window.dragging { cursor: move; }
.window.maximized {
  inset: 0 0 28px 0 !important;
  width: 100% !important;
  height: calc(100% - 28px) !important;
  left: 0 !important; top: 0 !important;
}

.titlebar {
  display: flex;
  align-items: center;
  height: 18px;
  padding: 1px 2px 1px 3px;
  background: linear-gradient(90deg, var(--c-title-active) 0%, var(--c-title-active-2) 100%);
  color: var(--c-title-text);
  font-weight: bold;
  cursor: default;
  flex: 0 0 auto;
  user-select: none;
}
.window.inactive .titlebar {
  background: linear-gradient(90deg, var(--c-title-inactive) 0%, var(--c-title-inactive-2) 100%);
}
.titlebar-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  margin-right: 4px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}
.titlebar-title {
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
}
.titlebar-btns {
  display: flex;
  gap: 0;
  flex: 0 0 auto;
}
.titlebar-btn {
  width: 16px;
  height: 14px;
  background: var(--c-bg);
  box-shadow: var(--bevel-raised);
  margin-left: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  color: #000;
  position: relative;
}
.titlebar-btn:active {
  box-shadow: var(--bevel-pressed);
}
.titlebar-btn svg { display: block; }
.titlebar-btn.close { margin-left: 4px; }

.window-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  margin-top: 1px;
}

/* Menubar (File Edit View ...) */
.menubar {
  display: flex;
  background: var(--c-bg);
  height: 19px;
  flex: 0 0 19px;
  align-items: stretch;
  border-bottom: none;
  font-size: 11px;
}
.menubar-item {
  padding: 3px 7px 3px 7px;
  cursor: default;
  position: relative;
  display: flex;
  align-items: center;
}
.menubar-item:hover, .menubar-item.open {
  background: var(--c-select);
  color: var(--c-select-text);
}
.menubar-item u, .menubar-item .underline {
  text-decoration: underline;
}

/* Popup menu */
.menu {
  position: absolute;
  background: var(--c-bg);
  box-shadow: var(--bevel-raised);
  padding: 2px;
  min-width: 120px;
  z-index: 10000;
  user-select: none;
}
.menu-item {
  display: flex;
  align-items: center;
  padding: 3px 22px 3px 24px;
  cursor: default;
  position: relative;
  white-space: nowrap;
  font-size: 11px;
}
.menu-item:hover:not(.disabled) {
  background: var(--c-select);
  color: var(--c-select-text);
}
.menu-item.disabled {
  color: var(--c-text-disabled);
  text-shadow: 1px 1px 0 var(--c-text-disabled-hilite);
}
.menu-item .accel { margin-left: auto; padding-left: 24px; }
.menu-item .arrow { margin-left: auto; padding-left: 12px; }
.menu-item .check {
  position: absolute;
  left: 6px;
  width: 14px;
  text-align: center;
}
.menu-sep {
  height: 0;
  border-top: 1px solid var(--c-shadow);
  border-bottom: 1px solid var(--c-hilite);
  margin: 3px 2px;
}

/* Toolbar */
.toolbar {
  display: flex;
  background: var(--c-bg);
  padding: 2px;
  gap: 0;
  flex: 0 0 auto;
  align-items: center;
}
.toolbar-btn {
  width: 23px;
  height: 22px;
  background: var(--c-bg);
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  position: relative;
}
.toolbar-btn:hover {
  border-color: var(--c-hilite) var(--c-shadow-dark) var(--c-shadow-dark) var(--c-hilite);
  background: var(--c-bg-light);
}
.toolbar-btn:active, .toolbar-btn.pressed {
  border-color: var(--c-shadow-dark) var(--c-hilite) var(--c-hilite) var(--c-shadow-dark);
  background: var(--c-bg);
}
.toolbar-sep {
  width: 0;
  border-left: 1px solid var(--c-shadow);
  border-right: 1px solid var(--c-hilite);
  margin: 2px 4px;
  align-self: stretch;
}

/* Status bar */
.statusbar {
  display: flex;
  height: 20px;
  flex: 0 0 20px;
  padding: 2px;
  gap: 2px;
  border-top: 1px solid var(--c-hilite);
  margin-top: 1px;
}
.statusbar-pane {
  flex: 1 1 auto;
  padding: 2px 5px;
  box-shadow: var(--bevel-sunken-thin);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.statusbar-pane.fixed { flex: 0 0 auto; min-width: 60px; }

/* Group box (fieldset) */
.groupbox {
  border: 1px solid var(--c-shadow);
  border-right-color: var(--c-hilite);
  border-bottom-color: var(--c-hilite);
  position: relative;
  padding: 12px 10px 10px;
  margin: 8px 4px 4px;
}
.groupbox::after {
  content: "";
  position: absolute;
  inset: 1px 0 0 1px;
  right: -1px;
  bottom: -1px;
  border: 1px solid var(--c-hilite);
  border-right-color: var(--c-shadow);
  border-bottom-color: var(--c-shadow);
  pointer-events: none;
}
.groupbox > legend, .groupbox > .legend {
  position: absolute;
  top: -5px;
  left: 8px;
  background: var(--c-bg);
  padding: 0 4px;
  font-size: 11px;
}

/* Scrollbar styling — webkit */
::-webkit-scrollbar { width: 16px; height: 16px; background: var(--c-bg); }
::-webkit-scrollbar-track {
  background:
    repeating-conic-gradient(var(--c-bg-light) 0% 25%, var(--c-bg) 0% 50%) 50%/2px 2px;
}
::-webkit-scrollbar-thumb {
  background: var(--c-bg);
  box-shadow: var(--bevel-raised);
}
::-webkit-scrollbar-button:single-button {
  background: var(--c-bg);
  height: 16px; width: 16px;
  box-shadow: var(--bevel-raised);
  display: block;
}
::-webkit-scrollbar-corner { background: var(--c-bg); }

/* Selection color */
::selection { background: var(--c-select); color: var(--c-select-text); }

/* Generic */
.row { display: flex; align-items: center; gap: 6px; }
.col { display: flex; flex-direction: column; gap: 6px; }
.spacer { flex: 1 1 auto; }
.pad { padding: 8px; }
.h-pad { padding: 0 8px; }
.no-select { user-select: none; }

/* "Marching ants" focus rect (used in selected icons) */
.focus-rect {
  outline: 1px dotted #ffffff;
  outline-offset: -1px;
}
