/* ===== WebOS 2 - Window Styles ===== */

.window {
  position: absolute;
  background: rgba(14, 14, 20, 0.94);
  backdrop-filter: blur(36px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255,255,255,0.04) inset;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 320px;
  min-height: 200px;
  pointer-events: all;
  transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
  will-change: transform;
}

.window.focused {
  border-color: rgba(124, 58, 237, 0.35);
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255,255,255,0.06) inset, 0 0 40px rgba(124, 58, 237, 0.1);
}

.window.minimized {
  transform: scale(0.5) translateY(120%) !important;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.window.maximized {
  top: var(--topbar-height) !important;
  left: 0 !important;
  width: 100% !important;
  height: calc(100vh - var(--topbar-height) - var(--dock-height) - 24px) !important;
  border-radius: 0 !important;
}

.window.entering {
  animation: windowOpen 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes windowOpen {
  from { transform: scale(0.88); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ===== Window Titlebar ===== */
.window-titlebar {
  display: flex;
  align-items: center;
  padding: 0 14px;
  height: 40px;
  flex-shrink: 0;
  cursor: move;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  gap: 10px;
  user-select: none;
}

.window-controls {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.window-btn {
  width: 13px;
  height: 13px;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.window-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.2);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.window-btn:hover::after { opacity: 1; }

.window-btn-close  { background: #ff5f56; }
.window-btn-min    { background: #ffbd2e; }
.window-btn-max    { background: #28c840; }

.window-titlebar:hover .window-btn .btn-icon {
  opacity: 1;
}

.btn-icon {
  position: relative;
  z-index: 1;
  opacity: 0;
  transition: opacity var(--transition-fast);
  font-size: 8px;
  font-weight: 700;
  color: rgba(0,0,0,0.6);
  pointer-events: none;
}

.window-title {
  flex: 1;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.2px;
}

.window-title-icon {
  font-size: 14px;
  flex-shrink: 0;
}

/* ===== Window Body ===== */
.window-body {
  flex: 1;
  overflow: auto;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ===== Window Resize Handles ===== */
.resize-handle {
  position: absolute;
  z-index: 10;
}

.resize-handle.n  { top: -4px; left: 12px; right: 12px; height: 8px; cursor: n-resize; }
.resize-handle.s  { bottom: -4px; left: 12px; right: 12px; height: 8px; cursor: s-resize; }
.resize-handle.e  { right: -4px; top: 12px; bottom: 12px; width: 8px; cursor: e-resize; }
.resize-handle.w  { left: -4px; top: 12px; bottom: 12px; width: 8px; cursor: w-resize; }
.resize-handle.ne { top: -4px; right: -4px; width: 16px; height: 16px; cursor: ne-resize; }
.resize-handle.nw { top: -4px; left: -4px; width: 16px; height: 16px; cursor: nw-resize; }
.resize-handle.se { bottom: -4px; right: -4px; width: 16px; height: 16px; cursor: se-resize; }
.resize-handle.sw { bottom: -4px; left: -4px; width: 16px; height: 16px; cursor: sw-resize; }
