/* ============================================================
   D4W.XYZ — Draggable / Resizable Window System
   ============================================================ */

.daw-window {
  position: absolute;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border: 1px solid var(--window-border);
  border-radius: 4px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.daw-window.hidden {
  display: none;
}

/* Minimize button collapses the window down to just its titlebar (spec
   item — minimize ≠ close); body and resize handle are hidden and the
   height override beats the inline px height set by applyLayout(). */
.daw-window.minimized {
  height: 29px !important;
}

.daw-window.minimized .window-body,
.daw-window.minimized .window-resize-handle {
  display: none;
}

.window-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  height: 28px;
  padding: 0 8px;
  background: var(--window-titlebar-bg);
  border-bottom: 1px solid var(--window-border);
  cursor: move;
  user-select: none;
}

.window-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}

.window-controls {
  display: flex;
  gap: 4px;
}

.window-controls button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}

.window-controls button:hover {
  background: var(--button-hover);
  color: var(--text-primary);
}

.window-controls .window-close:hover {
  background: var(--meter-high);
  color: #fff;
}

.window-body {
  position: relative;
  flex: 1 1 auto;
  overflow: auto;
  background: var(--bg-secondary);
}

.window-resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 12px;
  height: 12px;
  cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 50%, var(--border-color) 50%);
}

body.is-dragging,
body.is-resizing {
  user-select: none;
}
