/* ── Finestre flottanti (window manager) ── */
.os-window {
  position: absolute;
  display: flex;
  flex-direction: column;
  background: var(--bg-app);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-window);
  overflow: hidden;
  min-width: 320px;
  min-height: 200px;
}

.os-window.maximized .os-window-resize {
  display: none;
}

.os-window-resize {
  position: absolute;
  z-index: 5;
}

.os-window-resize-n,
.os-window-resize-s {
  left: 10px;
  right: 10px;
  height: 6px;
}

.os-window-resize-e,
.os-window-resize-w {
  top: 10px;
  bottom: 10px;
  width: 6px;
}

.os-window-resize-n { top: 0; cursor: n-resize; }
.os-window-resize-s { bottom: 0; cursor: s-resize; }
.os-window-resize-e { right: 0; cursor: e-resize; }
.os-window-resize-w { left: 0; cursor: w-resize; }

.os-window-resize-ne,
.os-window-resize-nw,
.os-window-resize-se,
.os-window-resize-sw {
  width: 12px;
  height: 12px;
}

.os-window-resize-ne { top: 0; right: 0; cursor: ne-resize; }
.os-window-resize-nw { top: 0; left: 0; cursor: nw-resize; }
.os-window-resize-se { bottom: 0; right: 0; cursor: se-resize; }
.os-window-resize-sw { bottom: 0; left: 0; cursor: sw-resize; }

.os-window-body:has(.win-account),
.os-window-body:has(.win-settings) {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.os-window.is-resizing .os-window-body,
.os-window.is-dragging .os-window-body {
  pointer-events: none;
}

.os-window.minimized {
  display: none;
}

.os-window.maximized {
  border-radius: 0;
  min-width: 0;
  min-height: 0;
}

.os-window.maximized .os-window-btn.maximize:hover { background: var(--bg-hover); }

.os-window.focused {
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.os-window-titlebar {
  display: flex;
  align-items: stretch;
  height: var(--titlebar-h);
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  user-select: none;
  cursor: default;
}

.os-window-drag {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 12px;
  min-width: 0;
  cursor: default;
}

.os-window-icon {
  width: 16px;
  height: 16px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.os-window-icon .win-icon,
.os-window-icon img {
  width: 16px;
  height: 16px;
  display: block;
  object-fit: contain;
  opacity: 0.85;
}

.os-window-icon svg { width: 16px; height: 16px; }

.os-window-title {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.os-window.focused .os-window-title { color: var(--text-1); }

.os-window-controls {
  display: flex;
  flex-shrink: 0;
}

.os-window-btn {
  width: 46px;
  height: var(--titlebar-h);
  border: none;
  background: transparent;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
}

.os-window-btn:hover { background: var(--bg-hover); }
.os-window-btn.close:hover { background: #c42b1c; color: #fff; }

.os-window-body {
  flex: 1;
  overflow: auto;
  min-height: 0;
  background: var(--bg-app);
}

.os-window-body::-webkit-scrollbar { width: 8px; }
.os-window-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }

/* Taskbar — app aperte */
.taskbar-apps {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 8px;
}

.taskbar-window-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--text-1);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
  position: relative;
}

.taskbar-window-btn:hover { background: var(--bg-hover); }

.taskbar-window-btn.active::after {
  content: "";
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
}

/* Badge conteggio non letti (es. Live Chat) sul pulsante della taskbar. */
.taskbar-window-btn .win-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #e53935;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg-1, #1a1a2e);
  pointer-events: none;
}

.taskbar-window-btn svg { width: 18px; height: 18px; }

.taskbar-window-btn .win-icon,
.taskbar-window-btn img {
  width: 18px;
  height: 18px;
  display: block;
  object-fit: contain;
  opacity: 0.9;
}
