/* Inventory System Popup Modal */
#inventoryModal {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: 90% !important;
  max-width: 900px !important;
  max-height: 85vh !important;
  background: #23272b;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  z-index: 10001;
  display: none;
  flex-direction: column;
  border: 2px solid #4caf50;
  /* Fixed position, not draggable */
  user-select: none;
  right: auto !important;
  bottom: auto !important;
}

#inventoryModal.active {
  display: flex;
}

.inventory-header {
  background: #1a1d21;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* Remove cursor: move */
  border-bottom: 2px solid #4caf50;
  border-radius: 12px 12px 0 0;
}

.inventory-header h3 {
  color: #4caf50;
  font-size: 1.3em;
  font-weight: 700;
  margin: 0;
}

.inventory-header-actions {
  display: flex;
  gap: 8px;
}

.inventory-btn-minimize,
.inventory-btn-close {
  padding: 4px 8px;
  border-radius: 4px;
}

.inventory-btn-minimize:hover,
.inventory-btn-close:hover {
  background: rgba(76, 175, 80, 0.1);
}

/* Inventory Details Close Button */
.inventory-details-close {
  position: absolute !important;
  top: 8px !important;
  right: 8px !important;
  left: auto !important;
  width: 32px !important;
  height: 32px !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  text-align: right !important;
}

.inventory-content {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.inventory-slot {
  aspect-ratio: 1;
  background: #1a1d21;
  border: 2px solid #333;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  min-height: 60px;
}

.inventory-slot:hover {
  border-color: #4caf50;
  transform: translateY(-4px);
}

.inventory-slot.empty {
  background: #141618;
}

.inventory-slot.has-item {
  background: #1a1d21;
}

.inventory-slot.selected {
  border-color: #4caf50;
  border-width: 3px;
  box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.inventory-slot-icon {
  font-size: 1.5em;
  color: #4caf50;
  margin-bottom: 4px;
}

.inventory-slot-name {
  color: #4caf50;
  font-weight: 600;
  font-size: 0.65em;
  text-align: center;
  word-break: break-word;
  line-height: 1.1;
}

.inventory-slot-quantity {
  position: absolute;
  top: 2px;
  right: 2px;
  background: #4caf50;
  color: #1a1d21;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.6em;
  font-weight: 700;
}

.inventory-details {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #1a1d21;
  border: 3px solid #4caf50;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
  z-index: 10001;
  min-width: 280px;
  display: none;
}

.inventory-details.active {
  display: block;
}

.inventory-details h4 {
  color: #4caf50;
  margin-bottom: 12px;
  font-size: 1.2em;
  text-align: center;
}

.inventory-details-description {
  color: #999;
  margin-bottom: 16px;
  text-align: center;
}

.inventory-btn-use {
  width: 100%;
  padding: 12px;
  background: #4caf50;
  color: #1a1d21;
  border: none;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.inventory-btn-use:hover {
  background: #45a049;
  transform: scale(1.02);
}

.inventory-btn-use:disabled {
  background: #444;
  color: #888;
  cursor: not-allowed;
  transform: none;
}

/* Minimized state */
#inventoryModal.minimized {
  height: auto;
  max-height: none;
}

#inventoryModal.minimized .inventory-content {
  display: none;
}

/* Responsive */
@media (max-width: 768px) {
  #inventoryModal {
    width: 95%;
    max-width: 95%;
    max-height: 85vh;
  }
  
  .inventory-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
  }
  
  .inventory-slot {
    min-height: 50px;
  }
  
  .inventory-slot-name {
    font-size: 0.55em;
  }
}
