/* Window manager + Activities overview */

#windows {
  position: absolute;
  inset: 0;
  z-index: 100;
  pointer-events: none; /* let clicks reach the desktop; windows re-enable them */
}

.window {
  pointer-events: auto;
  position: absolute;
  display: flex;
  flex-direction: column;
  background: var(--win-bg);
  border-radius: 12px;
  border: 1px solid var(--win-border);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-width: 360px;
  min-height: 240px;
  animation: win-open 0.22s cubic-bezier(0.2, 0.9, 0.3, 1);
  transition: box-shadow 0.15s;
}
@keyframes win-open {
  from { opacity: 0; transform: scale(0.92) translateY(14px); }
  to { opacity: 1; transform: none; }
}
.window.closing {
  opacity: 0;
  transform: scale(0.92) translateY(10px);
  transition: opacity 0.16s, transform 0.16s;
  pointer-events: none;
}
.window.minimized { display: none; }

.window:not(.focused) { box-shadow: 0 10px 34px rgba(0, 0, 0, 0.3); }
.window:not(.focused) .win-header { opacity: 0.75; }

.window.maximized {
  border-radius: 0;
  border: none;
  top: 32px !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: auto !important;
  height: auto !important;
}

.win-header {
  height: 44px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 8px 0 14px;
  background: linear-gradient(var(--win-head), var(--win-head));
  border-bottom: 1px solid var(--border);
  user-select: none;
  cursor: default;
}
.win-header .app-ico { width: 18px; height: 18px; }
.win-title {
  flex: 1;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.win-sub {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 400;
  margin-left: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.win-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  flex: none;
}
.win-close:hover { background: var(--hover); }
.win-close:active { background: var(--active); }
.win-close .icon { width: 13px; height: 13px; }

.win-body {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--win-bg);
  color: var(--text);
}

.win-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
  z-index: 5;
}
.window.maximized .win-resize { display: none; }

/* ---------------- Activities overview ---------------- */

#overview {
  position: absolute;
  inset: 0;
  z-index: 4000;
  background: rgba(16, 16, 22, 0.72);
  backdrop-filter: blur(22px) saturate(1.25);
  -webkit-backdrop-filter: blur(22px) saturate(1.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: ov-in 0.2s ease;
  color: #fff;
}
@keyframes ov-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ov-search {
  margin-top: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 99px;
  padding: 9px 18px;
  width: min(460px, 82vw);
  border: 1px solid rgba(255, 255, 255, 0.14);
  transition: box-shadow 0.15s, background 0.15s;
}
.ov-search:focus-within {
  background: rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent);
}
.ov-search .icon { color: #ddd; }
.ov-search input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: #fff;
  font-size: 15px;
}
.ov-search input::placeholder { color: rgba(255, 255, 255, 0.55); }

#ov-windows {
  flex: 1;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 26px;
  padding: 30px 40px;
  overflow: auto;
}
.ov-thumb {
  width: 300px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0;
  text-align: left;
  color: #fff;
  transition: transform 0.14s, box-shadow 0.14s;
}
.ov-thumb:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
}
.ov-preview {
  height: 170px;
  overflow: hidden;
  position: relative;
  background: var(--win-bg);
  pointer-events: none;
}
.ov-preview .clone {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
}
.ov-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.35);
}
.ov-label .icon { width: 15px; height: 15px; }
.ov-label span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#ov-dash {
  flex: none;
  margin-bottom: 26px;
  display: flex;
  gap: 18px;
  padding: 12px 22px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.dash-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: #eee;
  font-size: 11px;
  width: 66px;
}
.dash-app .icon { width: 38px; height: 38px; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4)); }
.dash-app:hover { color: #fff; }
.dash-app:hover .icon { filter: drop-shadow(0 0 10px color-mix(in srgb, var(--accent) 70%, transparent)); }

#ov-results {
  position: absolute;
  top: 108px;
  width: min(560px, 88vw);
  background: rgba(30, 30, 34, 0.97);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  overflow: auto;
  max-height: calc(100% - 200px);
}
.ov-result {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  color: #eee;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.ov-result:last-child { border-bottom: none; }
.ov-result:hover, .ov-result.sel { background: rgba(255, 255, 255, 0.1); }
.ov-result .icon { width: 20px; height: 20px; color: #ccc; }
.ov-result .r-text { min-width: 0; }
.ov-result .r-text b {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ov-result .r-text small { color: #999; font-size: 11.5px; }
.ov-result:first-child { border-radius: 14px 14px 0 0; }
.ov-result:last-child { border-radius: 0 0 14px 14px; }

.ov-empty {
  margin: auto;
  color: rgba(255, 255, 255, 0.6);
  font-size: 15px;
}

/* window dragged state */
.window.dragging { transition: none !important; }
body.wm-dragging { user-select: none; cursor: grabbing; }
body.wm-dragging iframe { pointer-events: none; }
