/* ============================================================
   window.css — window positioning, dragging, resize, focus.
   Chrome (title bar, borders) comes from vendored XP.css.
   ============================================================ */

#windows {
  position: absolute;
  inset: 0;
  pointer-events: none; /* only windows themselves catch events */
  z-index: var(--z-window);
}

.win {
  position: absolute;
  pointer-events: auto;
  min-width: 180px;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  box-shadow: 3px 3px 10px rgba(0,0,0,.45);
}

/* XP.css .window fills our positioned host */
.win .window {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.win .window-body {
  flex: 1;
  min-height: 0;
  margin: 3px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* XP.css locks .title-bar to 21px; make it a touch taller and shrink the
   controls slightly so they sit cleanly inside the bar. */
.win .title-bar { cursor: default; height: 27px; padding: 0 3px 0 6px; }
.win .title-bar-controls button { min-width: 20px; min-height: 20px; }
.win .title-bar-text { display: flex; align-items: center; gap: 5px; overflow: hidden; font-size: 13px; }
.win .title-bar-text .tb-ico { width: 16px; height: 16px; flex: 0 0 auto; }
.win .title-bar-text .tb-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.win.dragging { opacity: .98; }
.win.dragging, .win.resizing { user-select: none; }

/* inactive window title bar (XP.css uses .inactive on .title-bar) */
.win:not(.focused) .title-bar.inactive { }

.win.maximized {
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  box-shadow: none;
}
.win.maximized .window { border-radius: 0; }

.win.minimized { display: none; }

/* resize handles */
.win .rz {
  position: absolute;
  z-index: 5;
}
.win .rz-e  { top: 6px; bottom: 6px; right: -3px; width: 6px; cursor: e-resize; }
.win .rz-w  { top: 6px; bottom: 6px; left: -3px; width: 6px; cursor: w-resize; }
.win .rz-n  { left: 6px; right: 6px; top: -3px; height: 6px; cursor: n-resize; }
.win .rz-s  { left: 6px; right: 6px; bottom: -3px; height: 6px; cursor: s-resize; }
.win .rz-ne { top: -3px; right: -3px; width: 10px; height: 10px; cursor: ne-resize; }
.win .rz-nw { top: -3px; left: -3px; width: 10px; height: 10px; cursor: nw-resize; }
.win .rz-se { bottom: -3px; right: -3px; width: 12px; height: 12px; cursor: se-resize; }
.win .rz-sw { bottom: -3px; left: -3px; width: 10px; height: 10px; cursor: sw-resize; }
.win.maximized .rz { display: none; }

/* window content helpers */
.win-menubar {
  display: flex;
  gap: 2px;
  padding: 1px 2px;
  font-size: 11px;
  background: #fff;
  border-bottom: 1px solid #dfdfdf;
  flex: 0 0 auto;
}
.win-menubar span {
  padding: 2px 7px;
  border-radius: 2px;
  cursor: default;
}
.win-menubar span:hover { background: #316ac5; color: #fff; }

.win-statusbar {
  flex: 0 0 auto;
  border-top: 1px solid #dfdfdf;
  padding: 2px 6px;
  font-size: 11px;
  color: #333;
  background: #fff;
  display: flex;
  gap: 12px;
}
