/* ============================================
   WINDOWS.CSS — Window chrome, dragging, resizing
   ============================================ */

.window {
  position: absolute;
  display: flex;
  flex-direction: column;
  min-width: 320px;
  min-height: 200px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.15s ease;
  will-change: transform;
}

.window--focused {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.12);
  border-color: rgba(0, 0, 0, 0.15);
}

/* Title Bar */
.window__titlebar {
  height: 36px;
  background: #2A2A2A;
  display: flex;
  align-items: center;
  padding: 0 12px;
  flex-shrink: 0;
  cursor: default;
  position: relative;
}

.window:not(.window--focused) .window__titlebar {
  background: #3A3A3A;
}

/* Window Controls */
.window__controls {
  display: flex;
  gap: 6px;
  z-index: 1;
}

.window__btn {
  width: 28px;
  height: 20px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  color: rgba(255, 255, 255, 0.7);
  transition: background-color 0.12s ease, color 0.12s ease;
  padding: 0;
  background: rgba(255, 255, 255, 0.08);
}

.window__btn:hover {
  color: #fff;
}

.window__btn--close {
  background: rgba(255, 95, 87, 0.25);
  color: #FF5F57;
}

.window__btn--close:hover {
  background: #FF5F57;
  color: #fff;
}

.window__btn--minimize {
  background: rgba(255, 189, 46, 0.2);
  color: #FFBD2E;
}

.window__btn--minimize:hover {
  background: #FFBD2E;
  color: #1A1A1A;
}

.window__btn--maximize {
  background: rgba(39, 201, 63, 0.2);
  color: #27C93F;
}

.window__btn--maximize:hover {
  background: #27C93F;
  color: #1A1A1A;
}

.window:not(.window--focused) .window__btn {
  background: rgba(255, 255, 255, 0.05);
  color: #555;
}

.window:not(.window--focused) .window__btn:hover {
  color: #999;
  background: rgba(255, 255, 255, 0.1);
}

.window:not(.window--focused) .window__btn--close:hover {
  background: #FF5F57;
  color: #fff;
}

/* Window Title */
.window__title {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  color: #999;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 80px;
}

.window:not(.window--focused) .window__title {
  color: #666;
}

/* Drag Zone */
.window__drag-zone {
  position: absolute;
  top: 0;
  left: 80px;
  right: 80px;
  height: 100%;
  cursor: grab;
}

.window__drag-zone:active {
  cursor: grabbing;
}

/* Window Body */
.window__body {
  flex: 1;
  background: #F5F5F0;
  overflow: auto;
  position: relative;
}

/* Maximized State */
.window--maximized {
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  border-radius: 0;
  border: none;
}

.window--maximized .window__drag-zone {
  cursor: default;
}

/* Resize Handles */
.window__resize {
  position: absolute;
  z-index: 10;
}

.window__resize--n {
  top: -3px;
  left: 8px;
  right: 8px;
  height: 6px;
  cursor: n-resize;
}

.window__resize--s {
  bottom: -3px;
  left: 8px;
  right: 8px;
  height: 6px;
  cursor: s-resize;
}

.window__resize--e {
  right: -3px;
  top: 8px;
  bottom: 8px;
  width: 6px;
  cursor: e-resize;
}

.window__resize--w {
  left: -3px;
  top: 8px;
  bottom: 8px;
  width: 6px;
  cursor: w-resize;
}

.window__resize--ne {
  top: -3px;
  right: -3px;
  width: 12px;
  height: 12px;
  cursor: ne-resize;
}

.window__resize--nw {
  top: -3px;
  left: -3px;
  width: 12px;
  height: 12px;
  cursor: nw-resize;
}

.window__resize--se {
  bottom: -3px;
  right: -3px;
  width: 12px;
  height: 12px;
  cursor: se-resize;
}

.window__resize--sw {
  bottom: -3px;
  left: -3px;
  width: 12px;
  height: 12px;
  cursor: sw-resize;
}

.window--maximized .window__resize {
  display: none;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .window {
    position: fixed !important;
    top: 28px !important;
    left: 0 !important;
    width: 100vw !important;
    height: calc(100vh - 28px - 52px) !important;
    border-radius: 0;
    border: none;
    min-width: unset;
    transform: none !important;
  }

  .window__resize {
    display: none;
  }

  .window__drag-zone {
    cursor: default;
  }

  .window__btn--minimize,
  .window__btn--maximize {
    display: none;
  }
}
