/* Windows Container & Window Chrome */
.windows-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: var(--taskbar-h);
  pointer-events: none;
  z-index: 100;
}

.win-window {
  position: absolute;
  display: flex;
  flex-direction: column;
  background: var(--bg-mica);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: var(--shadow-win-inactive);
  overflow: hidden;
  pointer-events: auto;
  min-width: 320px;
  min-height: 220px;
  transition: box-shadow 0.2s ease, border-radius 0.2s ease;
  animation: win-open 0.22s var(--ease-win) both;
}

.win-window.focused {
  box-shadow: var(--shadow-win);
}

.win-window.animating {
  transition: left 0.24s var(--ease-win), top 0.24s var(--ease-win), width 0.24s var(--ease-win), height 0.24s var(--ease-win), transform 0.24s var(--ease-win), opacity 0.2s ease, border-radius 0.2s ease;
}

.win-window.maximized {
  border-radius: 0;
  border: none;
}

.win-window.minimized {
  opacity: 0;
  transform: translateY(40px) scale(0.86);
  pointer-events: none;
}

.win-window.closing {
  animation: win-close 0.16s ease forwards;
}

@keyframes win-open {
  from { opacity: 0; transform: scale(0.94) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes win-close {
  to { opacity: 0; transform: scale(0.94) translateY(6px); }
}

/* Titlebar */
.win-titlebar {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 12px;
  flex-shrink: 0;
  cursor: default;
  background: transparent;
}

.win-title-left {
  display: flex;
  align-items: center;
  gap: 9px;
  overflow: hidden;
  pointer-events: none;
}

.win-title-left img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.win-title-text {
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.win-controls {
  display: flex;
  align-items: stretch;
  height: 100%;
  position: relative;
}

.win-ctrl-btn {
  width: 46px;
  height: 100%;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-primary);
  transition: background 0.12s ease, color 0.12s ease;
}

.win-ctrl-btn:hover {
  background: var(--bg-hover);
}

.win-ctrl-btn.close-btn:hover {
  background: #c42b1c;
  color: #fff;
}

/* Windows 11 Snap Layouts Flyout on Maximize Hover */
.snap-flyout {
  position: absolute;
  top: 38px;
  right: 8px;
  background: var(--bg-acrylic-strong);
  backdrop-filter: blur(36px);
  border: 1px solid var(--border-flyout);
  border-radius: 8px;
  box-shadow: var(--shadow-flyout);
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(3, 66px);
  gap: 8px;
  z-index: 600;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.18s ease, transform 0.18s var(--ease-win);
}

.snap-flyout.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.snap-layout-card {
  height: 44px;
  display: grid;
  gap: 3px;
}

.snap-zone-btn {
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  background: var(--bg-card);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.snap-zone-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
}

/* Window Content */
.win-body {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
}

/* Resize Handles (8 directions) */
.resize-handle {
  position: absolute;
  z-index: 20;
}
.rh-n { top: -3px; left: 6px; right: 6px; height: 6px; cursor: n-resize; }
.rh-s { bottom: -3px; left: 6px; right: 6px; height: 6px; cursor: s-resize; }
.rh-e { right: -3px; top: 6px; bottom: 6px; width: 6px; cursor: e-resize; }
.rh-w { left: -3px; top: 6px; bottom: 6px; width: 6px; cursor: w-resize; }
.rh-ne { top: -4px; right: -4px; width: 10px; height: 10px; cursor: ne-resize; }
.rh-nw { top: -4px; left: -4px; width: 10px; height: 10px; cursor: nw-resize; }
.rh-se { bottom: -4px; right: -4px; width: 10px; height: 10px; cursor: se-resize; }
.rh-sw { bottom: -4px; left: -4px; width: 10px; height: 10px; cursor: sw-resize; }

/* Snap Preview Ghost */
.snap-preview {
  position: fixed;
  background: rgba(255, 255, 255, 0.24);
  backdrop-filter: blur(12px);
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: 8px;
  z-index: 90;
  pointer-events: none;
  transition: all 0.16s var(--ease-win);
}
