/* styles/window.css */

/* Outer Window Wrapper - Classic Windows 95 Bevel */
.os-window {
  position: absolute;
  display: flex;
  flex-direction: column;
  background-color: #c0c0c0;
  
  /* 3D Raised Bevel Border */
  border-top: 2px solid #ffffff;
  border-left: 2px solid #ffffff;
  border-right: 2px solid #404040;
  border-bottom: 2px solid #404040;
  box-shadow: 1px 1px 0px #000000;
  
  overflow: hidden;
  pointer-events: auto;
  min-width: 200px;
  min-height: 100px;
  opacity: 0.85; /* Inactive windows are slightly transparent in this theme */
  transform: scale(1);
  transition: opacity var(--duration-short) var(--ease-fluent);
}

/* Focused State */
.os-window--focused {
  opacity: 1;
  /* Dotted pixel outer highlight border for focused window */
  outline: 1px dotted #000;
  outline-offset: -3px;
}

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

/* Minimized State */
.os-window--minimized {
  display: none !important;
}

/* Title Bar (Window Chrome Header) */
.os-window-titlebar {
  height: 22px; /* Snappy classic height */
  margin: 2px 2px 0 2px;
  /* Dynamically uses user-selected Accent Color */
  background: var(--color-accent) !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 0 4px;
  cursor: default;
  color: #ffffff;
}

/* Title Bar Inactive state */
.os-window:not(.os-window--focused) .os-window-titlebar {
  background: #808080 !important;
  color: #c0c0c0 !important;
}

.os-window-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Window Chrome Custom Icon Replacements */
.os-window-icon {
  font-size: 0 !important;
  color: transparent !important;
  display: inline-block;
  width: 16px;
  height: 16px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.os-window[data-app-id="welcome"] .os-window-icon {
  background-image: url('../assets/icons/much_welcome.png');
}
.os-window[data-app-id="notepad"] .os-window-icon {
  background-image: url('../assets/icons/doge_scribbles.png');
}
.os-window[data-app-id="settings"] .os-window-icon {
  background-image: url('../assets/icons/so_settings.png');
}
.os-window[data-app-id="taskmanager"] .os-window-icon {
  background-image: url('../assets/icons/very_performance.png');
}
.os-window[data-app-id="troll"] .os-window-icon {
  background-image: url('../assets/icons/troll_face.png') !important;
}

/* Title Bar Window Actions Control Area */
.os-window-controls {
  display: flex;
  align-items: center;
  gap: 2px;
}

.os-window-control-btn {
  width: 16px;
  height: 14px;
  border-top: 1.5px solid #ffffff;
  border-left: 1.5px solid #ffffff;
  border-right: 1.5px solid #404040;
  border-bottom: 1.5px solid #404040;
  background-color: #c0c0c0;
  color: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: bold;
  cursor: pointer;
  padding: 0;
  margin: 0;
  outline: none;
}

/* Button Active pressed state */
.os-window-control-btn:active {
  border-top: 1.5px solid #404040;
  border-left: 1.5px solid #404040;
  border-right: 1.5px solid #ffffff;
  border-bottom: 1.5px solid #ffffff;
  padding-top: 1px;
  padding-left: 1px;
}

/* Specialized Close Button styling */
.os-window-control-btn--close {
  margin-left: 2px;
}

/* Window Content Body Pane - Inset bevel */
.os-window-body {
  flex: 1;
  position: relative;
  overflow: auto;
  background-color: #ffffff;
  color: #000000;
  margin: 4px;
  
  /* 3D Inset Bevel Border */
  border-top: 2px solid #808080;
  border-left: 2px solid #808080;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  box-shadow: inset 1px 1px 0px #000000;
}

/* Resizing System Handles Layer */
.os-window-resize-handle {
  position: absolute;
  background-color: transparent;
  z-index: 10;
}

/* Cardinal Directions Handles */
.os-window-resize-handle--n {
  top: -4px;
  left: 6px;
  right: 6px;
  height: 8px;
  cursor: ns-resize;
}

.os-window-resize-handle--s {
  bottom: -4px;
  left: 6px;
  right: 6px;
  height: 8px;
  cursor: ns-resize;
}

.os-window-resize-handle--e {
  right: -4px;
  top: 6px;
  bottom: 6px;
  width: 8px;
  cursor: ew-resize;
}

.os-window-resize-handle--w {
  left: -4px;
  top: 6px;
  bottom: 6px;
  width: 8px;
  cursor: ew-resize;
}

/* Corner Diagonal Handles */
.os-window-resize-handle--nw {
  top: -4px;
  left: -4px;
  width: 10px;
  height: 10px;
  cursor: nwse-resize;
}

.os-window-resize-handle--ne {
  top: -4px;
  right: -4px;
  width: 10px;
  height: 10px;
  cursor: nesw-resize;
}

.os-window-resize-handle--sw {
  bottom: -4px;
  left: -4px;
  width: 10px;
  height: 10px;
  cursor: nesw-resize;
}

.os-window-resize-handle--se {
  bottom: -4px;
  right: -4px;
  width: 10px;
  height: 10px;
  cursor: nwse-resize;
}

/* Snap Preview Overlay styles - Hot Neon Pink and Cyan Vaporwave vibe */
.os-snap-preview {
  position: absolute;
  background-color: rgba(255, 0, 128, 0.15); 
  border: 2px dashed #ff0080;
  backdrop-filter: none;
  border-radius: 0;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.98);
  z-index: 50;
  transition: opacity var(--duration-short) var(--ease-fluent);
}

.os-snap-preview--active {
  opacity: 1;
  transform: scale(1);
}

/* Hide resize handles for maximized and snapped windows to prevent boundary corruption */
.os-window--maximized .os-window-resize-handle,
.os-window--snapped .os-window-resize-handle {
  display: none !important;
}
