/* ============================================================================
   WINDOW CONTAINER
   ============================================================================ */

.app-window {
  color: white;
  border-radius: 0.75rem;
  padding: 0;
  gap: 0;
  position: fixed;
  width: 60vw;
  height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: scale(0.9);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.1);
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(0.5rem);
  -webkit-backdrop-filter: blur(0.5rem);
  transition: opacity 0.3s ease, border-color 0.3s ease-in-out, transform 0.3s ease, background 0.3s ease-in-out, backdrop-filter 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}
.app-window:hover {
  box-shadow: 0 1rem 3rem 0 rgba(0, 0, 0, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
}
.app-window.visible {
  opacity: 1;
  transform: scale(1);
}
.app-window.dragging {
  cursor: move;
}
.app-window.dragging .window-header {
  cursor: move;
}
.app-window.fullscreen {
  width: 100vw !important;
  height: 100vh !important;
  border-radius: 0;
  top: 0 !important;
  left: 0 !important;
  border: none;
}
.app-window.fullscreen .resize-handle {
  display: none;
}
.app-window.resizing {
  transition: none;
}

/* ============================================================================
   WINDOW HEADER
   ============================================================================ */

.window-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  cursor: move;
  user-select: none;
  -webkit-user-select: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}
.window-header:active {
  cursor: grabbing;
}
.window-header .window-title {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.window-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Window control buttons */

.window-btn {
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  color: white;
  background: rgba(255, 255, 255, 0.1);
  padding: 0;
}
.window-btn:hover {
  color: white;
  border-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.2);
  background: transparent;
}
.window-btn:active {
  transform: scale(0.95);
}
.window-btn i {
  font-size: 0.75rem;
}

/* ============================================================================
   WINDOW CONTENT
   ============================================================================ */

.window-content {
  flex: 1;
  display: flex;
  overflow: hidden;
  background: black;
}
.window-content iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* ============================================================================
   RESIZE HANDLES
   ============================================================================ */

.resize-handle {
  position: absolute;
  z-index: 10;
}

.resize-n {
  top: 0;
  left: 0;
  width: 100%;
  height: 8px;
  cursor: ns-resize;
}

.resize-s {
  bottom: 0;
  left: 0;
  width: 100%;
  height: 8px;
  cursor: ns-resize;
}

.resize-e {
  top: 0;
  right: 0;
  width: 8px;
  height: 100%;
  cursor: ew-resize;
}

.resize-w {
  top: 0;
  left: 0;
  width: 8px;
  height: 100%;
  cursor: ew-resize;
}

.resize-ne {
  top: 0;
  right: 0;
  width: 16px;
  height: 16px;
  cursor: nesw-resize;
}

.resize-nw {
  top: 0;
  left: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
}

.resize-se {
  bottom: 0;
  right: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
}

.resize-sw {
  bottom: 0;
  left: 0;
  width: 16px;
  height: 16px;
  cursor: nesw-resize;
}

/* ============================================================================
   RESPONSIVE STYLES
   ============================================================================ */

/* Mobile Styles (800px and below) */
@media (max-width: 800px) {
  /* Force fullscreen on mobile */
  .app-window {
    width: 100vw !important;
    height: 100vh !important;
    border-radius: 0;
    top: 0 !important;
    left: 0 !important;
    border: none;
    box-shadow: none;
  }

  /* Disable dragging on mobile */
  .window-header {
    cursor: default;
  }
  .window-header:active {
    cursor: default;
  }

  /* Prevent body scroll when window is visible */
  body:has(.app-window.visible) {
    overflow: hidden;
  }
}
