/* ==========================================================================
   Zeon OS - WINDOW MANAGER & WINDOW CHROME STYLING
   ========================================================================== */

.os-window {
  position: absolute;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface-solid);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: var(--style-corner-radius);
  box-shadow: var(--shadow-window);
  overflow: hidden;
  transition: box-shadow var(--transition-fast), transform var(--transition-fast), opacity var(--transition-fast);
  will-change: transform, width, height, top, left;
}

.os-window.active {
  box-shadow: var(--shadow-window-active);
  border-color: rgba(255, 255, 255, 0.2);
}

.os-window.animating {
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.os-window.maximized {
  border-radius: 0 !important;
  border: none !important;
}

/* Window Titlebar */
.window-titlebar {
  height: 38px;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: var(--window-titlebar-bg);
  border-bottom: var(--glass-border-subtle);
  cursor: grab;
  user-select: none;
}

.os-window.active .window-titlebar {
  background: rgba(255, 255, 255, 0.06);
}

.window-titlebar:active {
  cursor: grabbing;
}

.window-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  pointer-events: none;
}

.window-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.window-title {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.2px;
}

/* Window Control Buttons */
.window-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 12px;
}

.window-btn {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.window-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.window-btn-close:hover {
  background-color: var(--danger);
  color: #ffffff;
}

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

/* 8-Direction Resize Handles */
.resize-handle {
  position: absolute;
  z-index: 10;
}

.resize-n {
  top: 0; left: 6px; right: 6px; height: 6px;
  cursor: n-resize;
}
.resize-s {
  bottom: 0; left: 6px; right: 6px; height: 6px;
  cursor: s-resize;
}
.resize-w {
  top: 6px; bottom: 6px; left: 0; width: 6px;
  cursor: w-resize;
}
.resize-e {
  top: 6px; bottom: 6px; right: 0; width: 6px;
  cursor: e-resize;
}
.resize-nw {
  top: 0; left: 0; width: 10px; height: 10px;
  cursor: nw-resize;
}
.resize-ne {
  top: 0; right: 0; width: 10px; height: 10px;
  cursor: ne-resize;
}
.resize-sw {
  bottom: 0; left: 0; width: 10px; height: 10px;
  cursor: sw-resize;
}
.resize-se {
  bottom: 0; right: 0; width: 10px; height: 10px;
  cursor: se-resize;
}

/* Snap Preview Overlay */
.window-snap-preview {
  position: absolute;
  background: var(--accent-light);
  border: 2px solid var(--accent);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(8px);
  z-index: 999;
  pointer-events: none;
  opacity: 0;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.window-snap-preview.visible {
  opacity: 1;
}
