/* ==========================================================
   WINDOW — okna (podstrony i programy)
   ========================================================== */

.window {
  position: absolute;
  display: flex;
  flex-direction: column;
  min-width: 220px;
  min-height: 120px;
  max-width: 100%;
  max-height: 100%;
  background: var(--face);
  box-shadow: var(--bevel-out), 2px 2px 0 rgba(0, 0, 0, 0.25);
  padding: 3px;
  animation: window-in 140ms steps(3) both;
}
@keyframes window-in {
  from { transform: scale(0.92); }
  to   { transform: none; }
}

.window.is-maximized {
  inset: 0 !important;
  width: auto !important;
  height: auto !important;
}

/* ---------- Pasek tytułu ---------- */
.window__titlebar {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 3px 0 4px;
  background: var(--title-inactive);
  color: #dcdcdc;
  font-weight: 700;
  user-select: none;
  touch-action: none;
  flex: 0 0 auto;
}
.window.is-active .window__titlebar {
  background: var(--title-active);
  color: #fff;
}
.window__icon { width: 16px; height: 16px; image-rendering: pixelated; }
.window__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  letter-spacing: 0.3px;
}

.window__controls { display: flex; gap: 2px; }
.window__controls .btn {
  width: 22px;
  height: 20px;
  min-height: 0;
  padding: 0;
  display: grid;
  place-items: center;
  color: #000;
}
.window__controls .btn + .btn--close { margin-left: 2px; }
.window__controls svg { width: 10px; height: 10px; shape-rendering: crispEdges; }

/* ---------- Treść ---------- */
.window__body {
  flex: 1;
  min-height: 0;
  margin-top: 3px;
  overflow: auto;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Uchwyt zmiany rozmiaru */
.window__resize {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
  touch-action: none;
  background:
    linear-gradient(135deg, transparent 0 55%, var(--shadow) 55% 62%, var(--light) 62% 70%,
      transparent 70% 76%, var(--shadow) 76% 83%, var(--light) 83% 90%, transparent 90%);
}
.window.is-maximized .window__resize { display: none; }

/* ---------- Telefon: każde okno na cały ekran ---------- */
@media (max-width: 640px) {
  .window {
    inset: 0 !important;
    width: auto !important;
    height: auto !important;
    min-width: 0;
  }
  .window__resize,
  .window__controls .btn--maximize { display: none; }
  .window__titlebar { height: 32px; }
  .window__controls .btn { width: 30px; height: 26px; }
}
