/* windows.css — window chrome, animations, snap preview, alt-tab */

#windows { position: absolute; inset: 0; overflow: hidden; }

.window {
  position: absolute;
  display: flex; flex-direction: column;
  background: var(--win-bg);
  color: var(--win-fg);
  border-radius: 12px;
  box-shadow: var(--shadow-win-unfocused);
  border: 1px solid var(--win-border);
  overflow: hidden;
  transition: left .22s cubic-bezier(.3,.9,.3,1), top .22s cubic-bezier(.3,.9,.3,1),
              width .22s cubic-bezier(.3,.9,.3,1), height .22s cubic-bezier(.3,.9,.3,1),
              box-shadow .15s ease;
  will-change: left, top, width, height;
}
.window.focused { box-shadow: var(--shadow-win); border-color: var(--win-border); }
.window.no-anim { transition: none !important; }
.window.maximized, .window.tiled { border-radius: 0; border-left: none; border-right: none; border-top: none; }
.window.maximized { border-bottom: none; }

.window.opening { animation: win-open .16s cubic-bezier(.2,1.1,.4,1); }
@keyframes win-open {
  from { opacity: 0; transform: scale(.94) translateY(6px); }
}
.window.closing { animation: win-close .13s ease forwards; pointer-events: none; }
@keyframes win-close {
  to { opacity: 0; transform: scale(.96) translateY(4px); }
}

.titlebar {
  display: flex; align-items: center; gap: 8px;
  height: 42px; flex: none;
  padding: 0 10px 0 14px;
  background: var(--win-header);
  border-bottom: 1px solid var(--card-border);
  cursor: default;
  position: relative;
  transition: background .15s ease;
  touch-action: none;
}
.window:not(.focused) .titlebar { background: var(--win-header-unfocused); }
.window:not(.focused) .titlebar .titlebar-title { color: var(--win-fg-dim); }
.titlebar-icon { display: flex; opacity: .9; }
.titlebar-title {
  flex: 1; min-width: 0;
  font-size: 14px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-align: center;
  margin-left: -60px; /* optical centering against buttons */
  pointer-events: none;
}
.titlebar-buttons { display: flex; gap: 7px; align-items: center; }
.tb-btn {
  width: 20px; height: 20px; border-radius: 50%;
  border: none; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(127,127,127,.28);
  color: transparent;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.tb-btn svg { opacity: 0; transition: opacity .1s; }
.titlebar:hover .tb-btn { color: #2b2b2b; }
.titlebar:hover .tb-btn svg { opacity: 1; }
.tb-btn:hover { background: rgba(127,127,127,.5); }
.tb-btn:active { background: rgba(127,127,127,.7); }
.tb-close:hover { background: var(--accent) !important; color: #fff !important; }
.window:not(.focused) .tb-btn { background: rgba(127,127,127,.16); }

.window-content {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  background: var(--win-content-bg);
  overflow: hidden;
  position: relative;
}

.resize-handle { position: absolute; z-index: 40; touch-action: none; }
.rh-n { top: -4px; left: 10px; right: 10px; height: 8px; cursor: n-resize; }
.rh-s { bottom: -4px; left: 10px; right: 10px; height: 8px; cursor: s-resize; }
.rh-e { right: -4px; top: 10px; bottom: 10px; width: 8px; cursor: e-resize; }
.rh-w { left: -4px; top: 10px; bottom: 10px; width: 8px; cursor: w-resize; }
.rh-ne { top: -5px; right: -5px; width: 12px; height: 12px; cursor: ne-resize; }
.rh-nw { top: -5px; left: -5px; width: 12px; height: 12px; cursor: nw-resize; }
.rh-se { bottom: -5px; right: -5px; width: 12px; height: 12px; cursor: se-resize; }
.rh-sw { bottom: -5px; left: -5px; width: 12px; height: 12px; cursor: sw-resize; }
.window.maximized .resize-handle, .window.tiled .resize-handle { display: none; }

/* snap preview */
#snap-preview {
  position: absolute; z-index: 500;
  background: rgba(255,255,255,.28);
  border: 2px solid rgba(255,255,255,.55);
  border-radius: 8px;
  pointer-events: none;
  transition: all .12s ease;
  backdrop-filter: blur(2px);
}
body.dark #snap-preview { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.35); }

/* overview spread */
.window.in-overview {
  cursor: pointer;
  border-radius: 10px !important;
  box-shadow: 0 10px 34px rgba(0,0,0,.5);
}
.window.in-overview:hover { border-color: var(--accent); }
.window.in-overview .resize-handle { display: none !important; }
.window.in-overview .titlebar { pointer-events: none; }
.window.in-overview .window-content { pointer-events: none; }
.ov-chip {
  position: absolute; left: 50%; bottom: -34px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 7px;
  background: rgba(25,25,25,.9); color: #f2f2f2;
  padding: 6px 14px; border-radius: 999px;
  font-size: 12.5px; white-space: nowrap;
  pointer-events: auto;
  box-shadow: 0 3px 12px rgba(0,0,0,.4);
}

/* alt-tab */
#alt-tab {
  position: absolute; z-index: 7000;
  left: 50%; top: 44%;
  transform: translate(-50%, -50%);
  display: flex; gap: 6px;
  background: rgba(30,30,30,.92);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 14px 50px rgba(0,0,0,.55);
  animation: ctx-in .1s ease;
  max-width: 80vw;
  overflow: hidden;
}
.alt-tab-item {
  width: 108px; padding: 10px 6px;
  border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: #eee;
  border: 2px solid transparent;
}
.alt-tab-item.sel { background: rgba(255,255,255,.14); border-color: var(--accent); }
.alt-tab-title {
  font-size: 12px; max-width: 96px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
