/* === EDS'OS — WINDOW SYSTEM === */

#windows-container {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 100;
}

.os-window {
  position: absolute;
  min-width: 340px; min-height: 240px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  display: flex; flex-direction: column;
  pointer-events: all;
  transition: box-shadow 0.2s;
  overflow: hidden;
}
.os-window.focused {
  border-color: rgba(108,99,255,0.5);
  box-shadow: 0 24px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(108,99,255,0.2);
  z-index: 200 !important;
}
.os-window.minimized { display: none !important; }
.os-window.maximized {
  top: 0 !important; left: 0 !important;
  width: 100vw !important;
  height: calc(100vh - var(--taskbar-h)) !important;
  border-radius: 0;
}

/* TITLE BAR */
.win-titlebar {
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px;
  height: 38px;
  background: rgba(108,99,255,0.08);
  border-bottom: 1px solid var(--border);
  cursor: move;
  flex-shrink: 0;
  user-select: none;
}
.win-icon { font-size: 14px; color: var(--accent2); }
.win-title { flex: 1; font-size: 0.82rem; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.win-controls { display: flex; gap: 6px; }
.win-btn {
  width: 26px; height: 26px;
  border-radius: 6px; border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 11px;
  transition: background 0.15s, transform 0.1s;
  background: rgba(255,255,255,0.06);
  color: var(--text-dim);
}
.win-btn:hover { background: rgba(255,255,255,0.15); color: var(--text); }
.win-btn.close:hover { background: var(--danger); color: white; }
.win-btn.maximize:hover { background: var(--success); color: white; }
.win-btn.minimize:hover { background: var(--warning); color: white; }
.win-btn:active { transform: scale(0.9); }

/* CONTENT AREA */
.win-content {
  flex: 1;
  overflow: auto;
  position: relative;
}

/* RESIZE HANDLE */
.win-resize {
  position: absolute; right: 0; bottom: 0;
  width: 14px; height: 14px;
  cursor: se-resize;
  z-index: 10;
}
.win-resize::after {
  content: '';
  position: absolute; right: 3px; bottom: 3px;
  width: 8px; height: 8px;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  opacity: 0.5;
}

/* WINDOW ANIMATIONS */
@keyframes winOpen {
  from { transform: scale(0.88) translateY(10px); opacity: 0; }
  to   { transform: scale(1)    translateY(0);    opacity: 1; }
}
.win-opening { animation: winOpen 0.22s cubic-bezier(0.34,1.2,0.64,1) forwards; }

@keyframes winClose {
  from { transform: scale(1) translateY(0);    opacity: 1; }
  to   { transform: scale(0.88) translateY(10px); opacity: 0; }
}
.win-closing { animation: winClose 0.16s ease forwards; }

/* === RESPONSIVE — MOBILE WINDOWS === */
@media (max-width: 768px) {
  .os-window {
    min-width: 280px; min-height: 200px;
  }
  .os-window:not(.maximized) {
    left: 4px !important;
    top: 4px !important;
    width: calc(100vw - 8px) !important;
    height: calc(100vh - var(--taskbar-h) - 8px) !important;
  }
  .win-titlebar { height: 34px; padding: 0 8px; gap: 6px; }
  .win-title { font-size: 0.78rem; }
  .win-btn { width: 24px; height: 24px; font-size: 10px; }
  .win-resize { display: none; }
}
