/* ==========================================================================
   windows.css — window chrome: striped title bars, close/collapse/
   zoom boxes, hard drop shadows, square everything.
   ========================================================================== */

.window {
  position: absolute;
  display: flex; flex-direction: column;
  min-width: 240px; min-height: 120px;
  border: 1px solid #ffffff;
  border-radius: 0;
  background: #113ac5;
  /* A hard offset shadow — no blur existed in 1991. */
  box-shadow: var(--drop);
  overflow: hidden;
  contain: layout style;
}
.window.inactive { box-shadow: var(--drop-sm); }
.window.dragging { will-change: left, top; }
.window.dragging *, .window.resizing * { pointer-events: none !important; }

/* No scaling or fading — windows simply appeared. */
.window.opening, .window.closing { animation: none; }

/* ---------------- Title bar ---------------- */
.titlebar {
  height: var(--title-h); flex: none;
  display: flex; align-items: center;
  padding: 0 4px;
  gap: 4px;
  border-bottom: 1px solid #ffffff;
  position: relative;
  cursor: default;
  /* Six hairlines, the System 7 "racing stripes". */
  background: repeating-linear-gradient(#ffffff 0 1px, #113ac5 1px 2px);
  background-position: 0 3px;
  background-size: 100% 13px;
  background-repeat: no-repeat;
  background-color: #113ac5;
}
/* An inactive window loses its stripes and its boxes. */
.window.inactive .titlebar { background-image: none; }
.window.inactive .title-text { color: #889ce2; }
.window.inactive .win-box { visibility: hidden; }

.title-text {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
  font-size: 12px;
  color: #ffffff;
  pointer-events: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  /* The close box sits on the left with nothing balancing it on the right, so
     reserve its width (11px box + 4px gap) to keep the title centred in the
     bar rather than pushed off to one side. */
  padding-right: 15px;
}
/* The title punches a white gap through the stripes. */
.title-text > span:last-child {
  background: #113ac5;
  padding: 0 6px;
}
.title-text .doc-icon { width: 12px; height: 12px; vertical-align: -2px; margin-right: 3px; }

/* ---------------- Window box ---------------- */
/* The close box, and only the close box. */
.win-box {
  width: 11px; height: 11px; flex: none;
  padding: 0;
  border: 1px solid #ffffff;
  background: #113ac5;
  position: relative;
  border-radius: 0;
}
.win-box:active { background: var(--d50) 0 0 / 2px 2px; image-rendering: pixelated; }

.lights { display: flex; align-items: center; z-index: 2; }

.toolbar-toggle { display: none; }

/* ---------------- Toolbar ---------------- */
.toolbar {
  flex: none;
  display: flex; align-items: center; gap: 6px;
  padding: 4px 6px;
  min-height: 28px;
  background: #113ac5;
  border-bottom: 1px solid #ffffff;
}
.toolbar.thin { min-height: 24px; padding: 3px 6px; }

.tb-btn {
  border: 1px solid #ffffff;
  border-radius: 0;
  background: #113ac5;
  padding: 1px 7px; min-height: 19px;
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px;
}
.tb-btn:active, .tb-btn.on { background: #ffffff; color: #113ac5; }
.tb-btn:disabled { color: #7990de; border-color: #7990de; }
.tb-btn:disabled:active { background: #113ac5; color: #7990de; }
.tb-btn svg { width: 12px; height: 12px; fill: #ffffff; }
.tb-btn:active svg, .tb-btn.on svg { fill: #113ac5; }
.tb-btn:disabled svg { fill: #7990de; }

/* ---------------- Window body ---------------- */
.win-body { flex: 1; display: flex; min-height: 0; position: relative; background: #113ac5; }
.win-content { flex: 1; min-width: 0; min-height: 0; position: relative; display: flex; flex-direction: column; }

/* Sidebar / source list */
.sidebar {
  width: 150px; flex: none;
  background: #113ac5;
  border-right: 1px solid #ffffff;
  padding: 4px 0;
  font-size: 11px;
  overflow: auto;
}
.sb-group { margin-bottom: 6px; }
.sb-title {
  font-size: 10px;
  padding: 2px 8px;
  border-bottom: 1px solid #ffffff;
  background-image: var(--d25); background-size: 4px 4px;
  image-rendering: pixelated;
  margin-bottom: 2px;
}
.sb-item {
  display: flex; align-items: center; gap: 5px;
  padding: 1px 8px 1px 10px; height: 19px;
  white-space: nowrap; overflow: hidden;
}
.sb-item svg, .sb-item img { width: 14px; height: 14px; flex: none; }
.sb-item span { overflow: hidden; text-overflow: ellipsis; }
.sb-item.sel { background: #ffffff; color: #113ac5; }
.sb-item.sel svg { filter: url(#swap); }
.sb-item .badge {
  margin-left: auto; border: 1px solid currentColor;
  padding: 0 4px; font-size: 9px;
}

/* Status bar. The right padding keeps text clear of the grow box. */
.statusbar {
  flex: none; height: 20px;
  display: flex; align-items: center; gap: 8px;
  padding: 0 20px 0 8px;
  font-size: 10px;
  background: #113ac5;
  border-top: 1px solid #ffffff;
}

/* ---------------- Resize ---------------- */
.rz { position: absolute; z-index: 5; }
.rz.n  { top: -2px; left: 6px; right: 6px; height: 5px; cursor: ns-resize; }
.rz.s  { bottom: -2px; left: 6px; right: 6px; height: 5px; cursor: ns-resize; }
.rz.w  { left: -2px; top: 6px; bottom: 6px; width: 5px; cursor: ew-resize; }
.rz.e  { right: -2px; top: 6px; bottom: 6px; width: 5px; cursor: ew-resize; }
.rz.nw { left: -2px; top: -2px; width: 10px; height: 10px; cursor: nwse-resize; }
.rz.ne { right: -2px; top: -2px; width: 10px; height: 10px; cursor: nesw-resize; }
.rz.sw { left: -2px; bottom: -2px; width: 10px; height: 10px; cursor: nesw-resize; }
.rz.se { right: 0; bottom: 0; width: 16px; height: 16px; cursor: nwse-resize; }

/* The grow box: two offset squares in the bottom-right corner. */
.window .grip {
  position: absolute; right: 0; bottom: 0; width: 15px; height: 15px;
  pointer-events: none;
  background: #113ac5;
  border-left: 1px solid #ffffff; border-top: 1px solid #ffffff;
}
.window .grip::before, .window .grip::after {
  content: ""; position: absolute; border: 1px solid #ffffff; background: #113ac5;
}
.window .grip::before { left: 2px; top: 2px; width: 8px; height: 8px; }
.window .grip::after  { left: 5px; top: 5px; width: 8px; height: 8px; }
.window.inactive .grip { display: none; }
.window.no-resize .rz, .window.no-resize .grip { display: none; }

/* WindowShade: rolled up to just the title bar, still on screen. */
.window.collapsed { min-height: 0 !important; overflow: hidden; }
.window.collapsed .rz, .window.collapsed .grip { display: none; }
.window.minimizing { animation: none; }

.window.zoomed { border-radius: 0; }
