/* ============ Window chrome & window manager ============ */

.window {
  position: absolute; display: flex; flex-direction: column;
  background: var(--window-bg); color: var(--fg);
  border-radius: var(--radius-win); box-shadow: var(--shadow-win);
  overflow: hidden; min-width: 360px; min-height: 220px;
  transition: box-shadow .2s;
}
.window.active { box-shadow: var(--shadow-win-active); }
.window.hidden-window { display: none; }
.window:not(.active) .headerbar { background: var(--headerbar-dim); color: var(--fg-dim); }
.window:not(.active) .headerbar .win-controls .ctl { opacity: .5; }

.window.opening { animation: window-open .22s var(--ease-over); }
@keyframes window-open { from { opacity: 0; transform: scale(.92) translateY(10px); } to { opacity: 1; transform: none; } }
.window.closing { animation: window-close .18s var(--ease-out) forwards; pointer-events: none; }
@keyframes window-close { to { opacity: 0; transform: scale(.92); } }
.window.minimizing { transition: transform .28s var(--ease-over), opacity .28s; pointer-events: none; }
.window.unminimizing { animation: window-unmin .26s var(--ease-over); }
@keyframes window-unmin { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
.window.snapping { transition: left .22s var(--ease-over), top .22s var(--ease-over), width .22s var(--ease-over), height .22s var(--ease-over); }
.window.dragging, .window.resizing { transition: none !important; }
.window.tiled-left, .window.tiled-right, .window.tiled-quarter { border-radius: 0 var(--radius-win) var(--radius-win) 0; }
.window.tiled-right, .window.tiled-quarter-br, .window.tiled-quarter-tr { border-radius: var(--radius-win) 0 0 var(--radius-win); }
.window.tiled-quarter-bl, .window.tiled-quarter-br { border-radius: var(--radius-win) var(--radius-win) 0 0; }
.window.tiled-quarter-tr { border-radius: var(--radius-win) var(--radius-win) 0 0; }
.window.tiled-left, .window.tiled-right { border-radius: 0; }

/* headerbar (libadwaita style) */
.headerbar {
  position: relative; display: flex; align-items: center; gap: 8px;
  min-height: 47px; padding: 6px 8px; flex: none;
  background: var(--headerbar-bg); border-bottom: 1px solid var(--headerbar-border);
  box-shadow: inset 0 -1px 0 rgba(0,0,0,.04);
}
.headerbar .hb-title {
  position: absolute; left: 50%; transform: translateX(-50%);
  font-weight: 700; font-size: 14.5px; max-width: 50%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; text-align: center; pointer-events: none;
}
.headerbar .hb-title .subtitle { display: block; font-size: 12px; font-weight: 400; color: var(--fg-dim); }
.headerbar .hb-left, .headerbar .hb-right { display: flex; align-items: center; gap: 6px; min-width: 0; }
.headerbar .hb-right { margin-left: auto; }

/* window control buttons: circular min/max/close on the right */
.win-controls { display: flex; gap: 6px; align-items: center; margin-left: 4px; }
.win-controls .ctl {
  width: 24px; height: 24px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(0,0,0,.14); display: flex; align-items: center; justify-content: center;
  transition: background .12s, transform .06s; color: transparent;
}
.win-controls .ctl svg { opacity: 0; transition: opacity .12s; }
.win-controls:hover .ctl svg { opacity: .75; }
.win-controls .ctl:hover { background: rgba(0,0,0,.26); }
.win-controls .ctl:active { transform: scale(.94); }
.win-controls .ctl.close { background: rgba(0,0,0,.2); }
.win-controls .ctl.close:hover { background: #e01b24; }
.win-controls .ctl.close:hover svg { opacity: 1; color: #fff; }
body.theme-dark .win-controls .ctl { background: rgba(255,255,255,.14); }
body.theme-dark .win-controls .ctl:hover { background: rgba(255,255,255,.24); }
body.theme-dark .win-controls .ctl.close:hover { background: #e01b24; }

/* resize handles */
.rs { position: absolute; z-index: 5; }
.rs-n { top: -4px; left: 10px; right: 10px; height: 8px; cursor: n-resize; }
.rs-s { bottom: -4px; left: 10px; right: 10px; height: 8px; cursor: s-resize; }
.rs-w { left: -4px; top: 10px; bottom: 10px; width: 8px; cursor: w-resize; }
.rs-e { right: -4px; top: 10px; bottom: 10px; width: 8px; cursor: e-resize; }
.rs-nw { left: -5px; top: -5px; width: 14px; height: 14px; cursor: nw-resize; }
.rs-ne { right: -5px; top: -5px; width: 14px; height: 14px; cursor: ne-resize; }
.rs-sw { left: -5px; bottom: -5px; width: 14px; height: 14px; cursor: sw-resize; }
.rs-se { right: -5px; bottom: -5px; width: 14px; height: 14px; cursor: se-resize; }
.window.maximized .rs { display: none; }

.window-body { flex: 1; min-height: 0; position: relative; display: flex; overflow: hidden; border-radius: 0 0 var(--radius-win) var(--radius-win); }

/* ---------- Alt-Tab switcher ---------- */
.alttab {
  position: absolute; z-index: 9200; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: rgba(40,40,40,.96); border-radius: 20px; padding: 22px;
  display: flex; gap: 14px; box-shadow: var(--shadow-popover);
  animation: menu-in .12s var(--ease-out);
}
.alttab .alt-item { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px; border-radius: 14px; width: 108px; }
.alttab .alt-item.sel { background: rgba(255,255,255,.16); }
.alttab .alt-item .cap { color: #fff; font-size: 12.5px; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* window "in overview" clones are handled in overview.css */
