.window {
  position: absolute;
  min-width: 180px;
  min-height: 150px;
  background: var(--panel-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  box-shadow: var(--glass-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast);
  
  /* Animations */
  animation: window-open var(--transition-normal);
  will-change: transform, opacity;
}

.window.active {
  background: var(--panel-bg-active);
  border-color: var(--panel-border-active);
  box-shadow: var(--glass-shadow-active);
}

.window-header {
  height: 40px;
  min-height: 40px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: move;
}

.window.active .window-header {
  border-bottom-color: rgba(99, 102, 241, 0.2);
  background: rgba(99, 102, 241, 0.05);
}

.window-title {
  font-family: var(--font-title);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.window.active .window-title {
  color: #fff;
}

.window-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.window-btn {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-fast), transform var(--transition-fast);
}

.window-btn-close {
  background: rgba(239, 68, 68, 0.4);
}

.window-btn-close:hover {
  background: var(--danger);
  transform: scale(1.1);
}

.window-body {
  flex: 1;
  padding: 16px;
  overflow: auto;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
  user-select: text; /* Allow selecting text inside window body */
}

/* Scrollbar inside window body */
.window-body::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.window-body::-webkit-scrollbar-track {
  background: transparent;
}

.window-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.window-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Close transition class */
.window.closing {
  animation: window-close var(--transition-fast) forwards;
}

@keyframes window-open {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes window-close {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.95);
  }
}

/* Minimap Window Styles */
.minimap-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.minimap-container {
  position: relative;
  width: 100%;
  height: 135px; /* Default height, dynamically recalculated by JS relative to viewport aspect ratio */
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

/* Represents the background canvas space (4000x3000) */
.minimap-canvas-indicator {
  position: absolute;
  border: 1.5px dashed var(--primary);
  background: rgba(99, 102, 241, 0.06);
  border-radius: 4px;
  pointer-events: none;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.15);
  will-change: left, top, width, height;
}

/* Moving grid representing the background's visual reference coordinates */
.minimap-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 1.25% 1.667%; /* Exactly represents 50px grid lines inside 4000x3000 space */
  pointer-events: none;
}

/* Pinned items are children of the canvas indicator, so they scale/translate automatically */
.minimap-pin-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff55bb;
  border: 1px solid #fff;
  box-shadow: 0 0 6px #ff55bb;
  transform: translate(-50%, -50%); /* Centered */
  pointer-events: none;
}

.minimap-controls {
  display: flex;
  align-items: center;
  margin-top: 10px;
}

.minimap-toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
}

.minimap-toggle-checkbox {
  width: 14px;
  height: 14px;
  accent-color: var(--primary);
  cursor: pointer;
}

.minimap-readout {
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  font-family: 'Courier New', Courier, monospace;
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
  overflow: hidden;
  max-height: 100px;
  opacity: 1;
  transition: opacity var(--transition-fast), max-height var(--transition-fast), padding var(--transition-fast), margin var(--transition-fast), border var(--transition-fast);
}

.minimap-readout.hidden {
  opacity: 0;
  max-height: 0;
  padding: 0;
  margin-top: 0;
  border: none;
}

